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.
This commit is contained in:
Francis Lachapelle
2021-08-17 15:37:58 -04:00
parent 7e63452141
commit a370aa70f2

View File

@@ -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)
{