7
Put your two servernames in the preference as servername1|servername2 and try with this replacement function for authenticate in /class/auth/auth_ldap.php
function authenticate($uname, $pwd = null)
{
$authenticated = false;
if (!extension_loaded('ldap'))
{
$this->setErrors(0, _AUTH_LDAP_EXTENSION_NOT_LOAD);
return $authenticated;
}
$ldapservers = explode('|', $this->ldap_server);
foreach ($ldapservers as $ldapserver)
{
$this->_ds = ldap_connect($ldapserver, $this->ldap_port);
if ($this->_ds)
{
ldap_set_option($this->_ds, LDAP_OPT_PROTOCOL_VERSION, $this->ldap_version);
if ($this->ldap_use_TLS)
{ // We use TLS secure connection
if (!ldap_start_tls($this->_ds)) $this->setErrors(0, _AUTH_LDAP_START_TLS_FAILED);
}
// If the uid is not in the DN we proceed to a search
// The uid is not always in the dn
$userDN = $this->getUserDN($uname);
if ($userDN)
{
// We bind as user to test the credentials
$authenticated = ldap_bind($this->_ds, $userDN, stripslashes($pwd));
if ($authenticated)
{
// We load the XOOPS User database
return $this->loadXoopsUser($userDN, $uname, $pwd);
} else $this->setErrors(ldap_errno($this->_ds), ldap_err2str(ldap_errno($this->_ds)) . '(' . $userDN . ')');
}
}
else
{
$this->setErrors(0, _AUTH_LDAP_SERVER_NOT_FOUND);
}
@ldap_close($this->_ds);
}
return $authenticated;
}