コード例 #1
0
ファイル: oss_xml.c プロジェクト: lixiaofly/oss
void oss_list_objects_content_parse(aos_pool_t *p, xmlNodePtr xml_node, oss_list_object_content_t *content)
{
    char *key;
    char *last_modified;
    char *etag;
    char *size;

    while (xml_node) {
        xmlChar *node_content = xmlNodeGetContent(xml_node);
        if (apr_strnatcasecmp((char *)xml_node->name, "Key") == 0) {
            key = apr_pstrdup(p, (char *)node_content);
            aos_str_set(&content->key, key);
        } else if (apr_strnatcasecmp((char *)xml_node->name, "LastModified") == 0) {
            last_modified = apr_pstrdup(p, (char *)node_content);
            aos_str_set(&content->last_modified, last_modified);
        } else if (apr_strnatcasecmp((char *)xml_node->name, "ETag") == 0) {
            etag = apr_pstrdup(p, (char *)node_content);
            aos_str_set(&content->etag, etag);
        } else if (apr_strnatcasecmp((char *)xml_node->name, "Size") == 0) {
            size = apr_pstrdup(p, (char *)node_content);
            aos_str_set(&content->size, size);
        } else if (apr_strnatcasecmp((char *)xml_node->name, "Owner") == 0) {
            oss_list_objects_owner_parse(p, xml_node, content);
        }
        xmlFree(node_content);
        xml_node = xml_node->next;
    }
}
コード例 #2
0
/* Returns TRUE if TABLE specifies an intermediate result table, which is
   allowed to have table scans, etc. */
static svn_boolean_t
is_result_table(const char *table_name)
{
  return (apr_strnatcasecmp(table_name, "target_prop_cache") == 0
          || apr_strnatcasecmp(table_name, "changelist_list") == 0
          || FALSE);
}
コード例 #3
0
ファイル: oss_xml.c プロジェクト: lixiaofly/oss
void oss_list_parts_content_parse(aos_pool_t *p, xmlNodePtr xml_node, oss_list_part_content_t *content)
{
    char *part_number;
    char *last_modified;
    char *etag;
    char *size;

    while (xml_node) {
        xmlChar *node_content = xmlNodeGetContent(xml_node);
        if (apr_strnatcasecmp((char *)xml_node->name, "PartNumber") == 0) {
            part_number = apr_pstrdup(p, (char *)node_content);
            aos_str_set(&content->part_number, part_number);
        } else if (apr_strnatcasecmp((char *)xml_node->name, "LastModified") == 0) {
            last_modified = apr_pstrdup(p, (char *)node_content);
            aos_str_set(&content->last_modified, last_modified);
        } else if (apr_strnatcasecmp((char *)xml_node->name, "ETag") == 0) {
            etag = apr_pstrdup(p, (char *)node_content);
            aos_str_set(&content->etag, etag);
        } else if (apr_strnatcasecmp((char *)xml_node->name, "Size") == 0) {
            size = apr_pstrdup(p, (char *)node_content);
            aos_str_set(&content->size, size);
        }
        xmlFree(node_content);
        xml_node = xml_node->next;
    }
}
コード例 #4
0
ファイル: mod_dav_svn.c プロジェクト: Ranga123/test1
static const char *
SVNPathAuthz_cmd(cmd_parms *cmd, void *config, const char *arg1)
{
  dir_conf_t *conf = config;

  if (apr_strnatcasecmp("off", arg1) == 0)
    {
      conf->path_authz_method = CONF_PATHAUTHZ_OFF;
    }
  else if (apr_strnatcasecmp(PATHAUTHZ_BYPASS_ARG, arg1) == 0)
    {
      conf->path_authz_method = CONF_PATHAUTHZ_BYPASS;
      if (pathauthz_bypass_func == NULL)
        {
          pathauthz_bypass_func =
            ap_lookup_provider(AUTHZ_SVN__SUBREQ_BYPASS_PROV_GRP,
                               AUTHZ_SVN__SUBREQ_BYPASS_PROV_NAME,
                               AUTHZ_SVN__SUBREQ_BYPASS_PROV_VER);
        }
    }
  else if (apr_strnatcasecmp("on", arg1) == 0)
    {
      conf->path_authz_method = CONF_PATHAUTHZ_ON;
    }
  else
    {
      return "Unrecognized value for SVNPathAuthz directive";
    }

  return NULL;
}
コード例 #5
0
const char *readparamsvr(cmd_parms *cmd, void *cfg, const char *value) {
	mod_server_cfg *c = (mod_server_cfg*)cfg;
	int i;

	if(0 == apr_strnatcmp(cmd->directive->directive, STS_TIMEOUT)) {
		i = atoi(value);
		if(i >= 0) {
			c->stsTimeout = (unsigned int)i;
		}
		else {
			return apr_psprintf(cmd->pool, "MOD_SECURE_HEADERS: Invalid %s (%s) specified -- Must be 0 or greater", STS_TIMEOUT, value);
		}
	}
	else if(0 == apr_strnatcmp(cmd->directive->directive, STS_SUBDOMAINS)) {
		if(0 == apr_strnatcasecmp(value, "On")) {
			c->includeSubDomains = TRUE;
		}
		else if(0 == apr_strnatcasecmp(value, "Off")) {
			c->includeSubDomains = FALSE;
		}
		else {
			return apr_psprintf(cmd->pool, "MOD_SECURE_HEADERS: Invalid argument to %s - must be 'On' or 'Off'", STS_SUBDOMAINS);
		}
	}
	else {
		return apr_psprintf(cmd->pool, "MOD_SECURE_HEADERS: Invalid server directive '%s'", cmd->directive->directive);
	}

	return NULL;
}
コード例 #6
0
ファイル: wc-queries-test.c プロジェクト: geofft/subversion
/* Returns TRUE if TABLE_NAME specifies a nodes table, which should be indexed
   by wc_id and either local_relpath or parent_relpath */
