Re: Re: LDAP (NDS) authentication example...
| From: | Unknown Sender | Date: | Sun, 22 Sep 2002 14:59:16 +0000 |
| Subject: | Re: Re: LDAP (NDS) authentication example... | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117166@lists.php.net to get a copy of this message | ||
On Thu, Sep 12, 2002 at 09:37:22AM +1000, joshua wrote:
> i'm not sure if i follow you. i have never used ldap to write
> authentication scripts as i've only used the .htaccess method.
>
> to retrieve data you need to bind using a username/password combination
> that is valid. i guess you could test your user's username/password by
> using it to attempt a bind.
The example below is correct, however in many cases you can avoid the
anonymous search. If say for all users you have entries with dn's like
uid=dj, o=users, dc=mycompany, dc=com
you can just do
$dn = "uid=$inp_uid, o=users, dc=mycompany, dc=com";
$ds = ldap_connect("ldap.someserver.com");
$r = ldap_bind($ds, $dn, $inp_passwd);
and check whether $r is true. Someone reported that there is some
implementation where this is falsely true for empty password, so
prior to this I would chech that the password string is non-empty,
just to be sure.
Stig