From a418150470f9cae3ef727024e4e3dd4bfd31904c Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Fri, 20 Feb 2015 13:54:28 +0100 Subject: [PATCH] fix and more robustness thx to scrutinizer --- apps/user_ldap/user_ldap.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index 045b3d46e0..ad10a2bf95 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -80,6 +80,9 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn try { $ldapRecord = $this->getLDAPUserByLoginName($loginName); $user = $this->access->userManager->get($ldapRecord['dn']); + if($user instanceof OfflineUser) { + return false; + } return $user->getUsername(); } catch (\Exception $e) { return false; @@ -140,7 +143,7 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn $dpn = $ldapRecord[$this->access->connection->ldapUserDisplayName]; $user->storeDisplayName($dpn); } - if(isset($users[0]['uid'])) { + if(isset($ldapRecord['uid'])) { $user->storeLDAPUserName($ldapRecord['uid']); } else if(isset($ldapRecord['samaccountname'])) { $user->storeLDAPUserName($ldapRecord['samaccountname']);