static svn_boolean_t
is_node_table(const char *table_name)
{
  return (apr_strnatcasecmp(table_name, "nodes") == 0
          || apr_strnatcasecmp(table_name, "actual_node") == 0
          || apr_strnatcasecmp(table_name, "externals") == 0
          || apr_strnatcasecmp(table_name, "wc_lock") == 0
          || FALSE);
}
コード例 #7
0
ファイル: mod_dav_rawx.c プロジェクト: korween/oio-sds
static int
_str_to_boolean(const char *arg)
{
	int n_arg = 0;
	n_arg |= (0 == apr_strnatcasecmp(arg, "on"));
	n_arg |= (0 == apr_strnatcasecmp(arg, "true"));
	n_arg |= (0 == apr_strnatcasecmp(arg, "yes"));
	n_arg |= (0 == apr_strnatcasecmp(arg, "enabled"));
	n_arg |= (0 == apr_strnatcasecmp(arg, "1"));

	return n_arg;
}
コード例 #8
0
static int
dav_rawx_is_same_resource(const dav_resource *res1, const dav_resource *res2)
{
	dav_resource_private *ctx1 = res1->info;
	dav_resource_private *ctx2 = res2->info;

	DAV_XDEBUG_RES(res1, 0, "%s(%s,%s)", __FUNCTION__,
		resource_get_pathname(res1), resource_get_pathname(res2));

	return (res1->type == res2->type)
		&& (0 == apr_strnatcasecmp(ctx1->hex_chunkid, ctx2->hex_chunkid))
		&& (0 == apr_strnatcasecmp(ctx1->dirname, ctx2->dirname))
		&& (0 == apr_strnatcasecmp(ctx1->file_extension, ctx2->file_extension));
}
コード例 #9
0
ファイル: mod_svmloc.c プロジェクト: lairdm/apache-svm
static SVM_Obj_holder* mod_SVMLoc_fetch_SVM(server_rec* s, apr_pool_t* pool, const char* hSVM, int make) {
  SVM_Obj_holder* SVM_Obj;
  mod_SVMLoc_svr_cfg* svr
    = ap_get_module_config(s->module_config, &svmloc_module);

  SVM_Obj = svr->SVMList;

  while(SVM_Obj->nextSVM != NULL) {
    if(!apr_strnatcasecmp(SVM_Obj->SVM_handler, hSVM))
      break;

    SVM_Obj = (SVM_Obj_holder*)SVM_Obj->nextSVM;
  }

  if(SVM_Obj->nextSVM == NULL) {
    if(make) {
      SVM_Obj->nextSVM = apr_pcalloc(pool, sizeof(SVM_Obj_holder));
      SVM_Obj->SVM_handler = apr_pstrdup(pool, hSVM);
      ((SVM_Obj_holder*)SVM_Obj->nextSVM)->nextSVM = NULL;
      ((SVM_Obj_holder*)SVM_Obj->nextSVM)->pSVM = NULL;
      ((SVM_Obj_holder*)SVM_Obj->nextSVM)->model_filename = NULL;
      ((SVM_Obj_holder*)SVM_Obj->nextSVM)->freqpattern_filename = NULL;
    } else {
      return NULL;
    }
  }

  return SVM_Obj;

}
コード例 #10
0
ファイル: apr_net.c プロジェクト: BDA-CODE/monitor-core
apr_socket_t *
create_mcast_server(apr_pool_t *context, int32_t family, char *mcast_ip, apr_port_t port, char *bind_addr, char *interface)
{
  apr_status_t status = APR_SUCCESS;
  /* NOTE: If bind is set to mcast_ip in the configuration file, then we will bind the 
   * the multicast address to the socket as well as the port and prevent any 
   * datagrams that might be delivered to this port from being processed. Otherwise,
   * packets destined to the same port (but a different multicast/unicast channel) will be
   * processed. */
  apr_socket_t *socket = create_udp_server(context, family, port, bind_addr);
  if(!socket)
    {
      return NULL;
    }

  /* TODO: We can probe for a list of interfaces and perform multiple join calls for the same
   * socket to have it listen for multicast traffic on all interfaces (important for
   * multihomed machines). */
  if(interface && !apr_strnatcasecmp(interface, "ALL"))
    {
      /* for(each interface)
       * {
       *   join_mcast(...);
       * }
       */
    }
  else
    {
      status = join_mcast(context,  socket, mcast_ip, port, interface );
    }

  return status == APR_SUCCESS? socket: NULL;
}
コード例 #11
0
ファイル: config.c プロジェクト: 2asoft/freebsd
/* Return a pointer to an option in CFG, or NULL if it doesn't exist.
   if SECTIONP is non-null, return a pointer to the option's section.
   OPTION may be NULL. */
