diff --git a/configs/headless.cfg b/configs/headless.cfg index 6c40f8b..b7c3bc8 100755 --- a/configs/headless.cfg +++ b/configs/headless.cfg @@ -14,7 +14,6 @@ modules/util/motd.lua modules/lib/readline.lua modules/lib/shutil.lua modules/lib/sha256.lua -modules/lib/userlib.lua modules/net/net-ext.lua modules/applications/login.lua fwrap luash exec/luash.lua diff --git a/configs/minimal.cfg b/configs/minimal.cfg index 45b8743..d83bb22 100755 --- a/configs/minimal.cfg +++ b/configs/minimal.cfg @@ -16,7 +16,6 @@ modules/util/motd.lua modules/lib/readline.lua modules/lib/shutil.lua modules/lib/sha256.lua -modules/lib/userlib.lua modules/net/net-ext.lua modules/applications/login.lua fwrap luash exec/luash.lua diff --git a/modules/lib/userlib.lua b/modules/lib/userlib.lua deleted file mode 100644 index 0197821..0000000 --- a/modules/lib/userlib.lua +++ /dev/null @@ -1,58 +0,0 @@ -do - _G.userlib = {} - local ut = {} - function userlib.users() - local t = {} - for k,v in pairs(ut) do - t[#t+1] = k - end - return t - end - function userlib.verify(username,pass) - if ut[username] then - if sha.sha256(pass..ut[username][2]) == ut[username][1] then - return true - end - end - return false - end - function userlib.gensalt(len) - local S = "" - for i = 1, len do - S=S..string.char(math.random(32,126)) - end - return S - end - function userlib.setuser(username,hpass,salt,...) - ut[username] = {hpass, salt,...} - end - function userlib.deluser(username) - ut[username] = nil - end - function userlib.readpwd(path) - local f=io.open(path,"rb") - if not f then return false end - local C=f:read("*a") - for line in C:gmatch("[^\n]+") do - local username,hpass,salt = line:match("(.+)\t(.+)\t(.+)") - log(username,hpass,salt) - if username and hpass and salt then - ut[username] = {hpass,salt} - end - end - end - function userlib.writepwd() - local S="" - for k,v in pairs(ut) do - S=S..k.."\t"..v[1].."\t"..v[2].."\n" - end - return S - end - function userlib.write(path) - local f=io.open(path,"wb") - if not f then return false end - f:write(userlib.writepwd()) - f:close() - end - spawn("load users",function() userlib.readpwd("/boot/sys/users.dat") end) -end