| 720 | }; |
| 721 | |
| 722 | static authz_status apply_authz_sections(request_rec *r, |
| 723 | authz_section_conf *section, |
| 724 | authz_logic_op parent_op) |
| 725 | { |
| 726 | authz_status auth_result; |
| 727 | |
| 728 | /* check to make sure that the request method requires authorization */ |
| 729 | if (!(section->limited & (AP_METHOD_BIT << r->method_number))) { |
| 730 | auth_result = |
| 731 | (parent_op == AUTHZ_LOGIC_AND) ? AUTHZ_GRANTED : AUTHZ_NEUTRAL; |
| 732 | |
| 733 | ap_log_rerror(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, r, APLOGNO(01625) |
| 734 | "authorization result of %s: %s " |
| 735 | "(directive limited to other methods)", |
| 736 | format_authz_command(r->pool, section), |
| 737 | format_authz_result(auth_result)); |
| 738 | |
| 739 | return auth_result; |
| 740 | } |
| 741 | |
| 742 | if (section->provider) { |
| 743 | apr_table_setn(r->notes, AUTHZ_PROVIDER_NAME_NOTE, |
| 744 | section->provider_name); |
| 745 | |
| 746 | auth_result = |
| 747 | section->provider->check_authorization(r, section->provider_args, |
| 748 | section->provider_parsed_args); |
| 749 | |
| 750 | apr_table_unset(r->notes, AUTHZ_PROVIDER_NAME_NOTE); |
| 751 | } |
| 752 | else { |
| 753 | authz_section_conf *child = section->first; |
| 754 | |
| 755 | auth_result = AUTHZ_NEUTRAL; |
| 756 | |
| 757 | while (child) { |
| 758 | authz_status child_result; |
| 759 | |
| 760 | child_result = apply_authz_sections(r, child, section->op); |
| 761 | |
| 762 | if (child_result == AUTHZ_GENERAL_ERROR) { |
| 763 | return AUTHZ_GENERAL_ERROR; |
| 764 | } |
| 765 | |
| 766 | if (child_result != AUTHZ_NEUTRAL) { |
| 767 | /* |
| 768 | * Handling of AUTHZ_DENIED/AUTHZ_DENIED_NO_USER: Return |
| 769 | * AUTHZ_DENIED_NO_USER if providing a user may change the |
| 770 | * result, AUTHZ_DENIED otherwise. |
| 771 | */ |
| 772 | if (section->op == AUTHZ_LOGIC_AND) { |
| 773 | if (child_result == AUTHZ_DENIED) { |
| 774 | auth_result = child_result; |
| 775 | break; |
| 776 | } |
| 777 | if ((child_result == AUTHZ_DENIED_NO_USER |
| 778 | && auth_result != AUTHZ_DENIED) |
| 779 | || (auth_result == AUTHZ_NEUTRAL)) { |
no test coverage detected