diff --git a/ChangeLog b/ChangeLog index 71165f526..4b48dc1a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-01-08 Ludovic Marcotte + + * SoObjects/SOGo/LDAPSource.{h,m} - bindFields is now + an array instead of a list of strings separated by commas. + Updated the Installation & Configuration Guide to reflect + this change. + 2010-01-08 Wolfgang Sourdeau * UnitTests/SOGoTestRunner.m: separated class "SOGoTestRunner" diff --git a/Documentation/SOGo Installation Guide.odt b/Documentation/SOGo Installation Guide.odt index 296226d4a..486c72a55 100644 Binary files a/Documentation/SOGo Installation Guide.odt and b/Documentation/SOGo Installation Guide.odt differ diff --git a/SoObjects/SOGo/LDAPSource.h b/SoObjects/SOGo/LDAPSource.h index 0f3cfa34a..ab09c6661 100644 --- a/SoObjects/SOGo/LDAPSource.h +++ b/SoObjects/SOGo/LDAPSource.h @@ -52,7 +52,7 @@ NSString *UIDField; NSArray *mailFields; NSString *IMAPHostField; - NSString *bindFields; + NSArray *bindFields; NSString *domain; NSString *contactInfoAttribute; @@ -74,7 +74,7 @@ UIDField: (NSString *) newUIDField mailFields: (NSArray *) newMailFields IMAPHostField: (NSString *) newIMAPHostField - andBindFields: (NSString *) newBindFields; + andBindFields: (id) newBindFields; - (NGLdapEntry *) lookupGroupEntryByUID: (NSString *) theUID; - (NGLdapEntry *) lookupGroupEntryByEmail: (NSString *) theEmail; diff --git a/SoObjects/SOGo/LDAPSource.m b/SoObjects/SOGo/LDAPSource.m index 9287abaaa..958b9f032 100644 --- a/SoObjects/SOGo/LDAPSource.m +++ b/SoObjects/SOGo/LDAPSource.m @@ -266,7 +266,7 @@ static NSArray *commonSearchFields; UIDField: (NSString *) newUIDField mailFields: (NSArray *) newMailFields IMAPHostField: (NSString *) newIMAPHostField - andBindFields: (NSString *) newBindFields + andBindFields: (id) newBindFields { ASSIGN (baseDN, [newBaseDN lowercaseString]); if (newIDField) @@ -280,7 +280,28 @@ static NSArray *commonSearchFields; if (newMailFields) ASSIGN (mailFields, newMailFields); if (newBindFields) - ASSIGN (bindFields, newBindFields); + { + // Before SOGo v1.2.0, bindFields was a comma-separated list + // of values. So it could be configured as: + // + // bindFields = foo; + // bindFields = "foo, bar, baz"; + // + // SOGo v1.2.0 and upwards redefined that parameter as an array + // so we would have instead: + // + // bindFields = (foo); + // bindFields = (foo, bar, baz); + // + // We check for the old format and we support it. + if ([newBindFields isKindOfClass: [NSArray class]]) + ASSIGN(bindFields, newBindFields); + else + { + [self logWithFormat: @"WARNING: using old bindFields format - please update it"]; + ASSIGN(bindFields, [newBindFields componentsSeparatedByString: @","]); + } + } } - (BOOL) _setupEncryption: (NGLdapConnection *) encryptedConn @@ -351,7 +372,7 @@ static NSArray *commonSearchFields; escapedUid = SafeLDAPCriteria (uid); - fields = [[bindFields componentsSeparatedByString: @","] objectEnumerator]; + fields = [bindFields objectEnumerator]; while ((currentField = [fields nextObject])) [qs appendFormat: @" OR (%@='%@')", currentField, escapedUid]; @@ -482,8 +503,7 @@ static NSArray *commonSearchFields; UIDField, escapedUid, mailFormat]; if (bindFields) { - bindFieldsEnum = [[bindFields componentsSeparatedByString: @","] - objectEnumerator]; + bindFieldsEnum = [bindFields objectEnumerator]; while ((currentField = [bindFieldsEnum nextObject])) [qs appendFormat: @" OR (%@='%@')", [currentField stringByTrimmingSpaces], escapedUid]; }