From 9992f6627cc24793f033c48564bd9b2583c80617 Mon Sep 17 00:00:00 2001 From: "Jeroen van Meeuwen (Kolab Systems)" <vanmeeuwen@kolabsys.com> Date: Thu, 29 Aug 2019 13:36:30 +0200 Subject: [PATCH] Ensure that normalize_entry also properly lowercases attribute names --- lib/Net/LDAP3.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php index 39773b1..0fe78e8 100644 --- a/lib/Net/LDAP3.php +++ b/lib/Net/LDAP3.php @@ -1883,14 +1883,17 @@ class Net_LDAP3 public static function normalize_entry($entry, $flat = false) { $rec = array(); + for ($i=0; $i < $entry['count']; $i++) { $attr = $entry[$i]; + $_attr = strtolower($attr); + for ($j=0; $j < $entry[$attr]['count']; $j++) { - $rec[$attr][$j] = $entry[$attr][$j]; + $rec[$_attr][$j] = $entry[$attr][$j]; } - if ($flat && count($rec[$attr]) == 1) { - $rec[$attr] = $rec[$attr][0]; + if ($flat && count($rec[$_attr]) == 1) { + $rec[$_attr] = $rec[$_attr][0]; } } @@ -3122,6 +3125,7 @@ class Net_LDAP3 if ($domain_dn) { $result = $this->get_entry_attributes($domain_dn, $attributes); + if (!empty($result)) { $result['dn'] = $domain_dn; } -- GitLab