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

This reverts commit ac30c82165.
pull/89/head
Ludovic Marcotte 2015-06-10 20:04:51 -04:00
parent ac30c82165
commit 2c5f598a23
1 changed files with 19 additions and 1 deletions

View File

@ -435,21 +435,39 @@ static Class NSNullK;
grace: (int *) grace
{
NSObject <SOGoSource> *sogoSource;
SOGoSystemDefaults *sd;
NSEnumerator *authIDs;
NSString *currentID;
BOOL checkOK;
NSRange r;
sd = [SOGoSystemDefaults sharedSystemDefaults];
checkOK = NO;
authIDs = [[self authenticationSourceIDsInDomain: *domain] objectEnumerator];
while (!checkOK && (currentID = [authIDs nextObject]))
{
sogoSource = [_sources objectForKey: currentID];
r = [login rangeOfString: [NSString stringWithFormat: @"@%@", *domain]];
checkOK = [sogoSource checkLogin: login
password: password
perr: perr
expire: expire
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)