From a370aa70f29f008af85520fdfed7d7d909791885 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 17 Aug 2021 15:37:58 -0400 Subject: [PATCH] fix(core): properly validate domain using "domains" keys Instead of checking if the domain match a source ID, we now check if the domain match a key of the "domains" configuration parameter. --- SoObjects/SOGo/SOGoUserManager.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/SoObjects/SOGo/SOGoUserManager.m b/SoObjects/SOGo/SOGoUserManager.m index ae323b8cc..74820df94 100644 --- a/SoObjects/SOGo/SOGoUserManager.m +++ b/SoObjects/SOGo/SOGoUserManager.m @@ -293,10 +293,8 @@ static Class NSNullK; if (!domain) return NO; - ids = [_sources allKeys]; + ids = [[SOGoSystemDefaults sharedSystemDefaults] domainIds]; if ([ids containsObject: domain]) - // FIXME check SOGoMailDomain? - // Now source id is being considered as the domain return YES; sd = [SOGoSystemDefaults sharedSystemDefaults]; @@ -547,7 +545,7 @@ static Class NSNullK; username = _login; - if (*_domain) + if (*_domain && ![*_domain isKindOfClass: NSNullK]) { if ([_login rangeOfString: @"@"].location == NSNotFound) username = [NSString stringWithFormat: @"%@@%@", _login, *_domain]; @@ -560,6 +558,7 @@ static Class NSNullK; // sources if SOGoLoginDomains isn't specified. This is also true if the user is // using DAV or EAS. r = [username rangeOfString: @"@"]; + *_domain = nil; if (r.location != NSNotFound) {