From d514768aae1f15390c9cbec7cd927bedae7373a3 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 20 Apr 2025 20:48:14 +0200 Subject: [PATCH] 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. --- src/bin/passwd.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bin/passwd.rs b/src/bin/passwd.rs index 7acce687f6..daa86512f8 100644 --- a/src/bin/passwd.rs +++ b/src/bin/passwd.rs @@ -103,11 +103,13 @@ fn main() { stdout.flush().r#try(&mut stderr); let mut verified = false; - if user.is_passwd_blank() { + if uid == 0 { verified = true; - } else if user.is_passwd_unset() && uid != 0 { + } else if user.is_passwd_blank() { + verified = true; + } else if user.is_passwd_unset() { verified = false; - } else if user.uid == uid || uid != 0 { + } else { stdout.write_all(b"current password: ").r#try(&mut stderr); stdout.flush().r#try(&mut stderr); @@ -117,8 +119,6 @@ fn main() { verified = user.verify_passwd(&password) } - } else { - verified = true; } if !verified {