| 595 | } |
| 596 | |
| 597 | static int authz_core_check_section(apr_pool_t *p, server_rec *s, |
| 598 | authz_section_conf *section, int is_conf) |
| 599 | { |
| 600 | authz_section_conf *prev = NULL; |
| 601 | authz_section_conf *child = section->first; |
| 602 | int ret = !OK; |
| 603 | |
| 604 | while (child) { |
| 605 | if (child->first) { |
| 606 | if (authz_core_check_section(p, s, child, 0) != OK) { |
| 607 | return !OK; |
| 608 | } |
| 609 | |
| 610 | if (child->negate && child->op != section->op) { |
| 611 | authz_section_conf *next = child->next; |
| 612 | |
| 613 | /* avoid one level of recursion when De Morgan permits */ |
| 614 | child = child->first; |
| 615 | |
| 616 | if (prev) { |
| 617 | prev->next = child; |
| 618 | } |
| 619 | else { |
| 620 | section->first = child; |
| 621 | } |
| 622 | |
| 623 | do { |
| 624 | child->negate = !child->negate; |
| 625 | } while (child->next && (child = child->next)); |
| 626 | |
| 627 | child->next = next; |
| 628 | } |
| 629 | } |
| 630 | |
| 631 | prev = child; |
| 632 | child = child->next; |
| 633 | } |
| 634 | |
| 635 | child = section->first; |
| 636 | |
| 637 | while (child) { |
| 638 | if (!child->negate) { |
| 639 | ret = OK; |
| 640 | break; |
| 641 | } |
| 642 | |
| 643 | child = child->next; |
| 644 | } |
| 645 | |
| 646 | if (ret != OK) { |
| 647 | ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, APR_SUCCESS, s, APLOGNO(01624) |
| 648 | "%s directive contains only negative authorization directives", |
| 649 | is_conf ? "<Directory>, <Location>, or similar" |
| 650 | : format_authz_command(p, section)); |
| 651 | } |
| 652 | |
| 653 | return ret; |
| 654 | } |
no test coverage detected