diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-05-05 15:32:43 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2021-05-06 21:55:58 +0200 |
commit | 53c25ac968ab8b868506c3a1820d8c76beb0cd88 (patch) | |
tree | 28affe0c2d1613e7a27ede615c90e1d2d88ae59c /src/sysusers/sysusers.c | |
parent | Fix indent prefix being used as a suffix in systemd-analyze dump for some pro... (diff) | |
download | systemd-53c25ac968ab8b868506c3a1820d8c76beb0cd88.tar.xz systemd-53c25ac968ab8b868506c3a1820d8c76beb0cd88.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | src/sysusers/sysusers.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index 8d3086e209..465b2dd9f5 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -441,7 +441,7 @@ static int write_temporary_passwd(const char *passwd_path, FILE **tmpfile, char .pw_gecos = i->description, /* "x" means the password is stored in the shadow file */ - .pw_passwd = (char*) "x", + .pw_passwd = (char*) PASSWORD_SEE_SHADOW, /* We default to the root directory as home */ .pw_dir = i->home ?: (char*) "/", @@ -551,7 +551,7 @@ static int write_temporary_shadow(const char *shadow_path, FILE **tmpfile, char struct spwd n = { .sp_namp = i->name, - .sp_pwdp = (char*) "!*", /* lock this password, and make it invalid */ + .sp_pwdp = (char*) PASSWORD_LOCKED_AND_INVALID, .sp_lstchg = lstchg, .sp_min = -1, .sp_max = -1, @@ -682,7 +682,7 @@ static int write_temporary_group(const char *group_path, FILE **tmpfile, char ** struct group n = { .gr_name = i->name, .gr_gid = i->gid, - .gr_passwd = (char*) "x", + .gr_passwd = (char*) PASSWORD_SEE_SHADOW, }; r = putgrent_with_members(&n, group); @@ -766,7 +766,7 @@ static int write_temporary_gshadow(const char * gshadow_path, FILE **tmpfile, ch ORDERED_HASHMAP_FOREACH(i, todo_gids) { struct sgrp n = { .sg_namp = i->name, - .sg_passwd = (char*) "!*", + .sg_passwd = (char*) PASSWORD_LOCKED_AND_INVALID, }; r = putsgent_with_members(&n, gshadow); |