From 020c8959258928a1e99ec4dafb2e1dedf8eeb9b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Garc=C3=ADa=20S=C3=A1ez?= Date: Wed, 20 May 2015 11:44:06 +0200 Subject: [PATCH] Avoid uid+attributes entries on shared cache In multidomain environments this will produce that info@domain1.com can read info@domain2.com emails when info@domain2.com log in after info@domain1.com is already logged in. If multidomain is not enabled, this action is not needed because uid+attributes has been already saved on shared cache --- SoObjects/SOGo/SOGoUserManager.m | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/SoObjects/SOGo/SOGoUserManager.m b/SoObjects/SOGo/SOGoUserManager.m index fd8105c0b..499832780 100644 --- a/SoObjects/SOGo/SOGoUserManager.m +++ b/SoObjects/SOGo/SOGoUserManager.m @@ -776,24 +776,20 @@ static Class NSNullK; withLogin: (NSString *) login { NSEnumerator *emails; - NSString *key; - - [[SOGoCache sharedCache] - setUserAttributes: [newUser jsonRepresentation] - forLogin: login]; + NSString *key, *user_json; + + user_json = [newUser jsonRepresentation]; + [[SOGoCache sharedCache] setUserAttributes: user_json + forLogin: login]; if (![newUser isKindOfClass: NSNullK]) { - key = [newUser objectForKey: @"c_uid"]; - if (key && ![key isEqualToString: login]) - [[SOGoCache sharedCache] - setUserAttributes: [newUser jsonRepresentation] - forLogin: key]; - emails = [[newUser objectForKey: @"emails"] objectEnumerator]; while ((key = [emails nextObject])) - [[SOGoCache sharedCache] - setUserAttributes: [newUser jsonRepresentation] - forLogin: key]; + { + if (![key isEqualToString: login]) + [[SOGoCache sharedCache] setUserAttributes: user_json + forLogin: key]; + } } }