From 00aceaf624d8e5da2a8f3df161d52599aae2ac41 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Sat, 28 Jun 2008 16:03:54 +0000 Subject: * libs/web: Switched from HTTP-Basic-Auth to Session-Auth * Updated Makefiles for better testing environment integration * Fixed libs/sgi-luci --- libs/web/luasrc/sauth.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libs/web/luasrc/sauth.lua') diff --git a/libs/web/luasrc/sauth.lua b/libs/web/luasrc/sauth.lua index 724e22d201..d838f84f69 100644 --- a/libs/web/luasrc/sauth.lua +++ b/libs/web/luasrc/sauth.lua @@ -19,7 +19,7 @@ require("luci.config") luci.config.sauth = luci.config.sauth or {} sessionpath = luci.config.sauth.sessionpath -sessiontime = luci.config.sauth.sessiontime +sessiontime = tonumber(luci.config.sauth.sessiontime) function clean() @@ -30,7 +30,7 @@ function clean() return nil end - for i, file in files do + for i, file in pairs(files) do local fname = sessionpath .. "/" .. file local stat = luci.fs.stat(fname) if stat and stat.type == "regular" and stat.atime + sessiontime < now then @@ -41,11 +41,14 @@ end function prepare() luci.fs.mkdir(sessionpath) - luci.fs.chmod(sessionpath, "a-rwx,u+rw") + luci.fs.chmod(sessionpath, "a-rwx,u+rwx") end function read(id) - cleansessions() + if not id then + return + end + clean() return luci.fs.readfile(sessionpath .. "/" .. id) end -- cgit v1.2.3