Commit Graph

12 Commits

Author SHA1 Message Date
Brian Gianforcaro
219d4ba376 Utilities: Remove unused header includes 2021-08-01 08:10:16 +02:00
brapru
c62804df46 passwd: Do not allow empty passwords
The user should use the delete flag when wanting to issue an empty
password. passwd should return an error after receiving empty input.
2021-06-17 19:54:38 +02:00
brapru
1a9d0dee2c passwd: Provide more verbose output regarding status of changed passwd
passwd should explicitly indicate the status of the password change.
2021-06-17 19:54:38 +02:00
brapru
4fd842f566 passwd: Retype password to confirm
Previously passwd would accept the first password input by the user. It
should ask the user to re-type the password to check for mismatches and
prevent typos in the password.
2021-06-17 19:54:38 +02:00
brapru
b0f8bccd08 passwd: Prompt for the current password before setting new password
This changes passwd to authenticate non-root users before prompting for
new password.
2021-06-17 19:54:38 +02:00
Gunnar Beutner
302f9798ee LibC: Implement support for getspnam() and friends 2021-05-01 12:40:12 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Andreas Kling
2ab9083420 passwd: Drop "rpath" pledge after opening files
We needed this for mkstemp() since it used lstat() internally. Now that
it only uses open(), we don't need to pledge "rpath".
2021-01-22 19:39:44 +01:00
Doctor5555
6803d5dfbe passwd: Remove duplicate 'wpath' pledge 2021-01-22 11:09:44 +01:00
Andreas Kling
439f447ba8 LibCore+su+passwd: Don't keep /etc/passwd and /etc/shadow open
Now that we've moved to atomic replacement of these files when altering
them, we don't need to keep them open for the lifetime of Core::Account
so just simplify this and close them when they are not needed.
2021-01-21 11:17:06 +01:00
Andreas Kling
77e0598c6d passwd+LibCore: Make passwd replace /etc files atomically
Before this patch, we had a nasty race condition when changing a user's
password: there was a time window between truncating /etc/shadow and
writing out its new contents, where you could simply "su" to root
without using a password.

Instead of writing directly to /etc/passwd and /etc/shadow, we now
create temporary files in /etc and fill them with the new contents.
Those files are then atomically renamed to /etc/passwd and /etc/shadow.

Sadly, fixing this race requires giving the passwd program a lot more
privileges. This is something we can and should improve upon. :^)
2021-01-21 11:08:20 +01:00
Andreas Kling
ececac65c2 Userland: Move command-line utilities to Userland/Utilities/ 2021-01-12 12:04:09 +01:00