diff --git a/SoObjects/SOGo/LDAPSource.m b/SoObjects/SOGo/LDAPSource.m index 94d8f4c6b..e9fa32e28 100644 --- a/SoObjects/SOGo/LDAPSource.m +++ b/SoObjects/SOGo/LDAPSource.m @@ -22,6 +22,7 @@ #import #import +#import #import #import @@ -41,6 +42,10 @@ static NSString *LDAPContactInfoAttribute = nil; static int timeLimit; static int sizeLimit; +#if defined(THREADSAFE) +static NSLock *lock; +#endif + @implementation LDAPSource + (void) initialize @@ -126,6 +131,10 @@ static int sizeLimit; @"calFBURL", @"proxyAddresses", nil]; [commonSearchFields retain]; + +#if defined(THREADSAFE) + lock = [NSLock new]; +#endif } } @@ -312,6 +321,10 @@ static int sizeLimit; NSString *userDN; NGLdapConnection *bindConnection; +#if defined(THREADSAFE) + [lock lock]; +#endif + didBind = NO; if ([loginToCheck length] > 0) @@ -337,6 +350,10 @@ static int sizeLimit; [bindConnection release]; } +#if defined(THREADSAFE) + [lock unlock]; +#endif + return didBind; } @@ -431,6 +448,10 @@ static int sizeLimit; NGLdapEntry *currentEntry; NSString *value; +#if defined(THREADSAFE) + [lock lock]; +#endif + ids = [NSMutableArray array]; if ([self _initLDAPConnection]) @@ -455,6 +476,10 @@ static int sizeLimit; [ldapConnection autorelease]; +#if defined(THREADSAFE) + [lock unlock]; +#endif + return ids; } @@ -552,6 +577,10 @@ static int sizeLimit; NGLdapEntry *currentEntry; NSEnumerator *entries; +#if defined(THREADSAFE) + [lock lock]; +#endif + contacts = [NSMutableArray array]; if ([match length] > 0) @@ -571,6 +600,10 @@ static int sizeLimit; [ldapConnection release]; } +#if defined(THREADSAFE) + [lock unlock]; +#endif + return contacts; } @@ -579,6 +612,10 @@ static int sizeLimit; NSDictionary *contactEntry; NGLdapEntry *ldapEntry; +#if defined(THREADSAFE) + [lock lock]; +#endif + contactEntry = nil; if ([entryID length] > 0) @@ -597,6 +634,10 @@ static int sizeLimit; [ldapConnection autorelease]; } +#if defined(THREADSAFE) + [lock unlock]; +#endif + return contactEntry; } @@ -607,6 +648,10 @@ static int sizeLimit; NSEnumerator *entries; EOQualifier *qualifier; +#if defined(THREADSAFE) + [lock lock]; +#endif + contactEntry = nil; if ([uid length] > 0) @@ -628,6 +673,10 @@ static int sizeLimit; [ldapConnection release]; } +#if defined(THREADSAFE) + [lock unlock]; +#endif + return contactEntry; }