(fix) fixed multidomain issue where UID isn't part of the email address

This commit is contained in:
Ludovic Marcotte 2015-06-10 14:31:32 -04:00
parent e40a19cf89
commit 1f83ba9d50

View file

@ -435,21 +435,39 @@ static Class NSNullK;
grace: (int *) grace grace: (int *) grace
{ {
NSObject <SOGoSource> *sogoSource; NSObject <SOGoSource> *sogoSource;
SOGoSystemDefaults *sd;
NSEnumerator *authIDs; NSEnumerator *authIDs;
NSString *currentID; NSString *currentID;
BOOL checkOK; BOOL checkOK;
NSRange r;
sd = [SOGoSystemDefaults sharedSystemDefaults];
checkOK = NO; checkOK = NO;
authIDs = [[self authenticationSourceIDsInDomain: *domain] objectEnumerator]; authIDs = [[self authenticationSourceIDsInDomain: *domain] objectEnumerator];
while (!checkOK && (currentID = [authIDs nextObject])) while (!checkOK && (currentID = [authIDs nextObject]))
{ {
sogoSource = [_sources objectForKey: currentID]; sogoSource = [_sources objectForKey: currentID];
r = [login rangeOfString: [NSString stringWithFormat: @"@%@", *domain]];
checkOK = [sogoSource checkLogin: login checkOK = [sogoSource checkLogin: login
password: password password: password
perr: perr perr: perr
expire: expire expire: expire
grace: grace]; grace: grace];
// If we are using multidomain and the UIDFieldName is not part of the email address
// we must also try to bind without the domain part since internally, SOGo will use
// UID @ domain as its unique identifier.
if (!checkOK && *domain && [sd enableDomainBasedUID] && r.location != NSNotFound)
{
checkOK = [sogoSource checkLogin: [login substringToIndex: r.location]
password: password
perr: perr
expire: expire
grace: grace];
}
} }
if (checkOK && *domain == nil) if (checkOK && *domain == nil)