summaryrefslogtreecommitdiffstats
path: root/daemons
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2012-05-17 13:17:21 -0400
committerMartin Kosek <mkosek@redhat.com>2012-05-18 09:03:22 +0200
commit560f2ce8bd0525189e45ff7d8f8d4df11f9c20ff (patch)
treede640799d78eafb243d9daf4cf6ae7aad8bef3a3 /daemons
parent46c6ff69ac2a4fa39e99f954bd9cfbd78bfd70c9 (diff)
downloadfreeipa-560f2ce8bd0525189e45ff7d8f8d4df11f9c20ff.tar.gz
freeipa-560f2ce8bd0525189e45ff7d8f8d4df11f9c20ff.tar.xz
freeipa-560f2ce8bd0525189e45ff7d8f8d4df11f9c20ff.zip
Check for locked-out user before incrementing lastfail.
If a user become locked due to too many failed logins and then were unlocked by an administrator, the account would not lock again. This was caused by two things: - We were incrementing the fail counter before checking to see if the account was already locked out. - The current fail count wasn't taken into consideration when deciding if the account is locked. The sequence was this: 1. Unlocked account, set failcount to 0 2. Failed login, increment failcount 3. Within lastfailed + lockout_duration, still locked. This skips update the last_failed date. So I reversed 2 and 3 and check to see if the fail count exceeds policy. https://fedorahosted.org/freeipa/ticket/2765
Diffstat (limited to 'daemons')
-rw-r--r--daemons/ipa-kdb/ipa_kdb_audit_as.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/daemons/ipa-kdb/ipa_kdb_audit_as.c b/daemons/ipa-kdb/ipa_kdb_audit_as.c
index c71568c38..64af8b2f9 100644
--- a/daemons/ipa-kdb/ipa_kdb_audit_as.c
+++ b/daemons/ipa-kdb/ipa_kdb_audit_as.c
@@ -93,16 +93,18 @@ void ipadb_audit_as_req(krb5_context kcontext,
client->mask |= KMASK_FAIL_AUTH_COUNT;
}
+ if (client->last_failed + ied->pol->lockout_duration > authtime &&
+ (client->fail_auth_count >= ied->pol->max_fail &&
+ ied->pol->max_fail != 0)) {
+ /* client already locked, nothing more to do */
+ break;
+ }
if (ied->pol->max_fail == 0 ||
client->fail_auth_count < ied->pol->max_fail) {
/* let's increase the fail counter */
client->fail_auth_count++;
client->mask |= KMASK_FAIL_AUTH_COUNT;
}
- if (client->last_failed + ied->pol->lockout_duration > authtime) {
- /* client already locked, nothing more to do */
- break;
- }
client->last_failed = authtime;
client->mask |= KMASK_LAST_FAILED;
break;