[imp] ldap.php3 and w2k

Brent J. Nordquist bjn@horde.org
Tue, 27 Feb 2001 23:07:50 -0600 (CST)


On Tue, 27 Feb 2001, pepito <pepito@pitchnputt.dhs.org> wrote:

> Hello, I was finally able to query a w2k active directory using ldapsearch,
> but I still can't figure out how to put this on the ldap.php3, specially the
> autentication part.
> Here is a sample ldapsearch query that works:
> ldapsearch -h win2kserver -D "cn=Administrator,cn=Users,dc=domain,dc=com" -b
> "dc=domain,dc=com" "mail=*" -W

I have no experience with W2K... ActiveDirectory doesn't really require
that you bind as administrator, does it?  Seems... extreme.  :-)

> I have no idea on where to put the authentication part (-D) on the
> ldap.php3 configuration file.

Well, peeking at the code (imp/ldap.search.php3 on line 240) it appears
that there's no support currently for supplying a bind dn and password.
If the W2K server is the only LDAP server you care about, you could hard
code it like this:

...
	$ds = ldap_connect($str_serv);

>>	$binddn = "cn=Administrator,cn=Users,dc=domain,dc=com";
>>	$bindpw = "password";
>>	if ($ds) $r = ldap_bind($ds, $binddn, $bindpw);
	else {
	   echo $lang->no_ldap_connection;
	   exit;
	}
...

-- 
Brent J. Nordquist <bjn@horde.org>
Yahoo!: Brent_Nordquist / AIM: BrentJNordquist / ICQ: 76158942