Moved DN cache to SOGoCache

pull/17/merge
Ludovic Marcotte 2014-02-04 21:03:11 -05:00
parent 9885211a5b
commit 3950e9d4c3
5 changed files with 39 additions and 19 deletions

1
NEWS
View File

@ -26,6 +26,7 @@ Enhancements
- visually identify users with no freebusy information in autocompletion widget of attendees editor (#2565)
- respect occurences of recurrent events when deleting selected events (#1950)
- improved confirmation dialog box when deleting events and tasks
- moved the DN cache to SOGoCache - avoiding sogod restarts after RDN operations
Bug fixes
- don't load 'background' attribute (#2437)

View File

@ -1,6 +1,6 @@
/* LDAPSource.h - this file is part of SOGo
*
* Copyright (C) 2007-2013 Inverse inc.
* Copyright (C) 2007-2014 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -79,8 +79,6 @@
BOOL passwordPolicy;
NSMutableDictionary *_dnCache;
/* resources handling */
NSString *kindField;
NSString *multipleBookingsField;

View File

@ -1,6 +1,6 @@
/* LDAPSource.m - this file is part of SOGo
*
* Copyright (C) 2007-2013 Inverse inc.
* Copyright (C) 2007-2014 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -37,6 +37,7 @@
#import "NSArray+Utilities.h"
#import "NSString+Utilities.h"
#import "NSString+Crypto.h"
#import "SOGoCache.h"
#import "SOGoDomainDefaults.h"
#import "SOGoSystemDefaults.h"
@ -118,7 +119,6 @@ static Class NSStringK;
MSExchangeHostname = nil;
_dnCache = [[NSMutableDictionary alloc] init];
modifiers = nil;
}
@ -155,7 +155,6 @@ static Class NSStringK;
[_scope release];
[searchAttributes release];
[domain release];
[_dnCache release];
[kindField release];
[multipleBookingsField release];
[MSExchangeHostname release];
@ -528,7 +527,7 @@ static Class NSStringK;
if (queryTimeout > 0)
[bindConnection setQueryTimeLimit: queryTimeout];
userDN = [_dnCache objectForKey: _login];
userDN = [[SOGoCache sharedCache] distinguishedNameForLogin: _login];
if (!userDN)
{
@ -551,8 +550,9 @@ static Class NSStringK;
if (userDN)
{
// We cache the _login <-> userDN entry to speed up things
[_dnCache setObject: userDN forKey: _login];
[[SOGoCache sharedCache] setDistinguishedName: userDN
forLogin: _login];
if (!passwordPolicy)
didBind = [bindConnection bindWithMethod: @"simple"
binddn: userDN
@ -1238,7 +1238,7 @@ static Class NSStringK;
- (NSString *) lookupDNByLogin: (NSString *) theLogin
{
return [_dnCache objectForKey: theLogin];
return [[SOGoCache sharedCache] distinguishedNameForLogin: theLogin];
}
- (NGLdapEntry *) _lookupGroupEntryByAttributes: (NSArray *) theAttributes

View File

@ -1,9 +1,6 @@
/* SOGoCache.h - this file is part of SOGo
*
* Copyright (C) 2008-2013 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Ludovic Marcotte <lmarcotte@inverse.ca>
* Copyright (C) 2008-2014 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -109,6 +106,11 @@
- (NSDictionary *) messageSubmissionsCountForLogin: (NSString *) theLogin;
- (NSString *) distinguishedNameForLogin: (NSString *) theLogin;
- (void) setDistinguishedName: (NSString *) theDN
forLogin: (NSString *) theLogin;
//
// CAS support
//
@ -124,7 +126,9 @@
- (void) removeCASSessionWithTicket: (NSString *) ticket;
//
// SAML2 support
//
- (NSDictionary *) saml2LoginDumpsForIdentifier: (NSString *) identifier;
- (void) setSaml2LoginDumps: (NSDictionary *) dump
forIdentifier: (NSString *) identifier;

View File

@ -1,9 +1,6 @@
/* SOGoCache.m - this file is part of SOGo
*
* Copyright (C) 2008-2013 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Ludovic Marcotte <lmarcotte@inverse.ca>
* Copyright (C) 2008-2014 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -34,6 +31,9 @@
* <uid>+defaults value = NSDictionary instance > user's defaults
* <uid>+settings value = NSDictionary instance > user's settings
* <uid>+attributes value = NSMutableDictionary instance > user's LDAP attributes
* <uid>+failedlogins value =
* <uid>+messagesubmissions value =
* <uid>+dn value = NSString instance > cached user's DN
* <object path>+acl value = NSDictionary instance > ACLs on an object at specified path
* <groupname>+<domain> value = NSString instance (array components separated by ",") or group member logins for a specific group in domain
* cas-id:< > value =
@ -435,7 +435,9 @@ static memcached_st *handle = NULL;
}
//
//
// Try to hit the local cache. If it misses, it'll
// then try memcached. If it hits memcached, it'll
// populate the local cache.
//
- (NSString *) _valuesOfType: (NSString *) theType
forKey: (NSString *) theKey
@ -604,6 +606,21 @@ static memcached_st *handle = NULL;
return d;
}
//
// DN caching
//
- (NSString *) distinguishedNameForLogin: (NSString *) theLogin
{
return [self _valuesOfType: @"dn" forKey: theLogin];
}
- (void) setDistinguishedName: (NSString *) theDN
forLogin: (NSString *) theLogin
{
[self _cacheValues: theDN
ofType: @"dn"
forKey: theLogin];
}
//
// CAS session support