mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-06 22:08:51 +00:00
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 #2256
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
#include "SOGoGroup.h"
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
@@ -224,6 +225,7 @@
|
||||
NSDictionary *d;
|
||||
SOGoUser *user;
|
||||
NSArray *o;
|
||||
NSAutoreleasePool *pool;
|
||||
int i, c;
|
||||
|
||||
if (!_members)
|
||||
@@ -259,7 +261,8 @@
|
||||
|
||||
// We add members for whom we have their associated DN
|
||||
for (i = 0; i < [dns count]; i++)
|
||||
{
|
||||
{
|
||||
pool = [NSAutoreleasePool new];
|
||||
dn = [dns objectAtIndex: i];
|
||||
login = [um getLoginForDN: [dn lowercaseString]];
|
||||
user = [SOGoUser userWithLogin: login roles: nil];
|
||||
@@ -268,11 +271,13 @@
|
||||
[logins addObject: login];
|
||||
[_members addObject: user];
|
||||
}
|
||||
[pool release];
|
||||
}
|
||||
|
||||
// We add members for whom we have their associated login name
|
||||
for (i = 0; i < [uids count]; i++)
|
||||
{
|
||||
pool = [NSAutoreleasePool new];
|
||||
login = [uids objectAtIndex: i];
|
||||
user = [SOGoUser userWithLogin: login roles: nil];
|
||||
|
||||
@@ -281,6 +286,7 @@
|
||||
[logins addObject: login];
|
||||
[_members addObject: user];
|
||||
}
|
||||
[pool release];
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user