From 39ca0e42d28efe74e2046fc282eed9b7bfe15cb0 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Fri, 29 Oct 2010 10:16:15 +0000 Subject: Fix two bugs related to session lockout. Parse the lockevent filename, was seeing user locked out because username was substring of another username. All active sessions were killed whenever anyone got locked out because of error with username processing. --- lib/session.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/session.lua') diff --git a/lib/session.lua b/lib/session.lua index f55f2bf..146c0e9 100644 --- a/lib/session.lua +++ b/lib/session.lua @@ -208,9 +208,10 @@ count_events = function (sessionpath, id_user, ipaddr, minutes, limit) return false else local count = 0 - for a,b in pairs(t) do + for a,b in pairs(t) do if posix.stat(b,"mtime") > minutes_ago then - if string.match(b,id_user) or string.match(b,ipaddr) then + local user, ip = string.match(b, "/lockevent%.([^.]*)%.([^.]*)%.") + if id_user == user or ipaddr == ip then count = count + 1 end end -- cgit v1.2.3