(fix) Session fix when SOGoEnableDomainBasedUID is enabled but logins are domain-less

pull/100/merge
Ludovic Marcotte 2015-08-21 10:30:47 -04:00
parent 525d1ad80f
commit b80d8dbb06
3 changed files with 12 additions and 7 deletions

1
NEWS
View File

@ -7,6 +7,7 @@ Bug fixes
- Fixed several sync issues on environments with multiple users (Zentyal)
- Folders from other users will no longer appear on your Outlook (Zentyal)
- Use right auth in multidomain environments in contacts and calendar from Outlook (Zentyal)
- Session fix when SOGoEnableDomainBasedUID is enabled but logins are domain-less
2.3.1 (2015-07-23)
------------------

View File

@ -778,7 +778,10 @@ static Class NSNullK;
NSRange r;
r = [theUID rangeOfString: [NSString stringWithFormat: @"@%@", theDomain]];
theUID = [theUID substringToIndex: r.location];
// We check if the range is ok here since we could be using DomainLessLogin
if (r.location != NSNotFound)
theUID = [theUID substringToIndex: r.location];
}
sogoSources = [[self authenticationSourceIDsInDomain: theDomain] objectEnumerator];

View File

@ -183,7 +183,6 @@
SOGoWebAuthenticator *auth;
SOGoAppointmentFolders *calendars;
SOGoUserDefaults *ud;
SOGoSystemDefaults *sd;
SOGoUser *loggedInUser;
NSDictionary *params;
NSString *username, *password, *language, *domain, *remoteHost;
@ -226,13 +225,15 @@
response = [self responseWithStatus: 200
andJSONRepresentation: json];
// We get the proper username for cookie creation. If we are using a multidomain
// environment with SOGoEnableDomainBasedUID, we could have to append the domain
// to the username. Also when SOGoEnableDomainBasedUID is enabled, we could be in
// the DomainLessLogin situation, so we would NOT add the domain. -getUIDForEmail
// has all the logic for this, so lets use it.
if ([domain isNotNull])
{
sd = [SOGoSystemDefaults sharedSystemDefaults];
if ([sd enableDomainBasedUID] &&
[username rangeOfString: @"@"].location == NSNotFound)
username = [NSString stringWithFormat: @"%@@%@", username, domain];
username = [[SOGoUserManager sharedUserManager] getUIDForEmail: username];
}
authCookie = [auth cookieWithUsername: username