fix astro's syscall redefiniton so files use it

This commit is contained in:
2026-02-21 14:12:05 -06:00
parent d026cfbb03
commit dd2437d4af
9 changed files with 29 additions and 29 deletions

View File

@@ -3,7 +3,7 @@ local args = {...}
local uid local uid
if args[1] then if args[1] then
uid = syscall.auth_getuid(args[1]) uid = syscall.getuid(args[1])
if not uid then if not uid then
print("id: user '" .. args[1] .. "' does not exist") print("id: user '" .. args[1] .. "' does not exist")
syscall.exit(1); return syscall.exit(1); return
@@ -12,7 +12,7 @@ else
uid = syscall.getuid() uid = syscall.getuid()
end end
local pwent = syscall.auth_getpasswd(uid) local pwent = syscall.getpasswd(uid)
local name = (pwent and pwent.username) or tostring(uid) local name = (pwent and pwent.username) or tostring(uid)
local gid = (pwent and pwent.gid) or uid local gid = (pwent and pwent.gid) or uid

View File

@@ -54,7 +54,7 @@ local function firstBoot()
syscall.write(1, "Password too short (minimum 6 characters).\n\n") syscall.write(1, "Password too short (minimum 6 characters).\n\n")
syscall.devctl(1, "sfgc", 1) syscall.devctl(1, "sfgc", 1)
else else
local ok, err = syscall.auth_setpassword(0, pw1) local ok, err = syscall.setpassword(0, pw1)
if ok then if ok then
syscall.devctl(1, "sfgc", 3) syscall.devctl(1, "sfgc", 3)
syscall.write(1, "Root password set.\n\n") syscall.write(1, "Root password set.\n\n")
@@ -124,10 +124,10 @@ local function doLogin()
syscall.write(1, "Password: ") syscall.write(1, "Password: ")
local password = readLine("*") local password = readLine("*")
local ok, err = syscall.auth_login(username, password) local ok, err = syscall.login(username, password)
if ok then if ok then
local uid = syscall.auth_getuid(username) local uid = syscall.getuid(username)
local pwent = uid and syscall.auth_getpasswd(uid) local pwent = uid and syscall.getpasswd(uid)
local shell = (pwent and pwent.shell) or "/bin/hysh" local shell = (pwent and pwent.shell) or "/bin/hysh"
local homedir = (pwent and pwent.homedir) or "/" local homedir = (pwent and pwent.homedir) or "/"

View File

@@ -1,5 +1,5 @@
--:Minify:-- --:Minify:--
local users = syscall.auth_listusers() local users = syscall.listusers()
if not users or #users == 0 then if not users or #users == 0 then
print("No users found.") print("No users found.")
return return

View File

@@ -9,7 +9,7 @@ local currentUid = syscall.getuid()
local targetUid local targetUid
if targetName then if targetName then
targetUid = syscall.auth_getuid(targetName) targetUid = syscall.getuid(targetName)
if not targetUid then if not targetUid then
print("passwd: user '" .. targetName .. "' does not exist") print("passwd: user '" .. targetName .. "' does not exist")
syscall.exit(1); return syscall.exit(1); return
@@ -36,7 +36,7 @@ if currentUid ~= 0 then
if #cur > 0 then cur=cur:sub(1,-2); syscall.write(1,"\b \b") end if #cur > 0 then cur=cur:sub(1,-2); syscall.write(1,"\b \b") end
else cur=cur..ch; syscall.write(1,"*") end else cur=cur..ch; syscall.write(1,"*") end
end end
local ok, err = syscall.auth_elevate(targetName, cur) local ok, err = syscall.elevate(targetName, cur)
if not ok then if not ok then
sleep(1) sleep(1)
print("passwd: authentication failure") print("passwd: authentication failure")
@@ -71,7 +71,7 @@ if pw1 ~= pw2 then
syscall.exit(1); return syscall.exit(1); return
end end
local ok, err = syscall.auth_setpassword(targetUid, pw1) local ok, err = syscall.setpassword(targetUid, pw1)
if not ok then if not ok then
print("passwd: " .. tostring(err)) print("passwd: " .. tostring(err))
syscall.exit(1); return syscall.exit(1); return

View File

@@ -5,7 +5,7 @@ local targetUser = ({ ... })[1] or "root"
local currentUid = syscall.getuid() local currentUid = syscall.getuid()
local currentUser = syscall.getUsername(currentUid) or tostring(currentUid) local currentUser = syscall.getUsername(currentUid) or tostring(currentUid)
local targetUid = syscall.auth_getuid(targetUser) local targetUid = syscall.getuid(targetUser)
if not targetUid then if not targetUid then
print("su: user '" .. targetUser .. "' does not exist") print("su: user '" .. targetUser .. "' does not exist")
syscall.exit(1) syscall.exit(1)
@@ -34,7 +34,7 @@ else
end end
end end
ok, err = syscall.auth_elevate(targetUser, pw) ok, err = syscall.elevate(targetUser, pw)
if not ok then if not ok then
sleep(1) sleep(1)
print("su: Authentication failure") print("su: Authentication failure")
@@ -47,7 +47,7 @@ if currentUid == 0 then
syscall.setuid(targetUid) syscall.setuid(targetUid)
end end
local pwent = syscall.auth_getpasswd(targetUid) local pwent = syscall.getpasswd(targetUid)
local shell = (pwent and pwent.shell) or "/bin/hysh" local shell = (pwent and pwent.shell) or "/bin/hysh"
local homedir = (pwent and pwent.homedir) or "/" local homedir = (pwent and pwent.homedir) or "/"

