MCPcopy Index your code
hub / github.com/apache/httpd / dbdgroup_check_authorization

Function dbdgroup_check_authorization

modules/aaa/mod_authz_dbd.c:273–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

271}
272
273static authz_status dbdgroup_check_authorization(request_rec *r,
274 const char *require_args,
275 const void *parsed_require_args)
276{
277 int rv;
278 const char *w;
279 apr_array_header_t *groups;
280
281 const char *err = NULL;
282 const ap_expr_info_t *expr = parsed_require_args;
283 const char *require;
284
285 const char *t;
286 authz_dbd_cfg *cfg = ap_get_module_config(r->per_dir_config,
287 &authz_dbd_module);
288
289 if (!r->user) {
290 return AUTHZ_DENIED_NO_USER;
291 }
292
293 groups = apr_array_make(r->pool, 4, sizeof(const char*));
294 rv = authz_dbd_group_query(r, cfg, groups);
295 if (rv != OK) {
296 return AUTHZ_GENERAL_ERROR;
297 }
298
299 require = ap_expr_str_exec(r, expr, &err);
300 if (err) {
301 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02590)
302 "authz_dbd authorize: require dbd-group: Can't "
303 "evaluate require expression: %s", err);
304 return AUTHZ_DENIED;
305 }
306
307 t = require;
308 while (t[0]) {
309 w = ap_getword_white(r->pool, &t);
310 if (ap_array_str_contains(groups, w)) {
311 return AUTHZ_GRANTED;
312 }
313 }
314
315 return AUTHZ_DENIED;
316}
317
318static authz_status dbdlogin_check_authorization(request_rec *r,
319 const char *require_args,

Callers

nothing calls this directly

Calls 5

ap_get_module_configFunction · 0.85
authz_dbd_group_queryFunction · 0.85
ap_expr_str_execFunction · 0.85
ap_getword_whiteFunction · 0.85
ap_array_str_containsFunction · 0.85

Tested by

no test coverage detected