Commit graph

11 commits

Author SHA1 Message Date
Andreas Kling
ececac65c2 Userland: Move command-line utilities to Userland/Utilities/ 2021-01-12 12:04:09 +01:00
Andreas Kling
70fce5c4c7 LibCore: Use OSError in get_password() return type 2021-01-10 16:48:43 +01:00
Andreas Kling
d07ac4130f passwd: Drop "tty" pledge promise after getting password from user
This leaves us with a total pledge of "stdio" when writing to
/etc/passwd and /etc/shadow which is kinda neat. :^)
2021-01-09 22:22:07 +01:00
Andreas Kling
2b41155c07 passwd+su: Convert fprintf(stderr, ...) to warnln() 2021-01-09 22:15:33 +01:00
Andreas Kling
9766f61f7b su+passwd: Don't copy Core::Account unnecessarily 2021-01-09 19:41:28 +01:00
Andreas Kling
71d23bb262 passwd: Drop privileges after opening files for writing
Once we have /etc/passwd and /etc/shadow open for writing, there's no
need for passwd to continue running as root.

We can also drop a bunch of pledge promises, further tightening things.
2021-01-09 19:41:17 +01:00
Andreas Kling
9a688af4b1 LibCore+passwd+su+Base: Add /etc/shadow to hide hashes from users :^)
This patch moves the user account password hashes from /etc/passwd,
where they were world-readable, to /etc/shadow, where only root can
access them.

The Core::Account class is extended to support both authentication
against, and modification of /etc/shadow.

The default password for "anon" as of this commit is "foo" :^)
2021-01-09 19:41:12 +01:00
Ben Wiederhake
4ec77ba929 Userland: Write some '--help' descriptions where appropriate 2020-12-06 00:06:53 +01:00
Peter Elliott
7ba7b72736 Userland: Convert passwd(1) to use Core::Account
this fixes the passwd issues discovered in #3296
2020-09-21 20:18:05 +02:00
Sergey Bugaev
3d936d51fd Userland: Fix passing a non-format string to fprintf() 2020-08-30 17:35:27 +02:00
Peter Elliott
207fb054e5 Userland: Add passwd utility 2020-07-28 17:07:22 +02:00