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

Function add_authz_section

modules/aaa/mod_authz_core.c:473–573  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

471}
472
473static const char *add_authz_section(cmd_parms *cmd, void *mconfig,
474 const char *args)
475{
476 authz_core_dir_conf *conf = mconfig;
477 const char *endp = ap_strrchr_c(args, '>');
478 authz_section_conf *old_section = conf->section;
479 authz_section_conf *section;
480 int old_overrides = cmd->override;
481 apr_int64_t old_limited = cmd->limited;
482 const char *errmsg;
483
484 if (endp == NULL) {
485 return apr_pstrcat(cmd->pool, cmd->cmd->name,
486 "> directive missing closing '>'", NULL);
487 }
488
489 args = apr_pstrndup(cmd->temp_pool, args, endp - args);
490
491 if (args[0]) {
492 return apr_pstrcat(cmd->pool, cmd->cmd->name,
493 "> directive doesn't take additional arguments",
494 NULL);
495 }
496
497 section = apr_pcalloc(cmd->pool, sizeof(*section));
498
499 if (!strcasecmp(cmd->cmd->name, "<RequireAll")) {
500 section->op = AUTHZ_LOGIC_AND;
501 }
502 else if (!strcasecmp(cmd->cmd->name, "<RequireAny")) {
503 section->op = AUTHZ_LOGIC_OR;
504 }
505 else if (!strcasecmp(cmd->cmd->name, "<RequireNotAll")) {
506 section->op = AUTHZ_LOGIC_AND;
507 section->negate = 1;
508 }
509 else {
510 section->op = AUTHZ_LOGIC_OR;
511 section->negate = 1;
512 }
513
514 conf->section = section;
515
516 /* trigger NOT_IN_LIMIT errors as if this were a <Limit> directive */
517 cmd->limited &= ~(AP_METHOD_BIT << (METHODS - 1));
518
519 cmd->override = OR_AUTHCFG;
520 errmsg = ap_walk_config(cmd->directive->first_child, cmd, cmd->context);
521 cmd->override = old_overrides;
522
523 cmd->limited = old_limited;
524
525 conf->section = old_section;
526
527 if (errmsg) {
528 return errmsg;
529 }
530

Callers

nothing calls this directly

Calls 4

ap_strrchr_cFunction · 0.85
ap_walk_configFunction · 0.85
create_default_sectionFunction · 0.85
format_authz_commandFunction · 0.85

Tested by

no test coverage detected