Skip to content
Snippets Groups Projects
Commit 93821de4 authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

In the LDAP class, the password should only be escaped if it's not null, so...

In the LDAP class, the password should only be escaped if it's not null, so that we don't try to bind with an empty password if none was provided. This fixes #366 and closes #370.
parent 3d32ff6d
No related branches found
No related tags found
No related merge requests found
...@@ -605,7 +605,6 @@ class SimpleSAML_Auth_LDAP { ...@@ -605,7 +605,6 @@ class SimpleSAML_Auth_LDAP {
* These characters are escaped by prefixing them with '\'. * These characters are escaped by prefixing them with '\'.
*/ */
$username = addcslashes($username, ',+"\\<>;*'); $username = addcslashes($username, ',+"\\<>;*');
$password = addcslashes($password, ',+"\\<>;*');
if (isset($config['priv_user_dn'])) { if (isset($config['priv_user_dn'])) {
$this->bind($config['priv_user_dn'], $config['priv_user_pw']); $this->bind($config['priv_user_dn'], $config['priv_user_pw']);
...@@ -617,6 +616,8 @@ class SimpleSAML_Auth_LDAP { ...@@ -617,6 +616,8 @@ class SimpleSAML_Auth_LDAP {
} }
if ($password !== null) { // checking users credentials ... assuming below that she may read her own attributes ... if ($password !== null) { // checking users credentials ... assuming below that she may read her own attributes ...
// escape characters with a special meaning, also in the password
$password = addcslashes($password, ',+"\\<>;*');
if (!$this->bind($dn, $password)) { if (!$this->bind($dn, $password)) {
SimpleSAML\Logger::info('Library - LDAP validate(): Failed to authenticate \''. $username . '\' using DN \'' . $dn . '\''); SimpleSAML\Logger::info('Library - LDAP validate(): Failed to authenticate \''. $username . '\' using DN \'' . $dn . '\'');
return FALSE; return FALSE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment