Furthermore, I have tried the suggestions from the xerte discussion list like
Xerte LDAP behaviour
and
LDAP configuration for XOT 2.0
. Although it didn't work for us, I appreciate people posted their solutions.
We finally found a way to make our LDAP work with Xerte 2.0 on our test site. Here is a brief summary.
Problems:
We set up LDAP settings following the xerte guidance. However after logged on, the user's Firstname and Surname were not displayed. I wondered why this happened and tested all sorts of username/password. I found it even allowed nonsense usernames to log in.
Solution:
In regard to our LDAP server, it runs LDAP search filter to find an username (e.g., cn=***), however, if it's a non-existing user, the result is returned as NULL. The xerte then tries to log in with NULL as a username, which the LDAP server assumes is an anonymous bind, which is allowed in our case, so the authentication is technically successful. That is, viewing the ldap.php codes, as the bind_pwd is blank, it will always go to get $userBaseDn, which in our case it's blank. It then will pass NULL to LDAP server for binding. It then tries to get username again and allows it to log in without getting their firstname and surname.
Therefore, we changed the codes in the ldap.php file and it works now.
After Line 172, we added codes to stop an anonymous bind:
if (! $userBaseDn or ! $userBaseDn[0]) {
return false;
}
else {
if ($ldapConnection) {
.....
}
}
We commented out Line 183 and added codes to return users fullname from LDAP search:
$this->_record = array('firstname' => $entry[0][0], 'surname' => $entry[0][0], 'username' => $xot_username);
Tips:
- You need to manually add a record into the LDAP table. It will not add information into this table if you set up LDAP settings through management.php after you upgrade an existing installation.
- If you have more than one record in the LDAP table, be careful to change the LDAP settings through management.php as it will change all your LDAP settings in the LDAP table.
- If you have a problem of LDAP behaviour, check the "_authenticate_to_host" function in the ldap.php file and debug it to see how it responds on the LDAP server. This will save your time.
Thanks. Hope it's useful.