View Issue Details

IDProjectCategoryView StatusLast Update
0001172SOGoBackend Generalpublic2011-03-06 23:55
Reporterbirger Assigned To 
PrioritynormalSeveritytrivialReproducibilityhave not tried
Status newResolutionopen 
Product Version1.3.5 
Summary0001172: Default email address is always added
Description

-[SOGoUserManager _fillContactMailRecords:] always adds a default system email address (uid@domain, or just uid if it contains an @) to a user's list of emails.

The place where this code is called a comment says
// If our LDAP queries gave us nothing, we add at least one default
// email address based on the default domain.

At my site users don't necessarily have an email address which is the same as the uid. This in combination with iCal led to problems where this default email address was used by iCal as sender address for meeting invitations.

Attached is a patch which changes _fillContactMailRecords to only add the default email address in case the list of emails of the contact is empty.

TagsNo tags attached.

Activities

2011-03-06 23:55

 

patch (1,306 bytes)   
--- SoObjects/SOGo/SOGoUserManager.m.bak	2011-03-07 00:09:04.000000000 +0100
+++ SoObjects/SOGo/SOGoUserManager.m	2011-03-07 00:15:44.000000000 +0100
@@ -523,19 +523,22 @@
   NSMutableArray *emails;
   SOGoDomainDefaults *dd;
 
-  domain = [contact objectForKey: @"c_domain"];
-  if ([domain length])
-    dd = [SOGoDomainDefaults defaultsForDomain: domain];
-  else
-    dd = [SOGoSystemDefaults sharedSystemDefaults];
   emails = [contact objectForKey: @"emails"];
-  uid = [contact objectForKey: @"c_uid"];
-  if ([uid rangeOfString: @"@"].location == NSNotFound)
-    systemEmail
-      = [NSString stringWithFormat: @"%@@%@", uid, [dd mailDomain]];
-  else
-    systemEmail = uid;
-  [emails addObject: systemEmail];
+  if ([emails count] == 0)
+  {
+    domain = [contact objectForKey: @"c_domain"];
+    if ([domain length])
+      dd = [SOGoDomainDefaults defaultsForDomain: domain];
+    else
+      dd = [SOGoSystemDefaults sharedSystemDefaults];
+    uid = [contact objectForKey: @"c_uid"];
+    if ([uid rangeOfString: @"@"].location == NSNotFound)
+      systemEmail
+        = [NSString stringWithFormat: @"%@@%@", uid, [dd mailDomain]];
+    else
+      systemEmail = uid;
+    [emails addObject: systemEmail];
+  }
   [contact setObject: [emails objectAtIndex: 0] forKey: @"c_email"];
 }
 
patch (1,306 bytes)   

Issue History

Date Modified Username Field Change
2011-03-06 23:55 birger New Issue
2011-03-06 23:55 birger File Added: patch