mirror of
https://github.com/nextcloud/server.git
synced 2026-04-21 14:23:17 -04:00
LDAP: also prepare for DN for login due to the escape changes for #419. Hopefully we're really done now..
This commit is contained in:
parent
dd694b5fb4
commit
95cee0eb5d
1 changed files with 14 additions and 1 deletions
|
|
@ -56,7 +56,7 @@ abstract class Access {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//Slashes should only be escaped in filters, not bases.
|
//Slashes should only be escaped in filters, not bases.
|
||||||
$dn = $dn = str_replace('\\5c', '\\', $dn);
|
$dn = $this->DNasBaseParameter($dn);
|
||||||
$rr = @ldap_read($cr, $dn, 'objectClass=*', array($attr));
|
$rr = @ldap_read($cr, $dn, 'objectClass=*', array($attr));
|
||||||
if(!is_resource($rr)) {
|
if(!is_resource($rr)) {
|
||||||
\OCP\Util::writeLog('user_ldap', 'readAttribute failed for DN '.$dn, \OCP\Util::DEBUG);
|
\OCP\Util::writeLog('user_ldap', 'readAttribute failed for DN '.$dn, \OCP\Util::DEBUG);
|
||||||
|
|
@ -649,6 +649,7 @@ abstract class Access {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function areCredentialsValid($name, $password) {
|
public function areCredentialsValid($name, $password) {
|
||||||
|
$name = $this->DNasBaseParameter($name);
|
||||||
$testConnection = clone $this->connection;
|
$testConnection = clone $this->connection;
|
||||||
$credentials = array(
|
$credentials = array(
|
||||||
'ldapAgentName' => $name,
|
'ldapAgentName' => $name,
|
||||||
|
|
@ -735,4 +736,16 @@ abstract class Access {
|
||||||
|
|
||||||
return strtoupper($hex_guid_to_guid_str);
|
return strtoupper($hex_guid_to_guid_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief converts a stored DN so it can be used as base parameter for LDAP queries
|
||||||
|
* @param $dn the DN
|
||||||
|
* @returns String
|
||||||
|
*
|
||||||
|
* converts a stored DN so it can be used as base parameter for LDAP queries
|
||||||
|
* internally we store them for usage in LDAP filters
|
||||||
|
*/
|
||||||
|
private function DNasBaseParameter($dn) {
|
||||||
|
return str_replace('\\5c', '\\', $dn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue