summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-08-30 14:06:31 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-08-30 14:06:31 (GMT)
commitea087723e5581b942667e916903f24e63bc25cbb (patch)
tree1f2437a5d132745cda7b53b793eb88d93822beb3
parent4d854fadc7273a8477d369d41cc43d5798888a5b (diff)
downloadNet_LDAP3-ea087723e5581b942667e916903f24e63bc25cbb.tar.gz
The login() function should recognize the $username argument is actually a distinguished name (dn) and bind with that.
-rw-r--r--lib/Net/LDAP3.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php
index 4acdf1c..2ea7833 100644
--- a/lib/Net/LDAP3.php
+++ b/lib/Net/LDAP3.php
@@ -777,6 +777,19 @@ class Net_LDAP3
return NULL;
}
+ $entry_dn = $this->entry_dn($username);
+
+ if (!empty($entry_dn)) {
+ $bound = $this->bind($entry_dn, $password);
+
+ if (!$bound) {
+ new PEAR_Error("Could not bind with " . $entry_dn);
+ return NULL;
+ }
+
+ return $entry_dn;
+ }
+
$base_dn = $this->config_get('root_dn');
if (empty($base_dn)) {
@@ -804,7 +817,7 @@ class Net_LDAP3
$filter = "(&(|(mail=%s)(alias=%s)(uid=%s))(objectclass=inetorgperson))";
}
- $this->_debug($filter);
+ $this->_debug("Net::LDAP3::login() original filter: " . $filter);
$replace_patterns = Array(
'/%s/' => $username,
@@ -815,7 +828,7 @@ class Net_LDAP3
$filter = preg_replace(array_keys($replace_patterns), array_values($replace_patterns), $filter);
- $this->_debug($filter);
+ $this->_debug("Net::LDAP3::login() actual filter: " . $filter);
$result = $this->search($base_dn, $filter, 'sub');