Following the example at http://www.linuxmail.info/squirrelmail-active-directory-ldap-addressbook... it worked in that I received no errors and some records would get listed but the search would give me an error and it would only list a few items when I did a list all.
After some digging I found out that http://us2.php.net/manual/en/function.ldap-search.php#45388 AD under 2003 requires and extra option set in order to work. So I edited the file.
squirrelmail/functions/abook_ldap_server.php
and added the following code.
if(!empty($this->protocol)) {
if(!@ldap_set_option($this->linkid, LDAP_OPT_PROTOCOL_VERSION, $this->protocol)) {
if(function_exists('ldap_error')) {
return $this->set_error(ldap_error($this->linkid));
} else {
return $this->set_error('ldap_set_option failed');
}
}
}
// New Code. Import this is needed for AD under 2k3.
if(!@ldap_set_option($this->linkid, LDAP_OPT_REFERRALS, 0)) {
if(function_exists('ldap_error')) {
return $this->set_error(ldap_error($this->linkid));
} else {
return $this->set_error('ldap_set_option failed');
}
}
// End of new code.
if(!empty($this->binddn)) {
if(!@ldap_bind($this->linkid, $this->binddn, $this->bindpw)) {
if(function_exists('ldap_error')) {
return $this->set_error(ldap_error($this->linkid));
} else {
return $this->set_error('authenticated ldap_bind failed');
}
}
} else {
if(!@ldap_bind($this->linkid)) {
if(function_exists('ldap_error')) {
return $this->set_error(ldap_error($this->linkid));
} else {
return $this->set_error('anonymous ldap_bind failed');
}
}
}See the attachment for the full file.
Thanks
Robert