Framework: Fix LDAP finding user's DN (fixes authentication)
authorBen Klang <ben@alkaloid.net>
Wed, 2 Jun 2010 22:13:30 +0000 (18:13 -0400)
committerBen Klang <ben@alkaloid.net>
Wed, 2 Jun 2010 22:17:39 +0000 (18:17 -0400)
framework/Auth/lib/Horde/Auth/Ldap.php

index 6e11b96..0f20dcc 100644 (file)
@@ -96,7 +96,9 @@ class Horde_Auth_Ldap extends Horde_Auth_Base
             throw new Horde_Auth_Exception('Empty result.');
         }
 
-        return $search[0]['dn'];
+        $entry = $search->shiftEntry();
+
+        return $entry->currentDN();
     }
 
     /**
@@ -213,6 +215,7 @@ class Horde_Auth_Ldap extends Horde_Auth_Base
     protected function _authenticate($userId, $credentials)
     {
         /* Search for the user's full DN. */
+        $this->_ldap->bind();
         $dn = $this->_findDN($userId);
 
         /* Attempt to bind to the LDAP server as the user. */