Skip to content
Permalink
Browse files

Fixed case-sensitive LDAP attributes names

A ldap_get_entries() function returns attribute names as lowercase keys so next call
of array_key_exists() fails because of it performs a case-sensitive comparison.
For example if a $g_ldap_realname_field option is set to 'givenName'
(a well-known LDAP attribute display name) then it finds nothing.

Fixes #24043
  • Loading branch information...
raspopov authored and vboctor committed Feb 28, 2018
1 parent bf030ce commit 34978af2072f475050f64a2ad7c5ade8b490e1f2
Showing with 3 additions and 2 deletions.
  1. +3 −2 core/ldap_api.php
@@ -267,8 +267,9 @@ function ldap_get_field_from_username( $p_username, $p_field ) {
}
# Make sure the requested field exists
if( is_array( $t_info[0] ) && array_key_exists( $p_field, $t_info[0] ) ) {
$t_value = $t_info[0][$p_field][0];
$t_field_lowercase = strtolower( $p_field );
if( is_array( $t_info[0] ) && array_key_exists( $t_field_lowercase, $t_info[0] ) ) {
$t_value = $t_info[0][$t_field_lowercase][0];
log_event( LOG_LDAP, 'Found value \'' . $t_value . '\' for field \'' . $p_field . '\'.' );
} else {
log_event( LOG_LDAP, 'WARNING: field \'' . $p_field . '\' does not exist' );

0 comments on commit 34978af

Please sign in to comment.
You can’t perform that action at this time.