summaryrefslogtreecommitdiff
path: root/src/basic/user-util.h
diff options
context:
space:
mode:
authorPigmy-penguin <88971276+Pigmy-penguin@users.noreply.github.com>2022-01-06 17:01:38 +0100
committerGitHub <noreply@github.com>2022-01-06 16:01:38 +0000
commitcd933f14bd70d8311799972ca71280a733eb1d6a (patch)
tree30294bca635164de27257a085489895377d6452e /src/basic/user-util.h
parent7611946ebc70600ad5948fe255852781f92ee2ab (diff)
downloadsystemd-cd933f14bd70d8311799972ca71280a733eb1d6a.tar.gz
userdbctl: fix "Password OK" shown even when password is empty or locked (#21308)
userdbctl: fix "Password OK" shown even when password is empty or locked
Diffstat (limited to 'src/basic/user-util.h')
-rw-r--r--src/basic/user-util.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/basic/user-util.h b/src/basic/user-util.h
index ab1ce48b2d..bc76de6b41 100644
--- a/src/basic/user-util.h
+++ b/src/basic/user-util.h
@@ -114,6 +114,10 @@ int is_this_me(const char *username);
const char *get_home_root(void);
+static inline bool hashed_password_is_locked_or_invalid(const char *password) {
+ return password && password[0] != '$';
+}
+
/* A locked *and* invalid password for "struct spwd"'s .sp_pwdp and "struct passwd"'s .pw_passwd field */
#define PASSWORD_LOCKED_AND_INVALID "!*"