diff options
author | Mike Mason <ms13sp@gmail.com> | 2008-01-23 22:15:21 +0000 |
---|---|---|
committer | Mike Mason <ms13sp@gmail.com> | 2008-01-23 22:15:21 +0000 |
commit | 8ca88e4ba817144acf9f81a4f51b8f3836a4d6b4 (patch) | |
tree | d2b1f35d4a599552f1f3cf8f83e88844f870b7fe /lib/session.lua | |
parent | c3e3a9b829fa79ff690b97223a899534fec89ea9 (diff) | |
download | acf-core-8ca88e4ba817144acf9f81a4f51b8f3836a4d6b4.tar.bz2 acf-core-8ca88e4ba817144acf9f81a4f51b8f3836a4d6b4.tar.xz |
Adding logon-status and finally with nangel's help got this working
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@632 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib/session.lua')
-rw-r--r-- | lib/session.lua | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/session.lua b/lib/session.lua index 1c59df0..57b14d2 100644 --- a/lib/session.lua +++ b/lib/session.lua @@ -13,6 +13,7 @@ module (..., package.seeall) require "posix" +require "fs" local b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-" @@ -143,11 +144,28 @@ unlink_session = function (sessionpath, session) return nil end session = sessionpath .. "/session." .. s - os.remove (session) - return nil + local statos = os.remove (session) + return statos end +--need to see if this is a "real"-user session or just a temp one. +check_session = function (sessionpath, session) + local fullpath = sessionpath .. "/session." .. session + if type(session) ~= "string" then return nil end + local s = string.gsub (session, "[^" .. b64 .. "]", "") + if s ~= session then + return nil + end + check_size = posix.stat(fullpath,"size") + if check_size == 0 then + return "Null Session" + else + local c = fs.read_file(fullpath) + return c + end + +end -- Record an invalid login event -- ID would typically be an ip address or username -- the format is lockevent.id.datetime.processid |