mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-01 13:16:23 +00:00
Avoid cache entries with uid@domain@domain prefix
Depend of the current workflow these paths are reached with username as uid and sometimes as uid@domain. So in multidomain environments only append @domain when needed.
This commit is contained in:
@@ -492,23 +492,17 @@ static Class NSNullK;
|
||||
NSString *dictPassword, *username, *jsonUser;
|
||||
SOGoSystemDefaults *dd;
|
||||
BOOL checkOK;
|
||||
|
||||
// We check for cached passwords. If the entry is cached, we
|
||||
// check this immediately. If not, we'll go directly at the
|
||||
// authentication source and try to validate there, then cache it.
|
||||
if (*_domain != nil)
|
||||
|
||||
if (*_domain && [_login rangeOfString: @"@"].location == NSNotFound)
|
||||
username = [NSString stringWithFormat: @"%@@%@", _login, *_domain];
|
||||
else
|
||||
username = _login;
|
||||
|
||||
failedCount = [[SOGoCache sharedCache] failedCountForLogin: username];
|
||||
dd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||
|
||||
//
|
||||
// We check the fail count per user in memcache (per server). If the
|
||||
// fail count reaches X in Y minutes, we deny immediately the
|
||||
// authentications for Z minutes
|
||||
//
|
||||
failedCount = [[SOGoCache sharedCache] failedCountForLogin: username];
|
||||
dd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||
if (failedCount)
|
||||
{
|
||||
unsigned int current_time, start_time, delta, block_time;
|
||||
@@ -534,7 +528,9 @@ static Class NSNullK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// We check for cached passwords. If the entry is cached, we
|
||||
// check this immediately. If not, we'll go directly at the
|
||||
// authentication source and try to validate there, then cache it.
|
||||
jsonUser = [[SOGoCache sharedCache] userAttributesForLogin: username];
|
||||
currentUser = [jsonUser objectFromJSONString];
|
||||
dictPassword = [currentUser objectForKey: @"password"];
|
||||
|
||||
Reference in New Issue
Block a user