mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-21 14:43:31 +00:00
See ChangeLog
Monotone-Parent: 6daecf153c7b456921285f46297f307b36b5ceb7 Monotone-Revision: 4cbfa058c2199806b08f5a11ac5cebf02316041f Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2009-04-30T21:17:55 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -377,6 +377,21 @@ static NSLock *lock;
|
||||
return userDN;
|
||||
}
|
||||
|
||||
- (NSString *) loginForDN: (NSString *) theDN
|
||||
{
|
||||
NGLdapEntry *entry;
|
||||
|
||||
entry = [ldapConnection entryAtDN: theDN
|
||||
attributes: [NSArray arrayWithObject: IDField]];
|
||||
|
||||
if (entry)
|
||||
{
|
||||
return [[entry attributeWithName: IDField] stringValueAtIndex: 0];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL) checkLogin: (NSString *) loginToCheck
|
||||
andPassword: (NSString *) passwordToCheck
|
||||
{
|
||||
@@ -822,6 +837,61 @@ static NSLock *lock;
|
||||
return contactEntry;
|
||||
}
|
||||
|
||||
// Use the email address for now...
|
||||
- (NGLdapEntry *) lookupGroupEntry: (NSString *) theID
|
||||
{
|
||||
NGLdapEntry *ldapEntry;
|
||||
|
||||
#if defined(THREADSAFE)
|
||||
[lock lock];
|
||||
#endif
|
||||
|
||||
ldapEntry = nil;
|
||||
|
||||
if ([theID length] > 0)
|
||||
{
|
||||
if ([self _initLDAPConnection])
|
||||
{
|
||||
NSMutableArray *attributes;
|
||||
NSEnumerator *entries;
|
||||
EOQualifier *qualifier;
|
||||
NSString *s;
|
||||
|
||||
// FIXME
|
||||
s = [NSString stringWithFormat: @"(mail='%@')", theID];
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat: s];
|
||||
|
||||
// We look for additional attributes - the ones related to group membership
|
||||
attributes = [NSMutableArray arrayWithArray: [self _searchAttributes]];
|
||||
[attributes addObject: @"member"];
|
||||
[attributes addObject: @"memberOf"];
|
||||
|
||||
if ([_scope caseInsensitiveCompare: @"BASE"] == NSOrderedSame)
|
||||
entries = [ldapConnection baseSearchAtBaseDN: baseDN
|
||||
qualifier: qualifier
|
||||
attributes: attributes];
|
||||
else if ([_scope caseInsensitiveCompare: @"ONE"] == NSOrderedSame)
|
||||
entries = [ldapConnection flatSearchAtBaseDN: baseDN
|
||||
qualifier: qualifier
|
||||
attributes: attributes];
|
||||
else
|
||||
entries = [ldapConnection deepSearchAtBaseDN: baseDN
|
||||
qualifier: qualifier
|
||||
attributes: attributes];
|
||||
|
||||
ldapEntry = [entries nextObject];
|
||||
}
|
||||
|
||||
[ldapConnection autorelease];
|
||||
}
|
||||
|
||||
#if defined(THREADSAFE)
|
||||
[lock unlock];
|
||||
#endif
|
||||
|
||||
return ldapEntry;
|
||||
}
|
||||
|
||||
- (NSString *) sourceID
|
||||
{
|
||||
return sourceID;
|
||||
|
||||
Reference in New Issue
Block a user