Commit Graph

110 Commits

Author SHA1 Message Date
vasilito 1cce5020ad login: reset the console terminal to canonical mode before the shell
The username is read with the liner line editor, which puts the console
pty into raw mode (ICANON/ECHO cleared) and does not restore it. In raw
mode the pty line discipline never flushes a completed line into the
slave read buffer the way a shell's canonical read_line expects, so the
interactive shell (brush) never receives a typed command even though
getty forwards it to the pty master. Reset stdin to sane cooked settings
(ICANON|ECHO|ISIG, ICRNL, OPOST|ONLCR, VMIN=1/VTIME=0) via tcsetattr
before spawning the shell.
2026-07-18 14:33:37 +09:00
vasilito e440bf86c1 login: restore blocking mode on console fds before spawning the shell
The login name is read via the liner line editor, which puts the console
fd into non-blocking (and raw) mode and does not restore it. The shell
inherits fd 0; an interactive shell doing blocking line reads on a
non-blocking pty slave never receives forwarded input (reads return
empty), so the shell can never run a command. Clear O_NONBLOCK on
stdin/stdout/stderr in spawn_shell before spawning. Restores the login
namespace restriction (skipping it did not affect the symptom).
2026-07-18 13:05:01 +09:00
vasilito c935e2689e login: DIAGNOSTIC — spawn login shell without namespace restriction
Getty forwards console input to the pty master correctly (verified), and
login reads the username fine, but after apply_login_schemes() restricts
the namespace the interactive shell's pty-slave read never returns the
forwarded input. Temporarily skip the restriction to confirm it is the
cause. Also removes the getty forward diagnostic.
2026-07-18 12:52:51 +09:00
vasilito 25826efb9e getty: temporary diag — log input forwarded from tty to pty 2026-07-18 12:42:04 +09:00
vasilito 106b7cb4e0 login: chdir to home (file scheme) before restricting the namespace
The login shell spawn was failing/hanging because login inherits its CWD
from init, which on the live image is on the 'initfs' scheme.
apply_login_schemes() switches to a namespace with only DEFAULT_SCHEMES
(no 'initfs'), leaving that inherited CWD fd unresolvable; relibc resolves
paths through the CWD fd (AT_REDOX_CWD_FD), so the shell child's chdir +
execve then fail with ENOENT (getty respawns login in a loop) or hang.
chdir into the user's home (on the always-present 'file' scheme, fallback
'/') while still in the full namespace, so the CWD fd stays valid after
the restriction and the shell spawns.
2026-07-18 11:01:23 +09:00
vasilito b6fb5ca2da login: drop spawn_shell CWD workaround and diagnostics
The real fix is in init (no longer leaves an initfs-scheme CWD that is
invalid in the restricted login namespace), so spawn_shell can stay
minimal again.
2026-07-18 10:43:07 +09:00
vasilito 36526f66a7 login: temporary spawn diagnostics to pinpoint shell-start hang 2026-07-18 10:26:46 +09:00
vasilito 0a1c31fd18 login: set a namespace-valid CWD before spawning the shell
After apply_login_schemes() swaps into the restricted login namespace
(only DEFAULT_SCHEMES), the CWD inherited from init on the live image is
/scheme/initfs, whose scheme is NOT in that namespace. File operations
that consult the CWD fd (notably the child's execve opening the shell
binary) then block, so the login shell never starts. chdir to the user's
home (fallback /), both on the always-present 'file' scheme, before
spawning. Also drops the temporary spawn_shell diagnostics.
2026-07-18 10:17:10 +09:00
vasilito 123649e200 login: add spawn_shell diagnostics to pinpoint shell-spawn ENOENT
Probe the shell binary and home directory in the (possibly restricted)
login namespace before spawning, and print the exact spawn error with
raw_os_error. This isolates whether a failed login shell spawn is due to
a missing binary, an unreachable cwd/home, or an exec-time error.
2026-07-18 08:08:20 +09:00
vasilito 2bc1b8d5c7 userutils: apply Red Bear patches on latest upstream
- Path deps for redox_syscall, libredox, redox-scheme, relibc
- Login prompt fixes (standard C functions)
- Custom issue/motd branding
- Version suffix +rb0.3.1
- Author attribution
2026-07-11 11:35:08 +03:00
Ibuki.O 8005fc0991 fix: Set FD flag to send process fd during sudo 2026-07-05 19:42:56 +09:00
Ibuki Omatsu c9af430c19 misc: Update redox_syscall, libredox and redox-scheme 2026-07-01 08:20:22 -06:00
Connor-GH 2834434b9a getty: use standard C functions
grantpt() and unlockpt() need to be used according to the standard, even
though our grantpt is a no-op (since we auto-lock ptys as we give them
out).

