diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2012-05-14 12:25:10 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2012-05-14 12:25:33 +0200 |
commit | 2e3467398920249471ec0b4b526fe71c51f7071c (patch) | |
tree | b70b68f4d70852f296432e4309f7b2dde1251429 /apps | |
parent | 1f2b37c08bf3ef42f26ef596127dba4e251be3aa (diff) | |
download | nextcloud-server-2e3467398920249471ec0b4b526fe71c51f7071c.tar.gz nextcloud-server-2e3467398920249471ec0b4b526fe71c51f7071c.zip |
LDAP: no whitespaces after the , in the DNs, resolves conflicts with some servers
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/user_ldap/lib_ldap.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/apps/user_ldap/lib_ldap.php b/apps/user_ldap/lib_ldap.php index e8d91d0e037..b2d81673795 100755 --- a/apps/user_ldap/lib_ldap.php +++ b/apps/user_ldap/lib_ldap.php @@ -185,6 +185,7 @@ class OC_LDAP { } static public function dn2ocname($dn, $ldapname = null, $isUser = true) { + $dn = self::sanitizeDN($dn); $table = self::getMapTable($isUser); if($isUser) { $nameAttribute = self::conf('ldapUserDisplayName'); @@ -362,6 +363,7 @@ class OC_LDAP { */ static private function mapComponent($dn, $ocname, $isUser = true) { $table = self::getMapTable($isUser); + $dn = self::sanitizeDN($dn); $sqliteAdjustment = ''; $dbtype = OCP\Config::getSystemValue('dbtype'); @@ -488,7 +490,7 @@ class OC_LDAP { if($key != 'dn'){ $selection[$i][$key] = $item[$key][0]; } else { - $selection[$i][$key] = $item[$key]; + $selection[$i][$key] = self::sanitizeDN($item[$key]); } } @@ -503,7 +505,11 @@ class OC_LDAP { $key = strtolower($attr[0]); if(isset($item[$key])) { - $selection[] = $item[$key]; + if($key == 'dn') { + $selection[] = self::sanitizeDN($item[$key]); + } else { + $selection[] = $item[$key]; + } } } @@ -514,6 +520,13 @@ class OC_LDAP { return $findings; } + static private function sanitizeDN($dn) { + //OID sometimes gives back DNs with whitespace after the comma a la "uid=foo, cn=bar, dn=..." We need to tackle this! + $dn = preg_replace('/,\s+/',',',$dn); + + return $dn; + } + /** * @brief combines the input filters with AND * @param $filters array, the filters to connect |