summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc/sauth.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-06-28 16:03:54 +0000
committerSteven Barth <steven@midlink.org>2008-06-28 16:03:54 +0000
commit00aceaf624d8e5da2a8f3df161d52599aae2ac41 (patch)
treec18d8c411f8d4a02762a478348fd8a86b4f56f5a /libs/web/luasrc/sauth.lua
parent7f56bf947599b20e2cf50018e160e602d5516e5f (diff)
* libs/web: Switched from HTTP-Basic-Auth to Session-Auth
* Updated Makefiles for better testing environment integration * Fixed libs/sgi-luci
Diffstat (limited to 'libs/web/luasrc/sauth.lua')
-rw-r--r--libs/web/luasrc/sauth.lua11
1 files changed, 7 insertions, 4 deletions
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