static cfg_option_t *
find_option(svn_config_t *cfg, const char *section, const char *option,
            cfg_section_t **sectionp)
{
  void *sec_ptr = get_hash_value(cfg->sections, cfg->tmp_key, section,
                                 cfg->section_names_case_sensitive);
  if (sectionp != NULL)
    *sectionp = sec_ptr;

  if (sec_ptr != NULL && option != NULL)
    {
      cfg_section_t *sec = sec_ptr;
      cfg_option_t *opt = get_hash_value(sec->options, cfg->tmp_key, option,
                                         cfg->option_names_case_sensitive);
      /* NOTE: ConfigParser's sections are case sensitive. */
      if (opt == NULL
          && apr_strnatcasecmp(section, SVN_CONFIG__DEFAULT_SECTION) != 0)
        /* Options which aren't found in the requested section are
           also sought after in the default section. */
        opt = find_option(cfg, SVN_CONFIG__DEFAULT_SECTION, option, &sec);
      return opt;
    }

  return NULL;
}
コード例 #12
0
ファイル: mod_triger.c プロジェクト: dreamsxin/mod_triger
static int is_this_html(request_rec * r)
{
    int i = 0;
    const char *ctype_line_val =
	apr_table_get(r->headers_out, "Content-Type");

    if (!ctype_line_val) {
	if (r->content_type)
	    ctype_line_val = apr_pstrdup(r->pool, r->content_type);
	else
	    return 0;
    }

    const char *ctype = ap_getword(r->pool, &ctype_line_val, ';');
    if (!ctype)
	return 0;

    triger_conf_t *cfg =
	ap_get_module_config(r->per_dir_config, &triger_module);

    if (!cfg)
	return 0;

    for (i = 0; i < cfg->ctypes->nelts; i++)
	if (apr_strnatcasecmp
	    ((((triger_ctype_t *) (cfg->ctypes->elts))[i]).data,
	     ctype) == 0)
	    return 1;

    return 0;
}
コード例 #13
0
ファイル: oauth.c プロジェクト: Acidburn0zzz/mod_auth_openidc
/*
 * get the authorization header that should contain a bearer token
 */
