@@ -688,6 +688,7 @@ static authz_status get_dn_for_nonldap_authn(request_rec *r, util_ldap_connectio
688
688
authn_ldap_config_t * sec =
689
689
(authn_ldap_config_t * )ap_get_module_config (r -> per_dir_config , & authnz_ldap_module );
690
690
const char * dn = NULL ;
691
+ int remote_user_attribute_set = 0 ;
691
692
692
693
/* Build the username filter */
693
694
if (APR_SUCCESS != authn_ldap_build_filter (filtbuf , r , r -> user , NULL , sec )) {
@@ -710,6 +711,21 @@ static authz_status get_dn_for_nonldap_authn(request_rec *r, util_ldap_connectio
710
711
711
712
req -> dn = apr_pstrdup (r -> pool , dn );
712
713
req -> user = r -> user ;
714
+
715
+ /* add environment variables */
716
+ remote_user_attribute_set = set_request_vars (r , LDAP_AUTHN , req -> vals );
717
+
718
+ /* sanity check */
719
+ if (sec -> remote_user_attribute && !remote_user_attribute_set ) {
720
+ ap_log_rerror (APLOG_MARK , APLOG_WARNING , 0 , r , APLOGNO (10450 )
721
+ "auth_ldap non-ldap authenticate: "
722
+ "REMOTE_USER was to be set with attribute '%s', "
723
+ "but this attribute was not requested for in the "
724
+ "LDAP query for the user. REMOTE_USER will fall "
725
+ "back to username or DN as appropriate." ,
726
+ sec -> remote_user_attribute );
727
+ }
728
+
713
729
return AUTHZ_GRANTED ;
714
730
}
715
731
0 commit comments