Hi,

A few days ago I posted the same problem to the php-general list and I
had no luck with an answer. Maybe someone on this list has some
knowledge with ldap authentication?

I try to authenticate users with LDAP at an Active Directory Server
(AD). Everything works fine. Just in some cases, authentication is not
possible.

Some testing with tcpdumps and the like enabled us to locate the problem
in the php function ldap_search. If this function is called like it is
shown in the code below, it starts a DNS query to the ldap "context"
(example.ch in this case, the second argument to "ldap_search").

And this DNS query seems to break the already working communication with
an other AD Server (there are several fallback servers) because it
returns a different address than the one which is in use for the already
established communication.

I'm using php-5.2.5 with apache on a RedHat Linux virtual-machine

After looking at the php code, I have the feeling that the source of
this problem may well come directly from OpenLDAP. But does somebody
know about this "problem"?

Thank you for your help!

Regards,
Jan



<?php
//   $server == LDAP Server
//   $bind_cn == Distinguished Name of (AD) LDAP Bind User
//   $bind_pw == Password of (AD) LDAP Bind User
//   "DC=example,DC=ch" == User lookup Context

$con = ldap_connect($server);

$bnd = ldap_bind($con, $bind_cn, $bind_pw);

$res = ldap_search($con, "DC=example,DC=ch", "sAMAccountName=username");

ldap_close($con);
?>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to