lib/Auth

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Fri Apr 6 13:13:15 CEST 2012


 lib/Auth/LDAP.php |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit ad31f36e4161cc77515ae58b1170e8e5e3100f98
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri Apr 6 13:12:45 2012 +0200

    If a DN is specified as the user login, use it as such

diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index 978e8d4..cb8aaf8 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -138,6 +138,9 @@ class LDAP
         // such as would be the case for 'cn=Directory Manager' or
         // 'uid=admin'.
         $subject = $this->entry_dn($username);
+
+        console($subject);
+
         if (!$subject) {
             list($this->userid, $this->domain) = $this->_qualify_id($username);
             $root_dn = $this->domain_root_dn($this->domain);
@@ -176,7 +179,7 @@ class LDAP
 
             $subject_dn = $this->_get_user_dn($root_dn, $filter);
         } else {
-            $subject_dn = key($subject);
+            $subject_dn = $subject;
         }
 
         if (($bind_ok = $this->_bind($subject_dn, $password)) == true) {
@@ -987,9 +990,11 @@ class LDAP
 
     private function entry_dn($subject)
     {
+        console("entry_dn on subject $subject");
         $is_dn = ldap_explode_dn($subject, 1);
+        console($is_dn);
 
-        if (is_array($is_dn) && array_key_exists("count", $is_dn) && $is_dn["count"] > 1) {
+        if (is_array($is_dn) && array_key_exists("count", $is_dn) && $is_dn["count"] > 0) {
             return $subject;
         }
 





More information about the commits mailing list