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 dfsattr = {read = "*", write = "*"}
|
||||||
local fsattr = {}
|
local fsattr = {}
|
||||||
local fT,hT = {},{["_c"]=0}
|
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)
|
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
|
if fsattr[fn] then
|
||||||
return fsattr[fn][k]
|
return fsattr[fn][k]
|
||||||
else
|
else
|
||||||
@ -12,6 +28,10 @@ do
|
|||||||
end
|
end
|
||||||
local function setattr(fn,k,v)
|
local function setattr(fn,k,v)
|
||||||
if k:find("\t") or v:find("\t") then return false end
|
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
|
if not fsattr[fn] then
|
||||||
fsattr[fn] = {}
|
fsattr[fn] = {}
|
||||||
setmetatable(fsattr[fn],{__index=dfsattr})
|
setmetatable(fsattr[fn],{__index=dfsattr})
|
||||||
|
Loading…
Reference in New Issue
Block a user