diff --git a/ChangeLog b/ChangeLog index 045e7af1e..fef1e0965 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ * Tools/SOGoSockDOperation.m (-_performSearch): we now support an additional identifier in the object DN, for specifying specific objects. + (_appendEntry:toResult:): we take the additional particle into + account when building the dn. Also, we add the "uid" field for + LDAP compliance. * SoObjects/Contacts/SOGoContactSourceFolder.m (_flattenedRecord:): new method with the repetitive code from diff --git a/Tools/SOGoSockDOperation.h b/Tools/SOGoSockDOperation.h index f6ba745f5..671427d76 100644 --- a/Tools/SOGoSockDOperation.h +++ b/Tools/SOGoSockDOperation.h @@ -31,6 +31,7 @@ { NSDictionary *parameters; NSArray *resultEntries; + BOOL singleEntryOperation; int resultCode; } diff --git a/Tools/SOGoSockDOperation.m b/Tools/SOGoSockDOperation.m index 1e481d1da..e52b33651 100644 --- a/Tools/SOGoSockDOperation.m +++ b/Tools/SOGoSockDOperation.m @@ -36,6 +36,8 @@ #import "SOGoSockDOperation.h" +Class SOGoContactSourceFolderKlass = Nil; + @interface _SOGoSockDOperationSearch : SOGoSockDOperation @end @@ -48,6 +50,8 @@ { [[SOGoProductLoader productLoader] loadProducts: [NSArray arrayWithObjects: @"Contacts.SOGo", nil]]; + SOGoContactSourceFolderKlass + = NSClassFromString (@"SOGoContactSourceFolder"); } + (SOGoSockDOperation *) operationWithMethod: (NSString *) method @@ -101,9 +105,13 @@ [ldifFields retain]; } - [result appendFormat: @"dn: cn=%@,%@\n", - [entry objectForKey: @"c_name"], [parameters objectForKey: @"suffix"]]; + if (singleEntryOperation) + [result appendFormat: @"dn: %@\n", [parameters objectForKey: @"base"]]; + else + [result appendFormat: @"dn: uid=%@,%@\n", [entry objectForKey: @"c_name"], + [parameters objectForKey: @"base"]]; [result appendString: @"objectClass: person\nobjectClass: inetOrgPerson\n"]; + [result appendFormat: @"uid: %@\n", [entry objectForKey: @"c_name"]]; max = [ldifFields count]; for (count = 0; count < max; count++) @@ -254,8 +262,12 @@ { if (idCount == 1) { + singleEntryOperation = NO; filter = [self _convertLDAPFilter: [parameters objectForKey: @"filter"]]; + if ([filter length] == 0 + && [folder isKindOfClass: SOGoContactSourceFolderKlass]) + filter = @"."; resultEntries = [folder lookupContactsWithFilter: filter sortBy: @"c_cn" @@ -263,6 +275,7 @@ } else { + singleEntryOperation = YES; singleEntry = [folder lookupContactWithName: [dnIDs objectAtIndex: 0]]; resultEntries = [NSArray arrayWithObject: singleEntry];