Make sure we handle arrays, and not single-value string objects.

pull/7/head
Ludovic Marcotte 2012-11-19 09:45:48 -05:00
parent eec99de5d0
commit 2606787dd7
1 changed files with 8 additions and 0 deletions

View File

@ -69,6 +69,11 @@
#import <NGLdap/NGLdapAttribute.h>
#import <NGLdap/NGLdapEntry.h>
#define CHECK_CLASS(o) ({ \
if ([o isKindOfClass: [NSString class]]) \
o = [NSArray arrayWithObject: o]; \
})
@implementation SOGoGroup
- (id) initWithIdentifier: (NSString *) theID
@ -232,14 +237,17 @@
// Fetch "members" - we get DNs
d = [_entry asDictionary];
o = [d objectForKey: @"member"];
CHECK_CLASS(o);
if (o) [dns addObjectsFromArray: o];
// Fetch "uniqueMembers" - we get DNs
o = [d objectForKey: @"uniquemember"];
CHECK_CLASS(o);
if (o) [dns addObjectsFromArray: o];
// Fetch "memberUid" - we get UID (like login names)
o = [d objectForKey: @"memberuid"];
CHECK_CLASS(o);
if (o) [uids addObjectsFromArray: o];
c = [dns count] + [uids count];