mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-19 21:35:58 +00:00
merge of '6cfba12fb94b5901b149e029c710bdc53dd3d3f1'
and '8fac7610f102d5ac190598b120634569a69ec344' Monotone-Parent: 6cfba12fb94b5901b149e029c710bdc53dd3d3f1 Monotone-Parent: 8fac7610f102d5ac190598b120634569a69ec344 Monotone-Revision: 6975183caaa2bc330ccc07a7a79c21531387d774 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-05-10T15:00:18 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
15
ChangeLog
15
ChangeLog
@@ -1,3 +1,18 @@
|
||||
2007-05-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* 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.
|
||||
([LDAPSource -fetchContactsMatching:match]): check that match is
|
||||
not empty.
|
||||
([LDAPSource -lookupContactEntry:entryID]): check that entryID is
|
||||
not empty.
|
||||
([LDAPSource -lookupContactEntryWithUIDorEmail:uid]): check that
|
||||
uid is not empty.
|
||||
|
||||
2007-05-09 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoUser.m ([SOGoUser -primaryEmail]): new name
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
NSString *name;
|
||||
NSDictionary *ldifEntry;
|
||||
NGVCard *vcard;
|
||||
id container;
|
||||
}
|
||||
|
||||
+ (SOGoContactLDIFEntry *) contactEntryWithName: (NSString *) newName
|
||||
|
||||
@@ -215,18 +215,23 @@ static NSArray *commonSearchFields;
|
||||
NSString *userDN;
|
||||
NGLdapConnection *bindConnection;
|
||||
|
||||
bindConnection = [[NGLdapConnection alloc] initWithHostName: hostname
|
||||
port: port];
|
||||
userDN = [NSString stringWithFormat: @"%@=%@,%@",
|
||||
IDField, loginToCheck, baseDN];
|
||||
NS_DURING
|
||||
didBind = [bindConnection bindWithMethod: @"simple" binddn: userDN
|
||||
credentials: passwordToCheck];
|
||||
NS_HANDLER
|
||||
didBind = NO;
|
||||
NS_ENDHANDLER
|
||||
if ([loginToCheck length] > 0)
|
||||
{
|
||||
bindConnection = [[NGLdapConnection alloc] initWithHostName: hostname
|
||||
port: port];
|
||||
userDN = [NSString stringWithFormat: @"%@=%@,%@",
|
||||
IDField, loginToCheck, baseDN];
|
||||
NS_DURING
|
||||
didBind = [bindConnection bindWithMethod: @"simple" binddn: userDN
|
||||
credentials: passwordToCheck];
|
||||
NS_HANDLER
|
||||
didBind = NO;
|
||||
NS_ENDHANDLER
|
||||
|
||||
[bindConnection release];
|
||||
[bindConnection release];
|
||||
}
|
||||
else
|
||||
didBind = NO;
|
||||
|
||||
return didBind;
|
||||
}
|
||||
@@ -237,7 +242,7 @@ static NSArray *commonSearchFields;
|
||||
NSString *qs;
|
||||
EOQualifier *qualifier;
|
||||
|
||||
if (filter && [filter length] > 0)
|
||||
if ([filter length] > 0)
|
||||
{
|
||||
if ([filter isEqualToString: @"."])
|
||||
qs = @"(cn='*')";
|
||||
@@ -355,19 +360,22 @@ static NSArray *commonSearchFields;
|
||||
|
||||
contacts = [NSMutableArray array];
|
||||
|
||||
if (!ldapConnection)
|
||||
[self _initLDAPConnection];
|
||||
entries = [ldapConnection deepSearchAtBaseDN: baseDN
|
||||
qualifier: [self _qualifierForFilter: match]
|
||||
attributes: [self _searchAttributes]];
|
||||
if (entries)
|
||||
if ([match length] > 0)
|
||||
{
|
||||
currentEntry = [entries nextObject];
|
||||
while (currentEntry)
|
||||
if (!ldapConnection)
|
||||
[self _initLDAPConnection];
|
||||
entries = [ldapConnection deepSearchAtBaseDN: baseDN
|
||||
qualifier: [self _qualifierForFilter: match]
|
||||
attributes: [self _searchAttributes]];
|
||||
if (entries)
|
||||
{
|
||||
[contacts addObject:
|
||||
[self _convertLDAPEntryToContact: currentEntry]];
|
||||
currentEntry = [entries nextObject];
|
||||
while (currentEntry)
|
||||
{
|
||||
[contacts addObject:
|
||||
[self _convertLDAPEntryToContact: currentEntry]];
|
||||
currentEntry = [entries nextObject];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,16 +387,19 @@ static NSArray *commonSearchFields;
|
||||
NSDictionary *contactEntry;
|
||||
NGLdapEntry *ldapEntry;
|
||||
|
||||
if (!ldapConnection)
|
||||
[self _initLDAPConnection];
|
||||
ldapEntry
|
||||
= [ldapConnection entryAtDN: [NSString stringWithFormat: @"%@=%@,%@",
|
||||
IDField, entryID, baseDN]
|
||||
attributes: [self _searchAttributes]];
|
||||
if (ldapEntry)
|
||||
contactEntry = [self _convertLDAPEntryToContact: ldapEntry];
|
||||
else
|
||||
contactEntry = nil;
|
||||
contactEntry = nil;
|
||||
|
||||
if ([entryID length] > 0)
|
||||
{
|
||||
if (!ldapConnection)
|
||||
[self _initLDAPConnection];
|
||||
ldapEntry
|
||||
= [ldapConnection entryAtDN: [NSString stringWithFormat: @"%@=%@,%@",
|
||||
IDField, entryID, baseDN]
|
||||
attributes: [self _searchAttributes]];
|
||||
if (ldapEntry)
|
||||
contactEntry = [self _convertLDAPEntryToContact: ldapEntry];
|
||||
}
|
||||
|
||||
return contactEntry;
|
||||
}
|
||||
@@ -400,17 +411,20 @@ static NSArray *commonSearchFields;
|
||||
NSEnumerator *entries;
|
||||
EOQualifier *qualifier;
|
||||
|
||||
if (!ldapConnection)
|
||||
[self _initLDAPConnection];
|
||||
qualifier = [self _qualifierForUIDFilter: uid];
|
||||
entries = [ldapConnection deepSearchAtBaseDN: baseDN
|
||||
qualifier: qualifier
|
||||
attributes: [self _searchAttributes]];
|
||||
ldapEntry = [entries nextObject];
|
||||
if (ldapEntry)
|
||||
contactEntry = [self _convertLDAPEntryToContact: ldapEntry];
|
||||
else
|
||||
contactEntry = nil;
|
||||
contactEntry = nil;
|
||||
|
||||
if ([uid length] > 0)
|
||||
{
|
||||
if (!ldapConnection)
|
||||
[self _initLDAPConnection];
|
||||
qualifier = [self _qualifierForUIDFilter: uid];
|
||||
entries = [ldapConnection deepSearchAtBaseDN: baseDN
|
||||
qualifier: qualifier
|
||||
attributes: [self _searchAttributes]];
|
||||
ldapEntry = [entries nextObject];
|
||||
if (ldapEntry)
|
||||
contactEntry = [self _convertLDAPEntryToContact: ldapEntry];
|
||||
}
|
||||
|
||||
return contactEntry;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <NGObjWeb/NSException+HTTP.h>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSCalendarDate.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
#import <NGObjWeb/WOResponse.h>
|
||||
|
||||
Reference in New Issue
Block a user