static apr_byte_t oidc_oauth_get_bearer_token(request_rec *r,
		const char **access_token) {

	/* get the authorization header */
	const char *auth_line;
	auth_line = apr_table_get(r->headers_in, "Authorization");
	if (!auth_line) {
		oidc_debug(r, "no authorization header found");
		return FALSE;
	}

	/* look for the Bearer keyword */
	if (apr_strnatcasecmp(ap_getword(r->pool, &auth_line, ' '), "Bearer")) {
		oidc_error(r, "client used unsupported authentication scheme: %s",
				r->uri);
		return FALSE;
	}

	/* skip any spaces after the Bearer keyword */
	while (apr_isspace(*auth_line)) {
		auth_line++;
	}

	/* copy the result in to the access_token */
	*access_token = apr_pstrdup(r->pool, auth_line);

	/* log some stuff */
	oidc_debug(r, "bearer token: %s", *access_token);

	return TRUE;
}
コード例 #14
0
ファイル: tag_reader.c プロジェクト: soda0289/mod_MP
static int get_file_ext(apr_pool_t* pool, const char* file_path){
	int length = strlen(file_path);
	for(; length > 0; length--){
		if(file_path[length] == '.'){
			if(apr_strnatcasecmp((const char*)&file_path[length+1],"flac") == 0){
				return FLAC;
			}else if(apr_strnatcasecmp((const char*)&file_path[length+1],"ogg") == 0){
				return OGG;
			}else if(apr_strnatcasecmp((const char*)&file_path[length+1],"mp3") == 0){
				return MP3;
			}
			break;
		}
	}
	//Not known file extention
	return -1;
}
コード例 #15
0
ファイル: mod_dav_rainx.c プロジェクト: korween/oio-sds
static const char *
dav_rainx_cmd_gridconfig_acl(cmd_parms *cmd, void *config, const char *arg1)
{
	dav_rainx_server_conf *conf;
	(void) config;

	DAV_XDEBUG_POOL(cmd->pool, 0, "%s()", __FUNCTION__);

	conf = ap_get_module_config(cmd->server->module_config, &dav_rainx_module);
	conf->enabled_acl = 0;
	conf->enabled_acl |= (0 == apr_strnatcasecmp(arg1,"on"));
	conf->enabled_acl |= (0 == apr_strnatcasecmp(arg1,"true"));
	conf->enabled_acl |= (0 == apr_strnatcasecmp(arg1,"yes"));
	conf->enabled_acl |= (0 == apr_strnatcasecmp(arg1,"enabled"));

	return NULL;
}
コード例 #16
0
ファイル: h2_alt_svc.c プロジェクト: NeedfulThings/mod_h2
static int h2_alt_svc_handler(request_rec *r)
{
    h2_ctx *ctx;
    h2_config *cfg;
    int i;
    
    if (r->connection->keepalives > 0) {
        /* Only announce Alt-Svc on the first response */
        return DECLINED;
    }
    
    ctx = h2_ctx_rget(r);
    if (h2_ctx_is_active(ctx) || h2_ctx_is_task(ctx)) {
        return DECLINED;
    }
    
    cfg = h2_config_rget(r);
    if (r->hostname && cfg && cfg->alt_svcs && cfg->alt_svcs->nelts > 0) {
        const char *alt_svc_used = apr_table_get(r->headers_in, "Alt-Svc-Used");
        if (!alt_svc_used) {
            /* We have alt-svcs defined and client is not already using
             * one, announce the services that were configured and match. 
             * The security of this connection determines if we allow
             * other host names or ports only.
             */
            const char *alt_svc = "";
            const char *svc_ma = "";
            int secure = h2_h2_is_tls(r->connection);
            int ma = h2_config_geti(cfg, H2_CONF_ALT_SVC_MAX_AGE);
            if (ma >= 0) {
                svc_ma = apr_psprintf(r->pool, "; ma=%d", ma);
            }
            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                          "h2_alt_svc: announce %s for %s:%d", 
                          (secure? "secure" : "insecure"), 
                          r->hostname, (int)r->server->port);
            for (i = 0; i < cfg->alt_svcs->nelts; ++i) {
                h2_alt_svc *as = h2_alt_svc_IDX(cfg->alt_svcs, i);
                const char *ahost = as->host;
                if (ahost && !apr_strnatcasecmp(ahost, r->hostname)) {
                    ahost = NULL;
                }
                if (secure || !ahost) {
                    alt_svc = apr_psprintf(r->pool, "%s%s%s=\"%s:%d\"%s", 
                                           alt_svc,
                                           (*alt_svc? ", " : ""), as->alpn,
                                           ahost? ahost : "", as->port,
                                           svc_ma);
                }
            }
            if (*alt_svc) {
                apr_table_set(r->headers_out, "Alt-Svc", alt_svc);
            }
        }
    }
    
    return DECLINED;
}
コード例 #17
0
ファイル: oss_xml.c プロジェクト: lixiaofly/oss
void oss_list_objects_owner_parse(aos_pool_t *p, xmlNodePtr xml_node, oss_list_object_content_t *content)
{
    xmlNodePtr owner_node;
    char *owner_id;
    char *owner_display_name;

    for (owner_node = xml_node->xmlChildrenNode; owner_node != NULL; owner_node = owner_node->next) {
        xmlChar *node_content = xmlNodeGetContent(owner_node);
        if (apr_strnatcasecmp((char *)owner_node->name, "ID") == 0) {
            owner_id = apr_pstrdup(p, (char *)node_content);
            aos_str_set(&content->owner_id, owner_id);
        } else if (apr_strnatcasecmp((char *)owner_node->name, "DisplayName") == 0) {
            owner_display_name = apr_pstrdup(p, (char *)node_content);
            aos_str_set(&content->owner_display_name, owner_display_name);
        }
        xmlFree(node_content);
    }
}
コード例 #18
0
ファイル: tableobject.c プロジェクト: demos/Motif
static PyObject * table_subscript(tableobject *self, register PyObject *key)
{
    char *k;
    const apr_array_header_t *ah;
    apr_table_entry_t *elts;
    register int i;
    PyObject *list;

    if (key && !PyString_Check(key)) {
        PyErr_SetString(PyExc_TypeError,
                        "table keys must be strings");
        return NULL;
    }
    k = PyString_AsString(key);

    /* it's possible that we have duplicate keys, so
       we can't simply use apr_table_get since that just
       returns the first match.
    */

    list = PyList_New(0);
    if (!list) 
        return NULL;

    ah = apr_table_elts (self->table);
    elts = (apr_table_entry_t *) ah->elts;

    i = ah->nelts;

    while (i--)
        if (elts[i].key) {
            if (apr_strnatcasecmp(elts[i].key, k) == 0) {
                PyObject *v = PyString_FromString(elts[i].val);
                PyList_Insert(list, 0, v);
                Py_DECREF(v);
            }
        }

    /* if no mach */
    if (PyList_Size(list) == 0) {
        PyErr_SetObject(PyExc_KeyError, key);
        return NULL;
    }

    /* if we got one match */
    if (PyList_Size(list) == 1) {
        PyObject *v = PyList_GetItem(list, 0);
        Py_INCREF(v);
        Py_DECREF(list);
        return v;
    }

    /* else we return a list */
    return list;
}
コード例 #19
0
/*
 * check that the access_token type is supported
 */
