MCPcopy Create free account
hub / github.com/apache/httpd / add_authz_provider

Function add_authz_provider

modules/aaa/mod_authz_core.c:391–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389}
390
391static const char *add_authz_provider(cmd_parms *cmd, void *config,
392 const char *args)
393{
394 authz_core_dir_conf *conf = (authz_core_dir_conf*)config;
395 authz_section_conf *section = apr_pcalloc(cmd->pool, sizeof(*section));
396 authz_section_conf *child;
397
398 section->provider_name = ap_getword_conf(cmd->pool, &args);
399
400 if (!strcasecmp(section->provider_name, "not")) {
401 section->provider_name = ap_getword_conf(cmd->pool, &args);
402 section->negate = 1;
403 }
404
405 section->provider_args = args;
406
407 /* lookup and cache the actual provider now */
408 section->provider = ap_lookup_provider(AUTHZ_PROVIDER_GROUP,
409 section->provider_name,
410 AUTHZ_PROVIDER_VERSION);
411
412 /* by the time the config file is used, the provider should be loaded
413 * and registered with us.
414 */
415 if (!section->provider) {
416 return apr_psprintf(cmd->pool,
417 "Unknown Authz provider: %s",
418 section->provider_name);
419 }
420
421 /* if the provider doesn't provide the appropriate function, reject it */
422 if (!section->provider->check_authorization) {
423 return apr_psprintf(cmd->pool,
424 "The '%s' Authz provider is not supported by any "
425 "of the loaded authorization modules",
426 section->provider_name);
427 }
428
429 section->limited = cmd->limited;
430
431 if (section->provider->parse_require_line) {
432 const char *err;
433 apr_pool_userdata_setn(section->provider_name,
434 AUTHZ_PROVIDER_NAME_NOTE,
435 apr_pool_cleanup_null,
436 cmd->temp_pool);
437 err = section->provider->parse_require_line(cmd, args,
438 &section->provider_parsed_args);
439
440 if (err)
441 return err;
442 }
443
444 if (!conf->section) {
445 conf->section = create_default_section(cmd->pool);
446 }
447
448 if (section->negate && conf->section->op == AUTHZ_LOGIC_OR) {

Callers

nothing calls this directly

Calls 4

ap_getword_confFunction · 0.85
ap_lookup_providerFunction · 0.85
create_default_sectionFunction · 0.85
format_authz_commandFunction · 0.85

Tested by

no test coverage detected