summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2023-05-30 12:12:53 +0200
committerGitHub <noreply@github.com>2023-05-30 12:12:53 +0200
commit297ba1cd3a5c77b0f5e6458e6b30764fbc9f6a80 (patch)
treeb2d6756912b471fa83e07a102537fdad30d6d01c /apps
parentd9ff25230c1b605bec865b553c943182e9fec3ce (diff)
parentc1ac314ff11176866adeb61636273623561ed0cb (diff)
downloadnextcloud-server-297ba1cd3a5c77b0f5e6458e6b30764fbc9f6a80.tar.gz
nextcloud-server-297ba1cd3a5c77b0f5e6458e6b30764fbc9f6a80.zip
Merge pull request #38416 from nextcloud/backport/38308/stable27
[stable27] fix(carddav): Check if SERVER variables are set before accessing them
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/CardDAV/SystemAddressbook.php9
1 files changed, 4 insertions, 5 deletions
diff --git a/apps/dav/lib/CardDAV/SystemAddressbook.php b/apps/dav/lib/CardDAV/SystemAddressbook.php
index 21e41ebc509..1cffde63474 100644
--- a/apps/dav/lib/CardDAV/SystemAddressbook.php
+++ b/apps/dav/lib/CardDAV/SystemAddressbook.php
@@ -35,14 +35,12 @@ use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IL10N;
use OCP\IRequest;
-use OCP\IUser;
use OCP\IUserSession;
use Sabre\CardDAV\Backend\SyncSupport;
use Sabre\CardDAV\Backend\BackendInterface;
use Sabre\CardDAV\Card;
use Sabre\DAV\Exception\Forbidden;
use Sabre\DAV\Exception\NotFound;
-use Sabre\DAV\ICollection;
use Sabre\VObject\Component\VCard;
use Sabre\VObject\Reader;
use function array_filter;
@@ -300,12 +298,13 @@ class SystemAddressbook extends AddressBook {
}
/** @psalm-suppress NoInterfaceProperties */
- if ($this->request->server['PHP_AUTH_USER'] !== 'system') {
+ $server = $this->request->server;
+ if (!isset($server['PHP_AUTH_USER']) || $server['PHP_AUTH_USER'] !== 'system') {
return false;
}
/** @psalm-suppress NoInterfaceProperties */
- $sharedSecret = $this->request->server['PHP_AUTH_PW'];
+ $sharedSecret = $server['PHP_AUTH_PW'] ?? null;
if ($sharedSecret === null) {
return false;
}
@@ -365,7 +364,7 @@ class SystemAddressbook extends AddressBook {
}
public function getACL() {
- return array_filter(parent::getACL(), function($acl) {
+ return array_filter(parent::getACL(), function ($acl) {
if (in_array($acl['privilege'], ['{DAV:}write', '{DAV:}all'], true)) {
return false;
}