Skip to content
This repository was archived by the owner on Jan 27, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions authenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,11 @@

if (!empty($ldap_binduser_dn)) {
// Verify the given password
$ldap_sr_all_user_attributes = @ldap_search($ldap_connect, '', $ldap_filter_string);
$ldap_sr_all_user_attributes = @ldap_search($ldap_connect, $ldap_basedn, $ldap_filter_string);
$usersattributes = @ldap_get_entries($ldap_connect, $ldap_sr_all_user_attributes);
// try to connect to ldap using the given attribute and the password
if (!$ldap_bind_check_pass = ldap_bind($ldap_connect, $usersattributes[0][$ldap_userlogin_attr][0], $password)) {
sendError("Failed to authenticate: " . $usersattributes[0][$ldap_userlogin_attr][0]);
if (!$ldap_bind_check_pass = ldap_bind($ldap_connect, is_array($usersattributes[0][$ldap_userlogin_attr]) ? $usersattributes[0][$ldap_userlogin_attr][0] : $usersattributes[0][$ldap_userlogin_attr], $password)) {
sendError("Failed to authenticate: " . $usersattributes[0][$ldap_username_attr][0]);
} else {
// password is valid!
}
Expand Down
2 changes: 1 addition & 1 deletion ilibrarian-default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ ldap_username_attr = "uid"
; Additional Active Directory Settings
;ldap_username_attr = "sAMAccountName"

ldap_userlogin_attr = "uid"
ldap_userlogin_attr = "dn"
; Additional Active Directory Settings
; attribute which is used to verify login/password pair
; ldap_userlogin_attr = "userprincipalname"
Expand Down