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/lib
diff options
context:
space:
mode:
authorAnna Larch <anna@nextcloud.com>2022-09-08 03:26:10 +0300
committerAnna Larch <anna@nextcloud.com>2022-09-08 03:26:10 +0300
commitf7d73b0fc1afc6b9c54a591c5e1fcbcc603b6494 (patch)
tree7b47c24517f1a7fa2fec1c1bfd1fdab041863533 /lib
parent98c525a91a33d1a083f0ded08febb36379ef0797 (diff)
Fix various errors in iMIP logic
Signed-off-by: Anna Larch <anna@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Calendar/Manager.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/private/Calendar/Manager.php b/lib/private/Calendar/Manager.php
index f0b8e9fd50d..550ba36dd6b 100644
--- a/lib/private/Calendar/Manager.php
+++ b/lib/private/Calendar/Manager.php
@@ -330,12 +330,27 @@ class Manager implements IManager {
// to the email address in the ORGANIZER.
// We don't want to accept a CANCEL request from just anyone
$organizer = substr($vEvent->{'ORGANIZER'}->getValue(), 7);
- if (strcasecmp($sender, $organizer) !== 0 && strcasecmp($replyTo, $organizer) !== 0) {
+ $isNotOrganizer = ($replyTo !== null) ? (strcasecmp($sender, $organizer) !== 0 && strcasecmp($replyTo, $organizer) !== 0) : (strcasecmp($sender, $organizer) !== 0);
+ if ($isNotOrganizer) {
$this->logger->warning('Sender must be the ORGANIZER of this event');
return false;
}
+ //check if the event is in the future
+ /** @var DateTime $eventTime */
+ $eventTime = $vEvent->{'DTSTART'};
+ if ($eventTime->getDateTime()->getTimeStamp() < $this->timeFactory->getTime()) { // this might cause issues with recurrences
+ $this->logger->warning('Only events in the future are processed');
+ return false;
+ }
+
+ // Check if we have a calendar to work with
$calendars = $this->getCalendarsForPrincipal($principalUri);
+ if (empty($calendars)) {
+ $this->logger->warning('Could not find any calendars for principal ' . $principalUri);
+ return false;
+ }
+
$found = null;
// if the attendee has been found in at least one calendar event with the UID of the iMIP event
// we process it.