diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php index 1ba541dd7dc45839ee9338daacacd7e8edb8469a..66f74e7fd16e616e4eef2252728167e3b7f4b597 100644 --- a/lib/Net/LDAP3.php +++ b/lib/Net/LDAP3.php @@ -7,7 +7,7 @@ | Based on code created by the Roundcube Webmail team. | | | | Copyright (C) 2006-2014, The Roundcube Dev Team | - | Copyright (C) 2012-2014, Kolab Systems AG | + | Copyright (C) 2012-2019, Kolab Systems AG | | | | This program is free software: you can redistribute it and/or modify | | it under the terms of the GNU General Public License as published by | @@ -985,6 +985,14 @@ class Net_LDAP3 return $entry[strtolower($attribute)]; } + /** + * Get a specific LDAP entry attributes + * + * @param string $dn Record identifier + * @param array $attributes Attributes to return + * + * @return array Hash array (keys in lower case) + */ public function get_entry_attributes($subject_dn, $attributes) { $result = $this->get_entry($subject_dn, $attributes); @@ -997,7 +1005,8 @@ class Net_LDAP3 unset($result['dn']); } - return $result; + // change keys case for historical reasons + return array_change_key_case($result, CASE_LOWER); } /** @@ -1007,7 +1016,7 @@ class Net_LDAP3 * @param array $attributes Attributes to return * @param array $controls LDAP Controls * - * @return array Hash array + * @return array Hash array (keys in original case) */ public function get_entry($dn, $attributes = array("*"), $controls = array()) { @@ -1242,7 +1251,7 @@ class Net_LDAP3 } } else { - $entry = $this->get_entry($dn, array('member', 'uniquemember', 'memberurl', 'objectclass')); + $entry = $this->get_entry_attributes($dn, array('member', 'uniquemember', 'memberurl', 'objectclass')); if (!$entry) { return array(); @@ -2245,7 +2254,7 @@ class Net_LDAP3 // Use the member attributes to return an array of member ldap objects // NOTE that the member attribute is supposed to contain a DN foreach ($members as $member) { - $member_entry = $this->get_entry($member, array('member', 'uniquemember', 'memberurl', 'objectclass')); + $member_entry = $this->get_entry_attributes($member, array('member', 'uniquemember', 'memberurl', 'objectclass')); if (empty($member_entry)) { continue; @@ -2276,7 +2285,7 @@ class Net_LDAP3 unset($uniquemembers['count']); foreach ($uniquemembers as $member) { - $member_entry = $this->get_entry($member, array('member', 'uniquemember', 'memberurl', 'objectclass')); + $member_entry = $this->get_entry_attributes($member, array('member', 'uniquemember', 'memberurl', 'objectclass')); if (empty($member_entry)) { continue;