Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2021-10-12 13:38:00 +0300
committerblizzz (Rebase PR Action) <blizzz@users.noreply.github.com>2021-10-29 12:03:12 +0300
commit355bf525082c80343dde27d6630c20ec45a8d1d9 (patch)
tree9f7e7d46e392b6ce4f6a68d55da3ef45fc2ca113 /apps
parente48efef3516355c5d8e76c185ad4c8b0a6f3c0eb (diff)
Avoid PHP errors when the LDAP attribute is not found
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/lib/Access.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php
index 222443cfa8e..93f1281f065 100644
--- a/apps/user_ldap/lib/Access.php
+++ b/apps/user_ldap/lib/Access.php
@@ -555,7 +555,7 @@ class Access extends LDAPUtility {
if (is_null($ldapName)) {
$ldapName = $this->readAttribute($fdn, $nameAttribute, $filter);
- if (!isset($ldapName[0]) && empty($ldapName[0])) {
+ if (!isset($ldapName[0]) || empty($ldapName[0])) {
\OCP\Util::writeLog('user_ldap', 'No or empty name for ' . $fdn . ' with filter ' . $filter . '.', ILogger::DEBUG);
return false;
}
@@ -566,6 +566,10 @@ class Access extends LDAPUtility {
$usernameAttribute = (string)$this->connection->ldapExpertUsernameAttr;
if ($usernameAttribute !== '') {
$username = $this->readAttribute($fdn, $usernameAttribute);
+ if (!isset($username[0]) || empty($username[0])) {
+ \OCP\Util::writeLog('user_ldap', 'No or empty username (' . $usernameAttribute . ') for ' . $fdn . '.', ILogger::DEBUG);
+ return false;
+ }
$username = $username[0];
} else {
$username = $uuid;