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.
pull/301/head
Francis Lachapelle 2021-08-17 15:37:58 -04:00
parent 7e63452141
commit a370aa70f2
1 changed files with 3 additions and 4 deletions

View File

@ -293,10 +293,8 @@ static Class NSNullK;
if (!domain) return NO; if (!domain) return NO;
ids = [_sources allKeys]; ids = [[SOGoSystemDefaults sharedSystemDefaults] domainIds];
if ([ids containsObject: domain]) if ([ids containsObject: domain])
// FIXME check SOGoMailDomain?
// Now source id is being considered as the domain
return YES; return YES;
sd = [SOGoSystemDefaults sharedSystemDefaults]; sd = [SOGoSystemDefaults sharedSystemDefaults];
@ -547,7 +545,7 @@ static Class NSNullK;
username = _login; username = _login;
if (*_domain) if (*_domain && ![*_domain isKindOfClass: NSNullK])
{ {
if ([_login rangeOfString: @"@"].location == NSNotFound) if ([_login rangeOfString: @"@"].location == NSNotFound)
username = [NSString stringWithFormat: @"%@@%@", _login, *_domain]; 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 // sources if SOGoLoginDomains isn't specified. This is also true if the user is
// using DAV or EAS. // using DAV or EAS.
r = [username rangeOfString: @"@"]; r = [username rangeOfString: @"@"];
*_domain = nil;
if (r.location != NSNotFound) if (r.location != NSNotFound)
{ {