From 3f1a43cc13b223d94a987bbe2a7d00f2f3a7a2c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20Garc=C3=ADa?= Date: Fri, 26 Jun 2015 09:35:37 +0200 Subject: [PATCH] Revert "Revert "(fix) more multi-domain fixes and cleanups"" This reverts commit 90e11d76f61dd8855f7c6ddb267feb39bf26bc52. --- SoObjects/SOGo/SOGoUser.m | 8 ++++---- SoObjects/SOGo/SOGoUserManager.m | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index c1b0f7603..12d028fd3 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -165,9 +165,7 @@ // The domain is probably appended to the username; // make sure it is defined as a domain in the configuration. domain = [newLogin substringFromIndex: (r.location + r.length)]; - if ([[sd domainIds] containsObject: domain]) - newLogin = [newLogin substringToIndex: r.location]; - else + if (![[sd domainIds] containsObject: domain]) domain = nil; if (domain != nil && ![sd enableDomainBasedUID]) @@ -199,7 +197,9 @@ // [SOGoUser loginInDomain] only returns the login. 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]; else uid = [NSString stringWithString: realUID]; diff --git a/SoObjects/SOGo/SOGoUserManager.m b/SoObjects/SOGo/SOGoUserManager.m index 86d198d2b..c43892978 100644 --- a/SoObjects/SOGo/SOGoUserManager.m +++ b/SoObjects/SOGo/SOGoUserManager.m @@ -922,7 +922,7 @@ static Class NSNullK; { // Remove the "@" prefix used to identified groups in the ACL tables. aUID = [uid hasPrefix: @"@"] ? [uid substringFromIndex: 1] : uid; - if (domain) + if (domain && [aUID rangeOfString: @"@"].location == NSNotFound) cacheUid = [NSString stringWithFormat: @"%@@%@", aUID, domain]; else cacheUid = aUID;