From aade431284f3c79ac46bf90e1d7d4993206caaea Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 10 May 2007 14:59:13 +0000 Subject: [PATCH] Monotone-Parent: 9c8fadcccf096acb0cb35206831736703fec1558 Monotone-Revision: 7115767efc793f96f9d75e98d9e930968538bb9b Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-05-10T14:59:13 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 ++ SoObjects/SOGo/LDAPUserManager.m | 50 ++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c77061b9..ad92d7c78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2007-05-10 Wolfgang Sourdeau + * SoObjects/SOGo/LDAPUserManager.m ([LDAPUserManager + -contactInfosForUserWithUIDorEmail:uid]): check that uid is not empty. + * SoObjects/SOGo/LDAPSource.m ([LDAPSource -checkLogin:loginToCheckandPassword:passwordToCheck]): check that loginToCheck is not empty. diff --git a/SoObjects/SOGo/LDAPUserManager.m b/SoObjects/SOGo/LDAPUserManager.m index 6cfe52c07..66b193564 100644 --- a/SoObjects/SOGo/LDAPUserManager.m +++ b/SoObjects/SOGo/LDAPUserManager.m @@ -179,6 +179,7 @@ static NSString *defaultMailDomain = nil; { NSDictionary *contactInfos; +// NSLog (@"getCNForUID: %@", uid); contactInfos = [self contactInfosForUserWithUIDorEmail: uid]; return [contactInfos objectForKey: @"cn"]; @@ -188,6 +189,7 @@ static NSString *defaultMailDomain = nil; { NSDictionary *contactInfos; +// NSLog (@"getEmailForUID: %@", uid); contactInfos = [self contactInfosForUserWithUIDorEmail: uid]; return [contactInfos objectForKey: @"c_email"]; @@ -197,6 +199,7 @@ static NSString *defaultMailDomain = nil; { NSDictionary *contactInfos; +// NSLog (@"getUIDForEmail: %@", email); contactInfos = [self contactInfosForUserWithUIDorEmail: email]; return [contactInfos objectForKey: @"c_uid"]; @@ -342,29 +345,39 @@ static NSString *defaultMailDomain = nil; NSDate *cleanupDate; BOOL newUser; - contactInfos = [NSMutableDictionary dictionary]; - currentUser = [users objectForKey: uid]; - if (!([currentUser objectForKey: @"emails"] - && [currentUser objectForKey: @"cn"])) + if ([uid length] > 0) { - if (!currentUser) + contactInfos = [NSMutableDictionary dictionary]; + currentUser = [users objectForKey: uid]; + if (!([currentUser objectForKey: @"emails"] + && [currentUser objectForKey: @"cn"])) { - newUser = YES; - currentUser = [NSMutableDictionary dictionary]; + if (!currentUser) + { + newUser = YES; + currentUser = [NSMutableDictionary dictionary]; + } + else + newUser = NO; + [self _fillContactInfosForUser: currentUser + withUIDorEmail: uid]; + if (newUser) + { + if ([[currentUser objectForKey: @"c_uid"] length] > 0) + [self _retainUser: currentUser]; + else + currentUser = nil; + } } - else - newUser = NO; - [self _fillContactInfosForUser: currentUser - withUIDorEmail: uid]; - if (newUser) - [self _retainUser: currentUser]; - } - if (cleanupInterval) - { - cleanupDate = [[NSDate date] addTimeInterval: cleanupInterval]; - [currentUser setObject: cleanupDate forKey: @"cleanupDate"]; + if (cleanupInterval && currentUser) + { + cleanupDate = [[NSDate date] addTimeInterval: cleanupInterval]; + [currentUser setObject: cleanupDate forKey: @"cleanupDate"]; + } } + else + currentUser = nil; return currentUser; } @@ -438,7 +451,6 @@ static NSString *defaultMailDomain = nil; LDAPSource *currentSource; contacts = [NSMutableArray array]; - ldapSources = [sources objectEnumerator]; currentSource = [ldapSources nextObject]; while (currentSource)