[horde] LDAP configuration and hooks

David Wells dwells at alfavinil.com
Mon Dec 9 12:56:57 UTC 2019


El 07/12/2019 a las 02:35 p. m., Jan Schneider escribió:

>> Thank you very much for your reply!
>>
>> Your code didn't work "as is" for me but it was a good starting point. 
>> I mixed a bit of your code with the hooks.php.dist sample and got it 
>> working. Here is the code that did the trick for future reference.
>>> $username = 'dwells at fliawells.com.ar';
>>> $factory = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Ldap');
>>> $ldap = $factory->create('horde', $factory->getConfig('auth'));
>>> $result = $ldap->search($GLOBALS['conf']['ldap']['user']['basedn'], 
>>> Horde_Ldap_Filter::create('userPrincipalName', 'equals', $username), 
>>> array('attributes' => array('mail', 'cn')));
>>>    if ($result->count())
>>>     {
>>>        $entry = $result->shiftEntry();
>>>        $mail = $entry->getValue('mail', 'single');
>>>        $fullname = $entry->getValue('cn', 'single');
>>>     }
>>> print $mail;
>>> print $fullname;
>>
>> The piece of code that just wasn't working is the findUserDN method 
>> which reported the following exception
>>> exception 'Horde_Exception_NotFound' with message 'Could not fetch 
>>> entry userPrincipalName=dwells at fliawells.com.ar: no entry found' in 
>>> /usr/lib64/php/Horde/Ldap.php:1080
>>
>> If someone could help me figure out what could be wrong with this I 
>> would appreciate it but at least I can go on with this task.
> 
> Well, the message is pretty clear.
> 

Good morning.

As you very wisely stated the message is pretty clear. What isn't at all 
clear is the cause of this message. The entry actually is in the 
directory and using tools like ldapsearch I can find this sam entry with 
no problems at all. Actually if you take a look at the code that is 
working and I submitted previously on this thread, you'll see that the 
query that is working is looking for exactly the same entry that the 
findUserDN method seems to be looking for. If this was an openldap 
server I would turn debuging on to be able to inspect the queries sent 
to the server but as this is not the case and since I haven't been able 
to turn on the same debuging on on samba is why I'm asking if someone 
could help me understand what the above mentioned method might be 
looking for.

Thanks.
Best regards,
David Wells.


More information about the horde mailing list