problems with horde/lib/Prefs/LDAP.php

Atif Ghaffar aghaffar@developer.ch
Mon, 29 Jan 2001 21:34:34 +0100


Hi,

This file is behaving strangely.
Or perhaps I am doing something wrong.

I have in conf.php
$conf['prefs']['driver'] = 'LDAP';
$conf['prefs']['params'] = array();
$conf['prefs']['params']['hostspec'] = 'localhost';
$conf['prefs']['params']['basedn'] = 'o=ispman';
$conf['prefs']['params']['uid'] = 'uid';
$conf['prefs']['params']['username'] = 'admin';
$conf['prefs']['params']['password'] = 'pass';

which seems to be ok.
I see that LDAP.php makes a search for
$conf['prefs']['params']['uid'] = "username" to get the result about the
user.
Then in the function connect it stores
in this->dn 
$uid . '=' . $result[0][$uid][0] . ',' . $this->params['basedn'];
which is wrong.

I defined basedn to be "o=ispman" which is the top of the tree.
and if you search for uid=aghaffar you will get
dn: uid=aghaffar, ou=users, domain=developer.ch, o=ispman
but LDAP.php is only storing "uid=aghaffar, o=ispman"
which makes an error when a store operation in done on that leaf because
if does not exists.

I experimented and changed the line to 
$this->dn=$result[0]["dn"];
which solves the problem.

I havent looked into it a lot to see if there was a special reason to do
a "uid=something" . "$basedn".
If there is please correct me.

PS: Also, why is $conf['prefs']['params']['username'] and
$conf['prefs']['params']['password']
 needed?. 
Wouldnt it be better to auth as the current user (ofcoarse that would be
only possible if the user has the same password on the LDAP server as on
the IMAP server s/he is connecting to, maybe it should be definable in
conf.php).


thanks.

 
-- 
Atif Ghaffar
Internet Development Manager
4unet AG/SA/Ltd.

Unix! Me too. 

-------------------------.
        +41 21 351 53 60 ¦ voice
        +41 78 787 51 45 ¦ mobile
        +41 86 0796598972¦ fax
    http://www.4unet.net ¦ www
http://atif.developer.ch ¦ homepage
  atif.ghaffar@4unet.net ¦ email