summaryrefslogtreecommitdiff
path: root/Userland/Utilities
diff options
context:
space:
mode:
authorbrapru <brapru@pm.me>2021-05-24 16:41:36 -0400
committerAndreas Kling <kling@serenityos.org>2021-06-17 19:54:38 +0200
commitc62804df46e90628eb4fa55f465ae4d6467e87d0 (patch)
tree03d168898f2b74e6dc503938a47521dfd602952d /Userland/Utilities
parent1a9d0dee2c885b119076044ede34e8e7a117a015 (diff)
downloadserenity-c62804df46e90628eb4fa55f465ae4d6467e87d0.zip
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.
Diffstat (limited to 'Userland/Utilities')
-rw-r--r--Userland/Utilities/passwd.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Utilities/passwd.cpp b/Userland/Utilities/passwd.cpp
index bf05220a7f..047d009021 100644
--- a/Userland/Utilities/passwd.cpp
+++ b/Userland/Utilities/passwd.cpp
@@ -110,6 +110,12 @@ int main(int argc, char** argv)
return 1;
}
+ if (new_password.value().is_empty() && new_password_retype.value().is_empty()) {
+ warnln("No password supplied.");
+ warnln("Password for user {} unchanged.", target_account.username());
+ return 1;
+ }
+
if (new_password.value() != new_password_retype.value()) {
warnln("Sorry, passwords don't match.");
warnln("Password for user {} unchanged.", target_account.username());