aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorLucas Azevedo <lhs_azevedo@hotmail.com>2023-08-28 12:25:01 -0300
committerLucas Azevedo <lhs_azevedo@hotmail.com>2023-08-28 12:25:01 -0300
commit79bc6ba06cc19793c8bb1cf3b3dc231ae0dc1969 (patch)
tree91226f2f6fa52e506f9ba957946e15ff4906739b /lib/private
parentcc912c3b51be06a7034c397a2b77d7968a28a7bd (diff)
parentfc3eef9d2f0210729d3203ad857980cd621e0427 (diff)
downloadnextcloud-server-79bc6ba06cc19793c8bb1cf3b3dc231ae0dc1969.tar.gz
nextcloud-server-79bc6ba06cc19793c8bb1cf3b3dc231ae0dc1969.zip
Merge branch 'master' into auth-token-commands
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Calendar/Manager.php25
-rw-r--r--lib/private/Share20/Manager.php24
2 files changed, 41 insertions, 8 deletions
diff --git a/lib/private/Calendar/Manager.php b/lib/private/Calendar/Manager.php
index f29920e1793..dc4801c69ce 100644
--- a/lib/private/Calendar/Manager.php
+++ b/lib/private/Calendar/Manager.php
@@ -231,11 +231,20 @@ class Manager implements IManager {
string $recipient,
string $calendarData,
): bool {
- /** @var VCalendar $vObject */
+ /** @var VCalendar $vObject|null */
$vObject = Reader::read($calendarData);
- /** @var VEvent $vEvent */
+
+ if ($vObject === null) {
+ return false;
+ }
+
+ /** @var VEvent|null $vEvent */
$vEvent = $vObject->{'VEVENT'};
+ if ($vEvent === null) {
+ return false;
+ }
+
// First, we check if the correct method is passed to us
if (strcasecmp('REPLY', $vObject->{'METHOD'}->getValue()) !== 0) {
$this->logger->warning('Wrong method provided for processing');
@@ -306,10 +315,20 @@ class Manager implements IManager {
string $recipient,
string $calendarData,
): bool {
+ /** @var VCalendar $vObject|null */
$vObject = Reader::read($calendarData);
- /** @var VEvent $vEvent */
+
+ if ($vObject === null) {
+ return false;
+ }
+
+ /** @var VEvent|null $vEvent */
$vEvent = $vObject->{'VEVENT'};
+ if ($vEvent === null) {
+ return false;
+ }
+
// First, we check if the correct method is passed to us
if (strcasecmp('CANCEL', $vObject->{'METHOD'}->getValue()) !== 0) {
$this->logger->warning('Wrong method provided for processing');
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 9360046bc24..b03608f9872 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -1343,7 +1343,7 @@ class Manager implements IManager {
$added = 0;
foreach ($shares as $share) {
try {
- $this->checkExpireDate($share);
+ $this->checkShare($share);
} catch (ShareNotFound $e) {
//Ignore since this basically means the share is deleted
continue;
@@ -1402,7 +1402,7 @@ class Manager implements IManager {
// remove all shares which are already expired
foreach ($shares as $key => $share) {
try {
- $this->checkExpireDate($share);
+ $this->checkShare($share);
} catch (ShareNotFound $e) {
unset($shares[$key]);
}
@@ -1448,7 +1448,7 @@ class Manager implements IManager {
$share = $provider->getShareById($id, $recipient);
- $this->checkExpireDate($share);
+ $this->checkShare($share);
return $share;
}
@@ -1532,7 +1532,7 @@ class Manager implements IManager {
throw new ShareNotFound($this->l->t('The requested share does not exist anymore'));
}
- $this->checkExpireDate($share);
+ $this->checkShare($share);
/*
* Reduce the permissions for link or email shares if public upload is not enabled
@@ -1545,11 +1545,25 @@ class Manager implements IManager {
return $share;
}
- protected function checkExpireDate($share) {
+ /**
+ * Check expire date and disabled owner
+ *
+ * @throws ShareNotFound
+ */
+ protected function checkShare(IShare $share): void {
if ($share->isExpired()) {
$this->deleteShare($share);
throw new ShareNotFound($this->l->t('The requested share does not exist anymore'));
}
+ if ($this->config->getAppValue('files_sharing', 'hide_disabled_user_shares', 'no') === 'yes') {
+ $uids = array_unique([$share->getShareOwner(),$share->getSharedBy()]);
+ foreach ($uids as $uid) {
+ $user = $this->userManager->get($uid);
+ if ($user?->isEnabled() === false) {
+ throw new ShareNotFound($this->l->t('The requested share comes from a disabled user'));
+ }
+ }
+ }
}
/**