From 0cf57d1ed4fb370a4411353aab0aceecc08dc5de Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 15 Jun 2020 21:48:27 +0200 Subject: [PATCH 1/2] getXbyY can still return false, e.g. when using ldap write support Signed-off-by: Arthur Schiwon --- apps/user_ldap/lib/Mapping/AbstractMapping.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index 6fd07f5f48334..a4a3705e2238b 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -123,8 +123,7 @@ protected function modify($query, $parameters) { */ public function getDNByName($name) { $dn = array_search($name, $this->cache); - if ($dn === false) { - $dn = $this->getXbyY('ldap_dn', 'owncloud_name', $name); + if ($dn === false && $dn = $this->getXbyY('ldap_dn', 'owncloud_name', $name)) { $this->cache[$dn] = $name; } return $dn; From 0ab6ee40de6107c9f660305ee49d5b11044d5266 Mon Sep 17 00:00:00 2001 From: blizzz Date: Tue, 16 Jun 2020 10:55:51 +0200 Subject: [PATCH 2/2] be more clear about the condition Co-authored-by: Christoph Wurst --- apps/user_ldap/lib/Mapping/AbstractMapping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index a4a3705e2238b..0daa4f1504c7c 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -123,7 +123,7 @@ protected function modify($query, $parameters) { */ public function getDNByName($name) { $dn = array_search($name, $this->cache); - if ($dn === false && $dn = $this->getXbyY('ldap_dn', 'owncloud_name', $name)) { + if ($dn === false && ($dn = $this->getXbyY('ldap_dn', 'owncloud_name', $name)) !== false) { $this->cache[$dn] = $name; } return $dn;