(fix) more multi-domain fixes and cleanups

This commit is contained in:
Ludovic Marcotte 2015-05-25 09:19:04 -04:00
parent e0c1d5e47b
commit ed42d1e26b
2 changed files with 5 additions and 5 deletions

View file

@ -165,9 +165,7 @@
// The domain is probably appended to the username; // The domain is probably appended to the username;
// make sure it is defined as a domain in the configuration. // make sure it is defined as a domain in the configuration.
domain = [newLogin substringFromIndex: (r.location + r.length)]; domain = [newLogin substringFromIndex: (r.location + r.length)];
if ([[sd domainIds] containsObject: domain]) if (![[sd domainIds] containsObject: domain])
newLogin = [newLogin substringToIndex: r.location];
else
domain = nil; domain = nil;
if (domain != nil && ![sd enableDomainBasedUID]) if (domain != nil && ![sd enableDomainBasedUID])
@ -199,7 +197,9 @@
// [SOGoUser loginInDomain] only returns the login. // [SOGoUser loginInDomain] only returns the login.
r = [realUID rangeOfString: domain options: NSBackwardsSearch|NSCaseInsensitiveSearch]; r = [realUID rangeOfString: domain options: NSBackwardsSearch|NSCaseInsensitiveSearch];
if (r.location != NSNotFound) // Do NOT strip @domain.com if SOGoEnableDomainBasedUID is enabled since
// the real login most likely is the email address.
if (r.location != NSNotFound && ![sd enableDomainBasedUID])
uid = [realUID substringToIndex: r.location-1]; uid = [realUID substringToIndex: r.location-1];
else else
uid = [NSString stringWithString: realUID]; uid = [NSString stringWithString: realUID];

View file

@ -912,7 +912,7 @@ static Class NSNullK;
{ {
// Remove the "@" prefix used to identified groups in the ACL tables. // Remove the "@" prefix used to identified groups in the ACL tables.
aUID = [uid hasPrefix: @"@"] ? [uid substringFromIndex: 1] : uid; aUID = [uid hasPrefix: @"@"] ? [uid substringFromIndex: 1] : uid;
if (domain) if (domain && [aUID rangeOfString: @"@"].location == NSNotFound)
cacheUid = [NSString stringWithFormat: @"%@@%@", aUID, domain]; cacheUid = [NSString stringWithFormat: @"%@@%@", aUID, domain];
else else
cacheUid = aUID; cacheUid = aUID;