[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LUA 4.x - filesystem access limit?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 24 Sep 2003 08:52:00 -0300
> Im using lua 4 in my server appz and I would like to limit filesystem
> access to a scope of certain directory only (i.e. the server appz root
> directory). Right now anybody can access whole filesystem tree from
> scripts.
The "standard" technique is to redefine the open functions. Something
like the following:
-- redefine `readfrom'
function readfrom (name)
if not isOk(name) then
error("cannot open file " .. name)
end
return %readfrom(name) -- call the original `readfrom'
end
... -- the same for writeto, etc.
-- Roberto