[snip]
> if(!$ds=ldap_connect("foo")){
>         echo "did not connect";
> }else {
>         echo "connection successful";
> }
> $un = "user";
> $upw = "pass";
> echo "connect result is " . $ds . "<br />";
> ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
> ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
>
> if ($ds) {
>    echo "Binding ...";
>    if(!$r=ldap_bind($ds, $un, $upd)){
>         echo "unable to verify</br>";
>    }else{
>         echo "verified<br>";
>    }
>
> The result is always "verified".

>From the comments on www.php.net/ldap_bind:

I have found that if either  of the valuse for user or password are
blank, or as in my case a typo resulted in a blank user as it was an
undefined variable, the ldap_bind() will just perform an anonymous
bind and return true!


You have:
$upw = "pass";

but using $upd in ldap_bind ...

if(!$r=ldap_bind($ds, $un, $upd)){

unless it's a typo in your example that could explain it. ?
[/snip]

It was a typo.

Anyhow, I guess if the connection to the server is anonymous in the
event of a bad username / pw combo I will still need to search the AD
for a match for authentication. I am still having a problem getting a
search to work.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to