Fixed Connection failure in ldap
This commit is contained in:
parent
5860d29e37
commit
160ad7e866
|
@ -645,15 +645,26 @@ function ldap_process_user_login ($login, $password) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ldap_login_attr = isset($config["ldap_login_attr"]) ? io_safe_output($config["ldap_login_attr"]) . "=" : '';
|
$ldap_login_attr = !empty($config["ldap_login_attr"]) ? io_safe_output($config["ldap_login_attr"]) . "=" : '';
|
||||||
$ldap_base_dn = isset($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
|
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
|
||||||
|
|
||||||
if (strlen($password) == 0 ||
|
if(!empty($ldap_base_dn)){
|
||||||
|
if (strlen($password) == 0 ||
|
||||||
|
!@ldap_bind($ds, $ldap_login_attr.io_safe_output($login).$ldap_base_dn, $password) ) {
|
||||||
|
html_debug("entra1",true);
|
||||||
|
$config["auth_error"] = 'User not found in database or incorrect password';
|
||||||
|
@ldap_close ($ds);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (strlen($password) == 0 ||
|
||||||
!@ldap_bind($ds, io_safe_output($login), $password) ) {
|
!@ldap_bind($ds, io_safe_output($login), $password) ) {
|
||||||
$config["auth_error"] = 'User not found in database or incorrect password';
|
$config["auth_error"] = 'User not found in database or incorrect password';
|
||||||
@ldap_close ($ds);
|
@ldap_close ($ds);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ldap_close ($ds);
|
@ldap_close ($ds);
|
||||||
|
|
Loading…
Reference in New Issue