Use an autorelease pool in member expansion
Otherwise, we would hold one ldap connection for each member of a group. And close them all later. With large groups, we could hit the open file limit (or the open file limit of the ldap server). Fixes #2256pull/10/head
parent
a7c3f33447
commit
f1846191d5
|
@ -57,6 +57,7 @@
|
||||||
#include "SOGoGroup.h"
|
#include "SOGoGroup.h"
|
||||||
|
|
||||||
#import <Foundation/NSArray.h>
|
#import <Foundation/NSArray.h>
|
||||||
|
#import <Foundation/NSAutoreleasePool.h>
|
||||||
#import <Foundation/NSDictionary.h>
|
#import <Foundation/NSDictionary.h>
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
|
|
||||||
|
@ -224,6 +225,7 @@
|
||||||
NSDictionary *d;
|
NSDictionary *d;
|
||||||
SOGoUser *user;
|
SOGoUser *user;
|
||||||
NSArray *o;
|
NSArray *o;
|
||||||
|
NSAutoreleasePool *pool;
|
||||||
int i, c;
|
int i, c;
|
||||||
|
|
||||||
if (!_members)
|
if (!_members)
|
||||||
|
@ -259,7 +261,8 @@
|
||||||
|
|
||||||
// We add members for whom we have their associated DN
|
// We add members for whom we have their associated DN
|
||||||
for (i = 0; i < [dns count]; i++)
|
for (i = 0; i < [dns count]; i++)
|
||||||
{
|
{
|
||||||
|
pool = [NSAutoreleasePool new];
|
||||||
dn = [dns objectAtIndex: i];
|
dn = [dns objectAtIndex: i];
|
||||||
login = [um getLoginForDN: [dn lowercaseString]];
|
login = [um getLoginForDN: [dn lowercaseString]];
|
||||||
user = [SOGoUser userWithLogin: login roles: nil];
|
user = [SOGoUser userWithLogin: login roles: nil];
|
||||||
|
@ -268,11 +271,13 @@
|
||||||
[logins addObject: login];
|
[logins addObject: login];
|
||||||
[_members addObject: user];
|
[_members addObject: user];
|
||||||
}
|
}
|
||||||
|
[pool release];
|
||||||
}
|
}
|
||||||
|
|
||||||
// We add members for whom we have their associated login name
|
// We add members for whom we have their associated login name
|
||||||
for (i = 0; i < [uids count]; i++)
|
for (i = 0; i < [uids count]; i++)
|
||||||
{
|
{
|
||||||
|
pool = [NSAutoreleasePool new];
|
||||||
login = [uids objectAtIndex: i];
|
login = [uids objectAtIndex: i];
|
||||||
user = [SOGoUser userWithLogin: login roles: nil];
|
user = [SOGoUser userWithLogin: login roles: nil];
|
||||||
|
|
||||||
|
@ -281,6 +286,7 @@
|
||||||
[logins addObject: login];
|
[logins addObject: login];
|
||||||
[_members addObject: user];
|
[_members addObject: user];
|
||||||
}
|
}
|
||||||
|
[pool release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue