can only r/w attributes if you have r/w permissions in the attributes
This commit is contained in:
parent
8458bf5fc7
commit
4b89084432
@ -3,7 +3,23 @@ do
|
||||
local dfsattr = {read = "*", write = "*"}
|
||||
local fsattr = {}
|
||||
local fT,hT = {},{["_c"]=0}
|
||||
local function parseacl(acl)
|
||||
acl = acl or ""
|
||||
local tacl = {}
|
||||
if acl == "*" then
|
||||
setmetatable(tacl,{__index = function() return true end})
|
||||
else
|
||||
for n in acl:gmatch("[^,]+") do
|
||||
tacl[n] = true
|
||||
log(n)
|
||||
end
|
||||
end
|
||||
return tacl
|
||||
end
|
||||
local function getattr(fn,k)
|
||||
if os.getuid() ~= "superuser" then
|
||||
if not parseacl(fsattr[fn].read or "")[os.getuid()] then return false end
|
||||
end
|
||||
if fsattr[fn] then
|
||||
return fsattr[fn][k]
|
||||
else
|
||||
@ -12,6 +28,10 @@ do
|
||||
end
|
||||
local function setattr(fn,k,v)
|
||||
if k:find("\t") or v:find("\t") then return false end
|
||||
log(parseacl(getattr(fn,"write"))[os.getuid()])
|
||||
if os.getuid() ~= "superuser" then
|
||||
if not parseacl(getattr(fn,"write"))[os.getuid()] then return false end
|
||||
end
|
||||
if not fsattr[fn] then
|
||||
fsattr[fn] = {}
|
||||
setmetatable(fsattr[fn],{__index=dfsattr})
|
||||
|
Loading…
Reference in New Issue
Block a user