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

Function ldapattribute_check_authorization

modules/aaa/mod_authnz_ldap.c:1153–1285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1151}
1152
1153static 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

Callers

nothing calls this directly

Calls 8

ap_get_module_configFunction · 0.85
get_connection_for_authzFunction · 0.85
authn_ldap_build_filterFunction · 0.85
ap_set_module_configFunction · 0.85
ap_expr_str_execFunction · 0.85
ap_getwordFunction · 0.85
ap_getword_confFunction · 0.85
set_request_varsFunction · 0.85

Tested by

no test coverage detected