44 lines
No EOL
1.3 KiB
Bash
44 lines
No EOL
1.3 KiB
Bash
if kernel.isBooting then
|
|
kernel.isBooting = false
|
|
while true do
|
|
write("Login: ")
|
|
local input = read()
|
|
if fs.exists("/etc/passwd/"..input..".dat") and not fs.isDir("/etc/passwd/"..input..".dat") then
|
|
local pass = security.unpassbyte(input)
|
|
while true do
|
|
if kernel.secureInput("Password: ", pass) then
|
|
os.pullEvent = function()
|
|
local eventData = { os.pullEventRaw( _sFilter ) }
|
|
if eventData[1] == "terminate" then
|
|
error( "Terminated", 0 )
|
|
end
|
|
return unpack( eventData )
|
|
end
|
|
rawset(_G, "_activeUser", input)
|
|
if fs.exists("/home/".._G["_activeUser"].."/autorun") then
|
|
shell.run("/home/".._G["_activeUser"].."/autorun")
|
|
end
|
|
log.writeAuth("User "..input.." logged in")
|
|
if input == "root" then
|
|
log.writeSecurity("root logged in")
|
|
end
|
|
term.setTextColour( colors.yellow )
|
|
print( kernel.getRelease() )
|
|
term.setTextColor( colors.white )
|
|
shell.run("/bin/sh")
|
|
if security.getSU() then
|
|
kerneldraw.printAppWarning("kernel", "Exiting into top-level shell")
|
|
log.writeMessage("Exiting into top-level shell")
|
|
break
|
|
end
|
|
kernel.shutdown(false)
|
|
end
|
|
end
|
|
end
|
|
if input == "root" and security.getSU() then
|
|
break
|
|
end
|
|
end
|
|
else
|
|
kernel.panic("/sbin/login can only be ran at startup")
|
|
end |