[dev] [PATCH] Patch to fix LDAP bind issue in passwd

Amith Varghese amith at xalan.com
Thu Apr 13 10:33:30 PDT 2006


Here's a patch to fix the situation where the passwd_hook_userdn is  
needed to generate the proper DN for binding to the LDAP tree when  
changing passwords

Please let me know if there are any questions.

Thanks
Amith


Index: passwd/lib/Driver/ldap.php
===================================================================
RCS file: /repository/passwd/lib/Driver/ldap.php,v
retrieving revision 1.46
diff -u -r1.46 ldap.php
--- passwd/lib/Driver/ldap.php  6 Apr 2006 00:55:18 -0000       1.46
+++ passwd/lib/Driver/ldap.php  13 Apr 2006 17:32:13 -0000
@@ -113,10 +113,16 @@
       */
      function changePassword($username, $old_password, $new_password)
      {
-        // Construct username at realm to connect as if 'realm'  
parameter is set.
-        $urealm = $username;
-        if (!empty($this->_params['realm'])) {
-            $urealm .= '@' . $this->_params['realm'];
+        if ($GLOBALS['conf']['hooks']['userdn']) {
+            $urealm = Horde::callHook('_passwd_hook_userdn',
+                                      array(Auth::getAuth()));
+        } else {
+            // Construct username at realm to connect as if 'realm' parameter is
+            // set.
+            $urealm = $username;
+            if (!empty($this->_params['realm'])) {
+                $urealm .= '@' . $this->_params['realm'];
+            }
          }

          // Bind as current user. _connect will try as guest if no user realm




More information about the dev mailing list