Set domain before fetching auth sources

In multidomain environment right now we are trying to authenticate against
all sources defined in sogo.conf because the domain is not set at this point.

In sogo.conf we have to specify the domain a source is useful for, so with this
patch instead of 'n' tries of authentication we will perform only 1 (in a scenario
where we have 1 source per domain, and we have 'n' domains).
This commit is contained in:
Jesús García Sáez
2015-05-20 18:33:11 +02:00
parent ca500df0af
commit 7160d94e91
+12 -2
View File
@@ -425,9 +425,19 @@ static Class NSNullK;
NSEnumerator *authIDs;
NSString *currentID;
BOOL checkOK;
SOGoSystemDefaults *sd;
NSRange r;
checkOK = NO;
if (*domain == nil)
{
sd = [SOGoSystemDefaults sharedSystemDefaults];
r = [login rangeOfString: @"@" options: NSBackwardsSearch];
if ([sd enableDomainBasedUID] && r.location != NSNotFound)
*domain = [login substringFromIndex: (r.location + r.length)];
}
authIDs = [[self authenticationSourceIDsInDomain: *domain] objectEnumerator];
while (!checkOK && (currentID = [authIDs nextObject]))
{