From 487e67a291d757cf74079a68d137472c009c3305 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 11 Jan 2022 13:41:49 -0500 Subject: [PATCH] fix(eas): handle module constraints Fixes #5456 --- ActiveSync/SOGoActiveSyncDispatcher.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m index 1b60cc72c..d2c787125 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher.m +++ b/ActiveSync/SOGoActiveSyncDispatcher.m @@ -676,6 +676,12 @@ void handle_eas_terminate(int signum) SOGoMailFolder *folderToUpdate; accountsFolder = [userFolder lookupName: @"Mail" inContext: context acquire: NO]; + if ([accountsFolder isKindOfClass: [NSException class]]) + { + [theResponse setStatus: 403]; + [self logWithFormat: @"Mail - Forbidden access for user %@", [[context activeUser] loginInDomain]]; + return; + } currentFolder = [accountsFolder lookupName: @"0" inContext: context acquire: NO]; folderToUpdate = [currentFolder lookupName: [NSString stringWithFormat: @"folder%@", serverId] @@ -721,6 +727,12 @@ void handle_eas_terminate(int signum) NSString *nameInCache; appointmentFolders = [userFolder privateCalendars: @"Calendar" inContext: context]; + if ([appointmentFolders isKindOfClass: [NSException class]]) + { + [theResponse setStatus: 403]; + [self logWithFormat: @"Calendar - Forbidden access for user %@", [[context activeUser] loginInDomain]]; + return; + } folderToUpdate = [appointmentFolders lookupName: [NSString stringWithFormat: @"%@", serverId] inContext: context