-- auth-client api's
-- dhcp
function useradd(username , password, admin) os.run({}, "/etc/auth-client/adduser.sys", username , password , admin) end
function userdel(username) os.run({}, "/etc/auth-client/deluser.sys", username) end
function setpass(username , password) os.run({}, "/etc/auth-client/setpass.sys", username , password) end
function setowner(systemname , groupname) os.run({}, "/etc/auth-client/setowner.sys", systemname , groupname) end
function delowner() os.run({}, "/etc/auth-client/delowner.sys") end
function groupadd(groupname) os.run({}, "/etc/auth-client/addgroup.sys" , groupname) end
function groupdel(groupname) os.run({}, "/etc/auth-client/delgroup.sys" , groupname) end
function joingroup(groupname, username) os.run({}, "/etc/auth-client/gadduser.sys", groupname, username) end
function leavegroup(groupname, username) os.run({}, "/etc/auth-client/gdeluser.sys", groupname, username) end
function checkgroup(groupname, username) os.run({}, "/etc/auth-client/checkgroup.sys", groupname, username) end
function checkowner() os.run({}, "/etc/auth-client/checkowner.sys") end
-- auth mask function
function mask(username, password)
	if _G.mska == true then
		minux.debug("already masked")
	else
		local oldlogin = _G.login
		local oldpass = _G.masterpass
		minux.debug("mask:masking as user:"..username , "auth")
		minux.login(username, password)
		if _G.validlogin ~= true then
			_G.login = oldlogin
			_G.masterpass = oldpass
			minux.debug("denied", "auth")
		else
			_G.mskl = oldlogin
			_G.mskp = oldpass
			_G.mska = true
		end
		oldlogin = nil
		oldpass = nil
	end
end
-- auth unmask
function unmask()
	if _G.mska == true then
		minux.debug("mask:unmasking","auth")
		_G.login = _G.mskl
		_G.masterpass = _G.mskl
		_G.mska = nil
		_G.mskl = nil
		_G.mskp = nil
	else
		minux.debug("not masked", "auth")
	end
end