From 896491a24a397ec0fe89a14455bac5fdab299045 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 19 Dec 2008 16:18:03 +0000 Subject: [PATCH] Monotone-Parent: d53f8bb9f0834bbab96c2e6db0136aea6477ee39 Monotone-Revision: f2b7fe7c387ac36654ad3e24e68362b3a0a3f2c8 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-12-19T16:18:03 Monotone-Branch: ca.inverse.sogo --- SoObjects/SOGo/LDAPSource.m | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) 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; }