diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-03-05 14:03:08 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-03-05 14:03:08 +0100 |
commit | 47a10bd25aadae5774fb4c011810c9d4edc53949 (patch) | |
tree | 308e0cf5089a8d1df43379aedcab58bbea73f206 /apps/user_ldap/lib/Access.php | |
parent | 4f8c724318de286ee19af83c4b199f8ba53ff9ef (diff) | |
download | nextcloud-server-47a10bd25aadae5774fb4c011810c9d4edc53949.tar.gz nextcloud-server-47a10bd25aadae5774fb4c011810c9d4edc53949.zip |
treat iconv issues
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib/Access.php')
-rw-r--r-- | apps/user_ldap/lib/Access.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index 4ae7dbe4d25..0cbe8fd3028 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -1307,13 +1307,18 @@ class Access extends LDAPUtility implements IUserTools { * @throws \InvalidArgumentException */ public function sanitizeUsername($name) { + $name = trim($name); + if($this->connection->ldapIgnoreNamingRules) { - return trim($name); + return $name; } - // Transliteration - // latin characters to ASCII - $name = iconv('UTF-8', 'ASCII//TRANSLIT', trim($name)); + // Transliteration to ASCII + $transliterated = @iconv('UTF-8', 'ASCII//TRANSLIT', $name); + if($transliterated !== false) { + // depending on system config iconv can work or not + $name = $transliterated; + } // Replacements $name = str_replace(' ', '_', $name); |