42 lines
983 B
Text
42 lines
983 B
Text
local _IDENTIFIER = "ac30527de6170b7d545bdc152f76237276537f2cf8eb7fe5bdb2a7627f48cec1"
|
|
|
|
function getSU()
|
|
if fs.exists("/etc/passwd/.shadow/".._G["_activeUser"]..".usr") then
|
|
local ud = dofile("/etc/passwd/.shadow/".._G["_activeUser"]..".usr")
|
|
return ud.SU
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
|
|
function getID()
|
|
return _IDENTIFIER
|
|
end
|
|
|
|
function getActiveUserStatus()
|
|
if fs.exists("/etc/passwd/.shadow/".._G["_activeUser"]..".usr") then
|
|
local ud = dofile("/etc/passwd/.shadow/".._G["_activeUser"]..".usr")
|
|
if ud.ID == getID() then
|
|
return true
|
|
end
|
|
return false
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
|
|
function passbyte(username, str)
|
|
passTable = luaex.argsToTable(luaex.stringToByteArray(str))
|
|
if config.save(passTable, "/etc/passwd/"..username..".dat") then
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
|
|
function unpassbyte(username)
|
|
passTable = config.load("/etc/passwd/"..username..".dat")
|
|
if passTable ~= nil then
|
|
return luaex.stringFromByteArray(unpack(passTable))
|
|
end
|
|
end
|