| 639 | } |
| 640 | |
| 641 | static 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"); |
nothing calls this directly
no test coverage detected