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

Function ldapuser_check_authorization

modules/aaa/mod_authnz_ldap.c:641–793  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

639}
640
641static authz_status ldapuser_check_authorization(request_rec *r,
642 const char *require_args,
643 const void *parsed_require_args)
644{
645 int result = 0;
646 authn_ldap_request_t *req =
647 (authn_ldap_request_t *)ap_get_module_config(r->request_config, &authnz_ldap_module);
648 authn_ldap_config_t *sec =
649 (authn_ldap_config_t *)ap_get_module_config(r->per_dir_config, &authnz_ldap_module);
650
651 util_ldap_connection_t *ldc = NULL;
652
653 const char *err = NULL;
654 const ap_expr_info_t *expr = parsed_require_args;
655 const char *require;
656
657 const char *t;
658 char *w;
659
660 char filtbuf[FILTER_LENGTH];
661 const char *dn = NULL;
662
663 if (!r->user) {
664 return AUTHZ_DENIED_NO_USER;
665 }
666
667 if (!sec->have_ldap_url) {
668 return AUTHZ_DENIED;
669 }
670
671 if (sec->host) {
672 ldc = get_connection_for_authz(r, LDAP_COMPARE);
673 apr_pool_cleanup_register(r->pool, ldc,
674 authnz_ldap_cleanup_connection_close,
675 apr_pool_cleanup_null);
676 }
677 else {
678 ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(01698)
679 "auth_ldap authorize: no sec->host - weird...?");
680 return AUTHZ_DENIED;
681 }
682
683 /*
684 * If we have been authenticated by some other module than mod_authnz_ldap,
685 * the req structure needed for authorization needs to be created
686 * and populated with the userid and DN of the account in LDAP
687 */
688
689
690 if (!strlen(r->user)) {
691 ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(01699)
692 "ldap authorize: Userid is blank, AuthType=%s",
693 r->ap_auth_type);
694 }
695
696 if(!req) {
697 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01700)
698 "ldap authorize: Creating LDAP req structure");

Callers

nothing calls this directly

Calls 7

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
set_request_varsFunction · 0.85
ap_getword_confFunction · 0.85

Tested by

no test coverage detected