| 793 | } |
| 794 | |
| 795 | static authz_status ldapgroup_check_authorization(request_rec *r, |
| 796 | const char *require_args, |
| 797 | const void *parsed_require_args) |
| 798 | { |
| 799 | int result = 0; |
| 800 | authn_ldap_request_t *req = |
| 801 | (authn_ldap_request_t *)ap_get_module_config(r->request_config, &authnz_ldap_module); |
| 802 | authn_ldap_config_t *sec = |
| 803 | (authn_ldap_config_t *)ap_get_module_config(r->per_dir_config, &authnz_ldap_module); |
| 804 | |
| 805 | util_ldap_connection_t *ldc = NULL; |
| 806 | |
| 807 | const char *err = NULL; |
| 808 | const ap_expr_info_t *expr = parsed_require_args; |
| 809 | const char *require; |
| 810 | |
| 811 | const char *t; |
| 812 | |
| 813 | char filtbuf[FILTER_LENGTH]; |
| 814 | const char *dn = NULL; |
| 815 | struct mod_auth_ldap_groupattr_entry_t *ent; |
| 816 | int i; |
| 817 | |
| 818 | if (!r->user) { |
| 819 | return AUTHZ_DENIED_NO_USER; |
| 820 | } |
| 821 | |
| 822 | if (!sec->have_ldap_url) { |
| 823 | return AUTHZ_DENIED; |
| 824 | } |
| 825 | |
| 826 | if (sec->host) { |
| 827 | ldc = get_connection_for_authz(r, LDAP_COMPARE); /* for the top-level group only */ |
| 828 | apr_pool_cleanup_register(r->pool, ldc, |
| 829 | authnz_ldap_cleanup_connection_close, |
| 830 | apr_pool_cleanup_null); |
| 831 | } |
| 832 | else { |
| 833 | ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(01708) |
| 834 | "auth_ldap authorize: no sec->host - weird...?"); |
| 835 | return AUTHZ_DENIED; |
| 836 | } |
| 837 | |
| 838 | /* |
| 839 | * If there are no elements in the group attribute array, the default should be |
| 840 | * member and uniquemember; populate the array now. |
| 841 | */ |
| 842 | if (sec->groupattr->nelts == 0) { |
| 843 | struct mod_auth_ldap_groupattr_entry_t *grp; |
| 844 | #if APR_HAS_THREADS |
| 845 | apr_thread_mutex_lock(sec->lock); |
| 846 | #endif |
| 847 | grp = apr_array_push(sec->groupattr); |
| 848 | grp->name = "member"; |
| 849 | grp = apr_array_push(sec->groupattr); |
| 850 | grp->name = "uniqueMember"; |
| 851 | #if APR_HAS_THREADS |
| 852 | apr_thread_mutex_unlock(sec->lock); |
nothing calls this directly
no test coverage detected