static apr_byte_t oidc_proto_validate_token_type(request_rec *r,
		oidc_provider_t *provider, const char *token_type) {
	/*  we only support bearer/Bearer  */
	if ((token_type != NULL) && (apr_strnatcasecmp(token_type, "Bearer") != 0)
			&& (provider->userinfo_endpoint_url != NULL)) {
		oidc_error(r,
				"token_type is \"%s\" and UserInfo endpoint (%s) for issuer \"%s\" is set: can only deal with Bearer authentication against a UserInfo endpoint!",
				token_type, provider->userinfo_endpoint_url, provider->issuer);
		return FALSE;
	}
	return TRUE;
}
コード例 #20
0
static dav_error *
dav_rawx_move_resource(dav_resource *src_res, dav_resource *dst_res,
		dav_response **response)
{
	char buff[128];
	apr_pool_t *pool;
	pool = dst_res->pool;
	apr_status_t status;
	dav_error *e = NULL;
	dav_rawx_server_conf *srv_conf = resource_get_server_config(src_res);

	*response = NULL;

	if (DAV_RESOURCE_TYPE_REGULAR != src_res->type)  {
		e = server_create_and_stat_error(srv_conf, pool,
			HTTP_CONFLICT, 0, "Cannot MOVE this type of resource.");
		goto end_move;
	}
	if (src_res->collection) {
		e = server_create_and_stat_error(srv_conf, pool,
			HTTP_CONFLICT, 0, "No MOVE on collections");
		goto end_move;
	}
	if (apr_strnatcasecmp(src_res->info->hex_chunkid,
			dst_res->info->hex_chunkid)) {
		e = server_create_and_stat_error(srv_conf, pool,
				HTTP_FORBIDDEN, 0,
				"Source and destination chunk ids are not the same");
		goto end_move;
	}

	DAV_DEBUG_RES(src_res, 0, "Moving %s to %s",
			resource_get_pathname(src_res), resource_get_pathname(dst_res));
	status = apr_file_rename(resource_get_pathname(src_res),
			resource_get_pathname(dst_res), pool);

	if (status != APR_SUCCESS) {
		e = server_create_and_stat_error(srv_conf,
				pool, HTTP_INTERNAL_SERVER_ERROR, status,
				apr_pstrcat(pool, "Failed to MOVE this chunk: ",
					apr_strerror(status, buff, sizeof(buff)), NULL));
		goto end_move;
	}

	server_inc_stat(srv_conf, RAWX_STATNAME_REP_2XX, 0);

end_move:
	server_inc_request_stat(srv_conf, RAWX_STATNAME_REQ_OTHER,
			request_get_duration(src_res->info->request));

	return e;
}
コード例 #21
0
const char *readparam(cmd_parms *cmd, void *cfg, const char *value) {
	mod_cfg *c = (mod_cfg*)cfg;
	//int i;
	//char d;

	if(0 == apr_strnatcmp(cmd->directive->directive, OBEY_CONTENT_TYPE)) {
		if(0 == apr_strnatcasecmp(value, "On")) {
			c->mimeSniff = FALSE; /* ObeyContentType On => Disallow MIME sniffing */
		}
		else if(0 == apr_strnatcasecmp(value, "Off")) {
			c->mimeSniff = TRUE;
		}
		else {
			return apr_psprintf(cmd->pool, "MOD_SECURE_HEADERS: Invalid argument to %s - must be 'On' or 'Off'", OBEY_CONTENT_TYPE);
		}
	}
	else {
		return apr_psprintf(cmd->pool, "MOD_SECURE_HEADERS: Invalid directive '%s'", cmd->directive->directive);
	}

	return NULL;
}
コード例 #22
0
ファイル: oss_xml.c プロジェクト: lixiaofly/oss
void oss_list_objects_prefix_parse(aos_pool_t *p, xmlNodePtr prefix_node, oss_list_object_common_prefix_t *common_prefix)
{
    char *prefix;

    for (; prefix_node != NULL; prefix_node = prefix_node->next) {
        xmlChar *node_content = xmlNodeGetContent(prefix_node);
        if (apr_strnatcasecmp((char *)prefix_node->name, "Prefix") == 0) {
            prefix = apr_pstrdup(p, (char *)node_content);
            aos_str_set(&common_prefix->prefix, prefix);
        }
        xmlFree(node_content);
    }
}
コード例 #23
0
ファイル: oss_xml.c プロジェクト: lixiaofly/oss
void oss_list_multipart_uploads_content_parse(aos_pool_t *p, xmlNodePtr xml_node, 
    oss_list_multipart_upload_content_t *content)
{
    char *key;
    char *upload_id;
    char *initiated;

    while (xml_node) {
        xmlChar *node_content = xmlNodeGetContent(xml_node);
        if (apr_strnatcasecmp((char *)xml_node->name, "Key") == 0) {
            key = apr_pstrdup(p, (char *)node_content);
            aos_str_set(&content->key, key);
        } else if (apr_strnatcasecmp((char *)xml_node->name, "UploadId") == 0) {
            upload_id = apr_pstrdup(p, (char *)node_content);
            aos_str_set(&content->upload_id, upload_id);
        } else if (apr_strnatcasecmp((char *)xml_node->name, "Initiated") == 0) {
            initiated = apr_pstrdup(p, (char *)node_content);
            aos_str_set(&content->initiated, initiated);
        }
        xmlFree(node_content);
        xml_node = xml_node->next;
    } 
}
コード例 #24
0
ファイル: h2_util.c プロジェクト: stevedien/mod_h2
int h2_util_contains_token(apr_pool_t *pool, const char *s, const char *token)
{
    char *c;
    if (s) {
        if (!apr_strnatcasecmp(s, token)) {   /* the simple life */
            return 1;
        }
        
        for (c = ap_get_token(pool, &s, 0); c && *c;
             c = *s? ap_get_token(pool, &s, 0) : NULL) {
            if (!apr_strnatcasecmp(c, token)) { /* seeing the token? */
                return 1;
            }
            while (*s++ == ';') {            /* skip parameters */
                ap_get_token(pool, &s, 0);
            }
            if (*s++ != ',') {               /* need comma separation */
                return 0;
            }
        }
    }
    return 0;
}
コード例 #25
0
ファイル: mod_dav_rainx.c プロジェクト: korween/oio-sds
static const char *
dav_rainx_cmd_gridconfig_headers(cmd_parms *cmd, void *config, const char *arg1)
{
	dav_rainx_server_conf *conf;
	(void) config;

	DAV_XDEBUG_POOL(cmd->pool, 0, "%s()", __FUNCTION__);

	conf = ap_get_module_config(cmd->server->module_config, &dav_rainx_module);

	/* ensure a right default value */
	conf->headers_scheme = HEADER_SCHEME_V1;

	if (0 == apr_strnatcasecmp(arg1,"1"))
		conf->headers_scheme = HEADER_SCHEME_V1;
	else if (0 == apr_strnatcasecmp(arg1, "2"))
		conf->headers_scheme = HEADER_SCHEME_V2;
	else if (0 == apr_strnatcasecmp(arg1, "both"))
		conf->headers_scheme = HEADER_SCHEME_V1 | HEADER_SCHEME_V2;
	else
		return apr_psprintf(cmd->pool, "Grid Headers scheme : invalid value [%s]", arg1);

	return NULL;
}
コード例 #26
0
/** Get MRCP resource name by RTSP resource name */
MRCP_DECLARE(const char*) mrcp_name_get_by_rtsp_name(const apr_table_t *resource_map, const char *rtsp_name)
{
	const apr_array_header_t *header = apr_table_elts(resource_map);
	apr_table_entry_t *entry = (apr_table_entry_t *)header->elts;
	int i;
	
	for(i=0; i<header->nelts; i++) {
		if(entry[i].val && rtsp_name) {
			if(apr_strnatcasecmp(entry[i].val,rtsp_name) == 0) {
				return entry[i].key;
			}
		}
	}
	return rtsp_name;
}
コード例 #27
0
ファイル: mod_dav_svn.c プロジェクト: Ranga123/test1
static const char *
SVNAllowBulkUpdates_cmd(cmd_parms *cmd, void *config, const char *arg1)
{
  dir_conf_t *conf = config;

  if (apr_strnatcasecmp("on", arg1) == 0)
    {
      conf->bulk_updates = CONF_BULKUPD_ON;
    }
  else if (apr_strnatcasecmp("off", arg1) == 0)
    {
      conf->bulk_updates = CONF_BULKUPD_OFF;
    }
  else if (apr_strnatcasecmp("prefer", arg1) == 0)
    {
      conf->bulk_updates = CONF_BULKUPD_PREFER;
    }
  else
    {
      return "Unrecognized value for SVNAllowBulkUpdates directive";
    }

  return NULL;
}
コード例 #28
0
/*
 * parse a boolean value from a provided string
 */
