diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Calendar/Manager.php | 40 | ||||
-rw-r--r-- | lib/private/Share20/Manager.php | 24 | ||||
-rw-r--r-- | lib/public/AppFramework/Utility/ITimeFactory.php | 2 |
3 files changed, 54 insertions, 12 deletions
diff --git a/lib/private/Calendar/Manager.php b/lib/private/Calendar/Manager.php index 7ef9dc585ae..85a600e1cc8 100644 --- a/lib/private/Calendar/Manager.php +++ b/lib/private/Calendar/Manager.php @@ -240,12 +240,26 @@ class Manager implements IManager { /** * @throws \OCP\DB\Exception */ - public function handleIMipReply(string $principalUri, string $sender, string $recipient, string $calendarData): bool { - /** @var VCalendar $vObject */ + public function handleIMipReply( + string $principalUri, + string $sender, + 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('REPLY', $vObject->{'METHOD'}->getValue()) !== 0) { $this->logger->warning('Wrong method provided for processing'); @@ -309,11 +323,27 @@ class Manager implements IManager { * @since 25.0.0 * @throws \OCP\DB\Exception */ - public function handleIMipCancel(string $principalUri, string $sender, ?string $replyTo, string $recipient, string $calendarData): bool { + public function handleIMipCancel( + string $principalUri, + string $sender, + ?string $replyTo, + 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 732bd5bb97d..c7d09a3d6f7 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -1352,7 +1352,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; @@ -1411,7 +1411,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]); } @@ -1457,7 +1457,7 @@ class Manager implements IManager { $share = $provider->getShareById($id, $recipient); - $this->checkExpireDate($share); + $this->checkShare($share); return $share; } @@ -1541,7 +1541,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 @@ -1554,11 +1554,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')); + } + } + } } /** diff --git a/lib/public/AppFramework/Utility/ITimeFactory.php b/lib/public/AppFramework/Utility/ITimeFactory.php index 7a6acf97b2d..d4f74c9d107 100644 --- a/lib/public/AppFramework/Utility/ITimeFactory.php +++ b/lib/public/AppFramework/Utility/ITimeFactory.php @@ -41,7 +41,6 @@ interface ITimeFactory extends ClockInterface { /** * @return int the result of a call to time() * @since 8.0.0 - * @deprecated 26.0.0 {@see ITimeFactory::now()} */ public function getTime(): int; @@ -50,7 +49,6 @@ interface ITimeFactory extends ClockInterface { * @param \DateTimeZone|null $timezone * @return \DateTime * @since 15.0.0 - * @deprecated 26.0.0 {@see ITimeFactory::now()} */ public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime; |