| 1151 | } |
| 1152 | |
| 1153 | static authz_status ldapattribute_check_authorization(request_rec *r, |
| 1154 | const char *require_args, |
| 1155 | const void *parsed_require_args) |
| 1156 | { |
| 1157 | int result = 0; |
| 1158 | authn_ldap_request_t *req = |
| 1159 | (authn_ldap_request_t *)ap_get_module_config(r->request_config, &authnz_ldap_module); |
| 1160 | authn_ldap_config_t *sec = |
| 1161 | (authn_ldap_config_t *)ap_get_module_config(r->per_dir_config, &authnz_ldap_module); |
| 1162 | |
| 1163 | util_ldap_connection_t *ldc = NULL; |
| 1164 | |
| 1165 | const char *err = NULL; |
| 1166 | const ap_expr_info_t *expr = parsed_require_args; |
| 1167 | const char *require; |
| 1168 | |
| 1169 | const char *t; |
| 1170 | char *w, *value; |
| 1171 | |
| 1172 | char filtbuf[FILTER_LENGTH]; |
| 1173 | const char *dn = NULL; |
| 1174 | |
| 1175 | if (!r->user) { |
| 1176 | return AUTHZ_DENIED_NO_USER; |
| 1177 | } |
| 1178 | |
| 1179 | if (!sec->have_ldap_url) { |
| 1180 | return AUTHZ_DENIED; |
| 1181 | } |
| 1182 | |
| 1183 | if (sec->host) { |
| 1184 | ldc = get_connection_for_authz(r, LDAP_COMPARE); |
| 1185 | apr_pool_cleanup_register(r->pool, ldc, |
| 1186 | authnz_ldap_cleanup_connection_close, |
| 1187 | apr_pool_cleanup_null); |
| 1188 | } |
| 1189 | else { |
| 1190 | ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(01729) |
| 1191 | "auth_ldap authorize: no sec->host - weird...?"); |
| 1192 | return AUTHZ_DENIED; |
| 1193 | } |
| 1194 | |
| 1195 | /* |
| 1196 | * If we have been authenticated by some other module than mod_auth_ldap, |
| 1197 | * the req structure needed for authorization needs to be created |
| 1198 | * and populated with the userid and DN of the account in LDAP |
| 1199 | */ |
| 1200 | |
| 1201 | if (!strlen(r->user)) { |
| 1202 | ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(01730) |
| 1203 | "ldap authorize: Userid is blank, AuthType=%s", |
| 1204 | r->ap_auth_type); |
| 1205 | } |
| 1206 | |
| 1207 | if(!req) { |
| 1208 | ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01731) |
| 1209 | "ldap authorize: Creating LDAP req structure"); |
| 1210 |
nothing calls this directly
no test coverage detected