const char *oidc_parse_boolean(apr_pool_t *pool, const char *arg,
		int *bool_value) {
	if ((apr_strnatcasecmp(arg, "true") == 0)
			|| (apr_strnatcasecmp(arg, "on") == 0)
			|| (apr_strnatcasecmp(arg, "yes") == 0)
			|| (apr_strnatcasecmp(arg, "1") == 0)) {
		*bool_value = TRUE;
		return NULL;
	}
	if ((apr_strnatcasecmp(arg, "false") == 0)
			|| (apr_strnatcasecmp(arg, "off") == 0)
			|| (apr_strnatcasecmp(arg, "no") == 0)
			|| (apr_strnatcasecmp(arg, "0") == 0)) {
		*bool_value = FALSE;
		return NULL;
	}
	return apr_psprintf(pool,
			"oidc_parse_boolean: could not parse boolean value from \"%s\"",
			arg);
}
コード例 #29
0
ファイル: mod_vhostx.c プロジェクト: porjo/mod_vhostx
/*
 * Set the fields inside the conf struct
 */
static const char * set_field(cmd_parms * parms, void *mconfig, const char *arg) {
	long pos = (long) parms->info;

	vhx_config_rec *vhr = (vhx_config_rec *) ap_get_module_config(parms->server->module_config, &vhostx_module);

	switch (pos) {
		case 1:
			vhr->path_prefix = apr_pstrdup(parms->pool, arg);
			break;
		case 2:
			vhr->default_host = apr_pstrdup(parms->pool, arg);
			break;
#ifdef HAVE_MOD_PHP_SUPPORT
		case 3:
			vhr->openbdir_path = apr_pstrdup(parms->pool, arg);
			break;
#endif /* HAVE_MOD_PHP_SUPPORT */

		case 4:
			vhr->ldap_binddn = apr_pstrdup(parms->pool, arg);
			break;

		case 5:
			vhr->ldap_bindpw = apr_pstrdup(parms->pool, arg);
			break;

		case 6:
			if (apr_strnatcasecmp(arg, "never") == 0 || apr_strnatcasecmp(arg, "off") == 0) {
				vhr->ldap_deref = never;
				vhr->ldap_have_deref = 1;
			}
			else if (apr_strnatcasecmp(arg, "searching") == 0) {
				vhr->ldap_deref = searching;
				vhr->ldap_have_deref = 1;
			}
			else if (apr_strnatcasecmp(arg, "finding") == 0) {
				vhr->ldap_deref = finding;
				vhr->ldap_have_deref = 1;
			}
			else if (apr_strnatcasecmp(arg, "always") == 0 || apr_strnatcasecmp(arg, "on") == 0) {
				vhr->ldap_deref = always;
				vhr->ldap_have_deref = 1;
			}
			else {
				return "Unrecognized value for vhx_DAPAliasDereference directive";
			}
			break;
	}
	return NULL;
}
コード例 #30
0
ファイル: h2_util.c プロジェクト: stevedien/mod_h2
const char *h2_util_first_token_match(apr_pool_t *pool, const char *s, 
                                      const char *tokens[], apr_size_t len)
{
    char *c;
    apr_size_t i;
    if (s && *s) {
        for (c = ap_get_token(pool, &s, 0); c && *c;
             c = *s? ap_get_token(pool, &s, 0) : NULL) {
            for (i = 0; i < len; ++i) {
                if (!apr_strnatcasecmp(c, tokens[i])) {
                    return tokens[i];
                }
            }
            while (*s++ == ';') {            /* skip parameters */
                ap_get_token(pool, &s, 0);
            }
            if (*s++ != ',') {               /* need comma separation */
                return 0;
            }
        }
    }
    return NULL;
}