summaryrefslogtreecommitdiff
path: root/Userland/Utilities/passwd.cpp
AgeCommit message (Collapse)Author
2023-01-08passwd: Use StringView instead of DeprecatedStringKenneth Myhra
This can now be declared as a StringView, since commit 507cb411 Core::Account::from_name() takes a StringView as a input. This removes one FIXME.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-09-27LibCore: Use `StringView` instead of `char *` in AccountLucas CHOLLET
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-07-12Userland: Convert command line arguments to String/StringViewsin-ack
StringView was used where possible. Some utilities still use libc functions which expect null-terminated strings, so String objects were used there instead.
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2021-12-16LibCore+passwd+usermod: Make Core::Account::sync() return ErrorOr<void>Andreas Kling
2021-12-16passwd: Use LibCore syscall wrapper for setegid()Andreas Kling
2021-12-11passwd: Port to LibMainDavid Lindbom
2021-12-11passwd: Remove redundant pledge()bugreport0
2021-10-19LibCore: Change Account::set_password to take a SecretStringTimothy Flynn
This matches the API of Account::authenticate. The only caller to this API is the passwd utility, which already has the new password stored as a SecretString.
2021-09-12LibCore: Make Account::authenticate take a SecretStringBrian Gianforcaro
To encourage users to use the SecretString API, change the API so that Account::authenticate only accepts a SecretString.
2021-09-12LibCore: Make get_password return SecretString instead of StringBrian Gianforcaro
We shouldn't let secrets sit around in memory, as they could potentially be retrieved by an attacker, or left in memory during a core dump.
2021-09-01Everywhere: Use my cool new @serenityos.org email addressPeter Elliott
2021-08-01Utilities: Remove unused header includesBrian Gianforcaro
2021-06-17passwd: Do not allow empty passwordsbrapru
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-17passwd: Provide more verbose output regarding status of changed passwdbrapru
passwd should explicitly indicate the status of the password change.
2021-06-17passwd: Retype password to confirmbrapru
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-17passwd: Prompt for the current password before setting new passwordbrapru
This changes passwd to authenticate non-root users before prompting for new password.
2021-05-01LibC: Implement support for getspnam() and friendsGunnar Beutner
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
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-01-22passwd: Drop "rpath" pledge after opening filesAndreas Kling
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-22passwd: Remove duplicate 'wpath' pledgeDoctor5555
2021-01-21LibCore+su+passwd: Don't keep /etc/passwd and /etc/shadow openAndreas Kling
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-21passwd+LibCore: Make passwd replace /etc files atomicallyAndreas Kling
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-12Userland: Move command-line utilities to Userland/Utilities/Andreas Kling