This is part of my series for ptyd. This can be safely merged as long as
the relibc/ and base/ changes are merged at the same time.
2026-06-03 19:15:31 -05:00
bjorn3 8bcdb70d76 sudo: Switch to the root namespace before execing the target process 2026-03-01 13:08:07 +01:00
Ibuki Omatsu 3bdd1d9a6e Adapt sudo and getty to new namespace management, and enforce strict namespace at login. 2026-01-20 20:58:27 -07:00
Jeremy Soller 8ccf37d74a getty: determine correct tty size 2026-01-09 15:46:59 -07:00
Wildan M 9dc487e1d8 Fix compilation with newer syscall 2025-12-28 17:40:14 +07:00
bjorn3 6d50c1220e Leave daemonization to init 2025-11-30 10:45:21 +01:00
James Matlik 6deaf4c51e Minor dependency cleanup
Fully use libredox instead of libc for all constants
2025-06-26 19:54:22 -04:00
bjorn3 4ed8323351 passwd: Remove suid usage though the sudo daemon 2025-04-20 21:10:22 +02:00
bjorn3 cacb0dd67e passwd: Extract find_user 2025-04-20 20:54:52 +02:00
bjorn3 d514768aae passwd: Allow root to always change passwords
Previously root would need to know its own password. On Linux root can
change its own password without needing to enter its own password. It
can do so on Redox OS already anyway by directly editing /etc/shadow.
2025-04-20 20:52:24 +02:00
bjorn3 f557417ebf passwd: Extract ask_new_password 2025-04-20 20:40:37 +02:00
bjorn3 2e630a9f4d passwd: Only allow locking accounts as root
This is consistent with how Linux works and prevents accidentally
locking yourself out.
2025-04-20 20:23:17 +02:00
bjorn3 0a2dea6b04 passwd: Reduce code nesting and minor cleanups 2025-04-20 19:52:18 +02:00
bjorn3 9c53a9a775 Use the sudo daemon rather than setuid for su 2025-04-20 16:46:50 +02:00
bjorn3 bfd521ff49 Fix sudo for procmgr 2025-04-20 16:20:56 +02:00
bjorn3 1fbb804f35 Introduce a sudo daemon as replacement for suid/escalated
This daemon will request the password of the user, check that the user
is in the sudo group and if everything checks out elevate the sudo
process to root after which the sudo process can exec the target process.
2025-04-14 20:16:33 +02:00
bjorn3 7fa1bf8df4 sudo: Simplify a bit 2025-04-13 18:03:49 +02:00
bjorn3 6a208c6b34 Rustfmt 2025-04-13 16:51:27 +02:00
bjorn3 6f2514ed95 Move to the 2024 edition 2025-04-13 16:50:06 +02:00
bjorn3 4ccec7baae sudo: Reduce indentation 2025-03-11 21:31:54 +01:00
bjorn3 88ccab8844 sudo: Rustfmt 2025-03-11 21:31:49 +01:00
Andrey Turkin 53992ad18c Bump dependencies 2024-10-16 21:17:20 +03:00
bjorn3 1e183ca4ba Use the new scheme format 2024-07-11 21:09:53 +02:00
Jeremy Soller de5e7eb903 Use absolute path without scheme for default home and shell 2024-01-18 14:53:02 -07:00
Jeremy Soller b5a371be31 Do not set COLUMNS or LINES in getty 2024-01-18 14:52:13 -07:00
bjorn3 41fde1045c Let fbcond rather than inputd handle input events 2024-01-14 18:30:51 +01:00
bjorn3 0148436174 Fix for the introduction of fbcond 2024-01-14 18:28:00 +01:00
Ron Williams 5cb44522f0 add option to getty to run contain_login 2023-12-19 21:00:27 -08:00
4lDO2 8ab925eb65 Fully switch to libredox 2023-11-04 20:04:59 +01:00
4lDO2 8afb03544f Update redox_users. 2023-11-04 14:52:16 +01:00
Anhad Singh 7c3c5f306e getty: make the consumer changes work with :debug
Signed-off-by: Anhad Singh <andypythonappdeveloper@gmail.com>
2023-07-22 18:15:43 +10:00
Anhad Singh 5e3956adf1 misc: getty open consumer channel to get events
Signed-off-by: Anhad Singh <andypythonappdeveloper@gmail.com>
2023-07-22 17:41:30 +10:00
4lDO2 0621709286 Use redox-daemon in getty 2022-07-27 16:32:27 +02:00
Jeremy Soller 93b6791e29 Update redox_users 2021-01-26 12:52:03 -07:00
Jeremy Soller 2fd54ec8d4 Update liner 2019-11-29 19:37:53 -07:00
Jeremy Soller a208ce4aa8 Update redox_users 2019-08-07 20:00:09 -06:00
Jeremy Soller 8d6649ec5a Merge changes from redox-unix 2019-06-15 09:34:55 -06:00
Jeremy Soller dc387310f6 Update to new rust 2019-04-07 11:30:17 -06:00