View File

@@ -10,7 +10,7 @@ if cmdArgs[i] == "-u" then
local uarg = cmdArgs[i] or "root" local uarg = cmdArgs[i] or "root"
local numUid = tonumber(uarg) local numUid = tonumber(uarg)
if numUid then if numUid then
local pwent = syscall.auth_getpasswd(numUid) local pwent = syscall.getpasswd(numUid)
targetUser = (pwent and pwent.username) or uarg targetUser = (pwent and pwent.username) or uarg
else else
targetUser = uarg targetUser = uarg
@@ -31,7 +31,7 @@ for j = i + 1, #cmdArgs do restArgs[#restArgs + 1] = cmdArgs[j] end
local currentUid = syscall.getuid() local currentUid = syscall.getuid()
local currentUser = syscall.getUsername(currentUid) or tostring(currentUid) local currentUser = syscall.getUsername(currentUid) or tostring(currentUid)
local targetUid = syscall.auth_getuid(targetUser) local targetUid = syscall.getuid(targetUser)
if not targetUid then if not targetUid then
print("sudo: user '" .. targetUser .. "' does not exist") print("sudo: user '" .. targetUser .. "' does not exist")
syscall.exit(1) syscall.exit(1)
@@ -55,7 +55,7 @@ if currentUid ~= 0 then
end end
end end
local ok, err = syscall.auth_elevate(currentUser, pw) local ok, err = syscall.elevate(currentUser, pw)
if not ok then if not ok then
sleep(1) sleep(1)
print("sudo: Authentication failure") print("sudo: Authentication failure")
@@ -97,7 +97,7 @@ if not program then
return return
end end
local pwent = syscall.auth_getpasswd(targetUid) local pwent = syscall.getpasswd(targetUid)
if pwent and pwent.homedir then if pwent and pwent.homedir then
syscall.setEnviron("HOME", pwent.homedir) syscall.setEnviron("HOME", pwent.homedir)
end end

View File

@@ -48,7 +48,7 @@ if not password then
end end
end end
local uid, err = syscall.auth_newuser( local uid, err = syscall.newuser(
opt.username, password, opt.gid, opt.homedir, opt.shell or "/bin/hysh" opt.username, password, opt.gid, opt.homedir, opt.shell or "/bin/hysh"
) )
if not uid then if not uid then

View File

@@ -14,15 +14,15 @@ if not username then
syscall.exit(1); return syscall.exit(1); return
end end
local uid = syscall.auth_getuid(username) local uid = syscall.getuid(username)
if not uid then if not uid then
print("userdel: user '" .. username .. "' does not exist") print("userdel: user '" .. username .. "' does not exist")
syscall.exit(1); return syscall.exit(1); return
end end
local pwent = syscall.auth_getpasswd(uid) local pwent = syscall.getpasswd(uid)
local ok, err = syscall.auth_deleteuser(uid) local ok, err = syscall.deleteuser(uid)
if not ok then if not ok then
print("userdel: " .. tostring(err)) print("userdel: " .. tostring(err))
syscall.exit(1); return syscall.exit(1); return

View File

@@ -27,7 +27,7 @@ if opt.lock and opt.unlock then
syscall.exit(1); return syscall.exit(1); return
end end
local uid = syscall.auth_getuid(opt.username) local uid = syscall.getuid(opt.username)
if not uid then if not uid then
print("usermod: user '" .. opt.username .. "' does not exist") print("usermod: user '" .. opt.username .. "' does not exist")
syscall.exit(1); return syscall.exit(1); return
@@ -38,12 +38,12 @@ local function apply(fn, ...)
if not ok then print("usermod: " .. tostring(err)); syscall.exit(1) end if not ok then print("usermod: " .. tostring(err)); syscall.exit(1) end
end end
if opt.newname then apply(syscall.auth_setusername, uid, opt.newname) end if opt.newname then apply(syscall.setusername, uid, opt.newname) end
if opt.password then apply(syscall.auth_setpassword, uid, opt.password) end if opt.password then apply(syscall.setpassword, uid, opt.password) end
if opt.gid then apply(syscall.auth_setgid, uid, opt.gid) end if opt.gid then apply(syscall.setgid, uid, opt.gid) end
if opt.homedir then apply(syscall.auth_sethomedir, uid, opt.homedir) end if opt.homedir then apply(syscall.sethomedir, uid, opt.homedir) end
if opt.shell then apply(syscall.auth_setshell, uid, opt.shell) end if opt.shell then apply(syscall.setshell, uid, opt.shell) end
if opt.lock then apply(syscall.auth_lockuser, uid) end if opt.lock then apply(syscall.lockuser, uid) end
if opt.unlock then apply(syscall.auth_unlockuser, uid) end if opt.unlock then apply(syscall.unlockuser, uid) end
print("usermod: updated user '" .. opt.username .. "'") print("usermod: updated user '" .. opt.username .. "'")