[dev] passwd not working after upgrading to 3.1

Jan Schneider jan at horde.org
Tue Mar 31 10:48:58 UTC 2009


Zitat von Manilal K M <manilal at ejyothi.com>:

>
> Quoting Jan Schneider <jan at horde.org>:
>
>> Zitat von Manilal K M <manilal at ejyothi.com>:
>>
>>>
>>> Quoting Jan Schneider <jan at horde.org>:
>>>
>>>> Zitat von Manilal K M <manilal at ejyothi.com>:
>>>>
>>>>>
>>>>> Quoting Jan Schneider <jan at horde.org>:
>>>>>
>>>>>> Zitat von Manilal K M <manilal at ejyothi.com>:
>>>>>>
>>>>>>> passwd/config/backends.php (This is the same file which was  
>>>>>>> used with 3.0.1):
>>>>>>> $backends['ldap'] = array(
>>>>>>
>>>>>> *Never* update to a newer version without updating the  
>>>>>> configuration files.
>>>>>>
>>>>>
>>>>> I have also tried a fresh installation of passwd-3.1 and  
>>>>> modified config/backend.php and config/hooks.php manually. But  
>>>>> still I get the same error.
>>>>>
>>>>> "Failure in changing password for LDAP Server: Could not bind to  
>>>>> LDAP server"
>>>>>
>>>>> However, when I tried changing the password with a wrong  
>>>>> password, then it says the current password is wrong(expected  
>>>>> behaviour). This means that with the configuration provided  
>>>>> passwd is capable of retrieving the  current password and the  
>>>>> problem arises only when it's trying to update new password.
>>>>
>>>> Check the ldap logs.
>>>>
>>>
>>> I have checked the ldap logs and the there were no bind requests  
>>> from Horde.
>>>
>>> On closer analysis of passwd/lib/Driver/ldap.php, it is found that  
>>> the function changePassword missed _connect(). I have created a  
>>> patch for this bug. Since I'm not sure about the attachments in  
>>> this mailing list, I'm pasting it here:
>>>
>>> diff -ur passwd-h3-3.1-orig/lib/Driver/ldap.php  
>>> passwd-h3-3.1/lib/Driver/ldap.php
>>> --- passwd-h3-3.1-orig/lib/Driver/ldap.php      2009-03-31  
>>> 14:56:38.000000000 +0530
>>> +++ passwd-h3-3.1/lib/Driver/ldap.php   2009-03-31 14:58:13.000000000 +0530
>>> @@ -147,6 +147,12 @@
>>>                return $userdn;
>>>            }
>>>        }
>>> +
>>> +       // Connect to the LDAP server
>>> +       $result = $this->_connect();
>>> +        if (is_a($result, 'PEAR_Error')) {
>>> +            return $result;
>>> +        }
>>>
>>>        // Connect as the admin DN if configured; otherwise as the user
>>>        if (!empty($this->_params['admindn'])) {
>>>
>>>
>>> I could also create a bug in bugs.horde.org and upload the  
>>> patch(if needed).  Otherwise please review the patch and commit.
>>
>> Do you use the userdn hook?
>>
>> Jan.
>
> Your  question made me rethink about the patch. I think the problem  
> occurs only if we use userdn hook. In that case the call to  
> _connect() should be moved into the if condition. Please check this:
>
> diff -ur passwd-h3-3.1-orig/lib/Driver/ldap.php  
> passwd-h3-3.1/lib/Driver/ldap.php
> --- passwd-h3-3.1-orig/lib/Driver/ldap.php      2009-03-31  
> 14:56:38.000000000 +0530
> +++ passwd-h3-3.1/lib/Driver/ldap.php   2009-03-31 15:25:07.000000000 +0530
> @@ -141,6 +141,11 @@
>              $userdn = Horde::callHook('_passwd_hook_userdn',
>                                        array(Auth::getAuth()),
>                                        'passwd');
> +           // Connect to the LDAP server
> +           $result = $this->_connect();
> +            if (is_a($result, 'PEAR_Error')) {
> +                return $result;
> +            }
>          } else {
>              $userdn = $this->_lookupdn($username);
>              if (is_a($userdn, 'PEAR_Error')) {

That's correct. I even went a step further and moved the _connect()  
call completely out of _lookupdn() right before that if-call.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the dev mailing list