diff options
author | Lennart Rosam <hello@takuto.de> | 2015-08-21 23:54:45 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-10-05 13:42:20 +0200 |
commit | b47d15cd2052b5e88214439d220461312af3493e (patch) | |
tree | ec86e007135de1a606d4a1780610a490346fa51b /apps | |
parent | f4885f6da3048d90d44cd7e78b02e4305b0717dc (diff) | |
download | nextcloud-server-b47d15cd2052b5e88214439d220461312af3493e.tar.gz nextcloud-server-b47d15cd2052b5e88214439d220461312af3493e.zip |
Remove whitespace from base-DNs
Diffstat (limited to 'apps')
-rw-r--r-- | apps/user_ldap/lib/configuration.php | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/apps/user_ldap/lib/configuration.php b/apps/user_ldap/lib/configuration.php index 1cbe45a82c2..ff839881aa2 100644 --- a/apps/user_ldap/lib/configuration.php +++ b/apps/user_ldap/lib/configuration.php @@ -145,6 +145,7 @@ class Configuration { } $setMethod = 'setValue'; + $trim = false; switch($key) { case 'homeFolderNamingRule': if(!empty($val) && strpos($val, 'attr:') === false) { @@ -154,6 +155,7 @@ class Configuration { case 'ldapBase': case 'ldapBaseUsers': case 'ldapBaseGroups': + $trim = true;// Prevent login errors due to whitespace case 'ldapAttributesForUserSearch': case 'ldapAttributesForGroupSearch': case 'ldapUserFilterObjectclass': @@ -164,7 +166,7 @@ class Configuration { $setMethod = 'setMultiLine'; break; } - $this->$setMethod($key, $val); + $this->$setMethod($key, $val, $trim); if(is_array($applied)) { $applied[] = $inputKey; } @@ -275,14 +277,18 @@ class Configuration { * @param string $varName * @param array|string $value */ - protected function setMultiLine($varName, $value) { + protected function setMultiLine($varName, $value, $trim = false) { if(empty($value)) { $value = ''; } else if (!is_array($value)) { $value = preg_split('/\r\n|\r|\n|;/', $value); if($value === false) { $value = ''; - } + } else if($trim) { + foreach($value as $key => $val) { + $value[$key] = trim($val); + } + } } $this->setValue($varName, $value); @@ -328,11 +334,11 @@ class Configuration { } /** - * @param string $varName + * @param string $varName * @param mixed $value */ - protected function setValue($varName, $value) { - $this->config[$varName] = $value; + protected function setValue($varName, $value, $trim = false) { + $this->config[$varName] = $trim ? trim($value) : $value; } /** |