user-util: add generic definition for special password hash values in /etc/passwd + /etc/shadow

Let's add three defines for the 3 special cases of passwords.

Some of our tools used different values for the "locked"/"invalid" case,
let's settle on using "!*" which means the password is both locked *and*
invalid.

Other tools like to use "!!" for this case, which however is less than
ideal I think, since the this could also be a considered an entry with
an empty password, that can be enabled again by unlocking it twice.
This commit is contained in:
Lennart Poettering
2021-05-06 21:55:58 +02:00
parent a7bd1656f3
commit 53c25ac968
5 changed files with 24 additions and 14 deletions
+9
View File
@@ -111,3 +111,12 @@ int putsgent_sane(const struct sgrp *sg, FILE *stream);
bool is_nologin_shell(const char *shell);
int is_this_me(const char *username);
/* A locked *and* invalid password for "struct spwd"'s .sp_pwdp and "struct passwd"'s .pw_passwd field */
#define PASSWORD_LOCKED_AND_INVALID "!*"
/* A password indicating "look in shadow file, please!" for "struct passwd"'s .pw_passwd */
#define PASSWORD_SEE_SHADOW "x"
/* A password indicating "hey, no password required for login" */
#define PASSWORD_NONE ""