projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
92fc9cd
)
* libs/web: Fixed secure caching with setuid/setgid handling
author
Steven Barth
<steven@midlink.org>
Sat, 7 Jun 2008 07:18:40 +0000
(07:18 +0000)
committer
Steven Barth
<steven@midlink.org>
Sat, 7 Jun 2008 07:18:40 +0000
(07:18 +0000)
libs/web/luasrc/template.lua
patch
|
blob
|
history
diff --git
a/libs/web/luasrc/template.lua
b/libs/web/luasrc/template.lua
index
a24c7ed
..
cc534ab
100644
(file)
--- a/
libs/web/luasrc/template.lua
+++ b/
libs/web/luasrc/template.lua
@@
-35,9
+35,6
@@
luci.config.template = luci.config.template or {}
viewdir = luci.config.template.viewdir or luci.sys.libpath() .. "/view"
compiledir = luci.config.template.compiledir or luci.sys.libpath() .. "/view"
viewdir = luci.config.template.viewdir or luci.sys.libpath() .. "/view"
compiledir = luci.config.template.compiledir or luci.sys.libpath() .. "/view"
--- Enforce cache security
-compiledir = compiledir .. "/" .. luci.sys.process.info("uid")
-
-- Compile modes:
-- none: Never compile, only use precompiled data from files
-- Compile modes:
-- none: Never compile, only use precompiled data from files
@@
-148,18
+145,21
@@
function Template.__init__(self, name)
return
end
return
end
+ -- Enforce cache security
+ local cdir = compiledir .. "/" .. luci.sys.process.info("uid")
+
-- Compile and build
local sourcefile = viewdir .. "/" .. name .. ".htm"
-- Compile and build
local sourcefile = viewdir .. "/" .. name .. ".htm"
- local compiledfile = c
ompile
dir .. "/" .. luci.http.urlencode(name) .. ".lua"
+ local compiledfile = cdir .. "/" .. luci.http.urlencode(name) .. ".lua"
local err
if compiler_mode == "file" then
local tplmt = luci.fs.mtime(sourcefile)
local commt = luci.fs.mtime(compiledfile)
local err
if compiler_mode == "file" then
local tplmt = luci.fs.mtime(sourcefile)
local commt = luci.fs.mtime(compiledfile)
- if not luci.fs.mtime(c
ompile
dir) then
- luci.fs.mkdir(c
ompile
dir, true)
- luci.fs.chmod(luci.fs.dirname(c
ompile
dir), "a+rxw")
+ if not luci.fs.mtime(cdir) then
+ luci.fs.mkdir(cdir, true)
+ luci.fs.chmod(luci.fs.dirname(cdir), "a+rxw")
end
-- Build if there is no compiled file or if compiled file is outdated
end
-- Build if there is no compiled file or if compiled file is outdated