diff options
author | Ludwig Nussel <ludwig.nussel@suse.de> | 2022-08-09 11:07:34 +0200 |
---|---|---|
committer | Ludwig Nussel <ludwig.nussel@suse.de> | 2022-08-11 13:32:55 +0200 |
commit | ff86850b304f635297829c7d12208b96c10fa48f (patch) | |
tree | ad9fd39bfe58844dc14121a8b275f3cc3b127448 /src/firstboot | |
parent | 6a941db798e3c5d896f6732afb4e6e482d708900 (diff) | |
download | systemd-ff86850b304f635297829c7d12208b96c10fa48f.tar.gz |
creds: refactor reading user password
Share code between firstboot and sysusers
Diffstat (limited to 'src/firstboot')
-rw-r--r-- | src/firstboot/firstboot.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c index 0716914b26..7684c205fb 100644 --- a/src/firstboot/firstboot.c +++ b/src/firstboot/firstboot.c @@ -595,21 +595,8 @@ static int prompt_root_password(void) { if (arg_root_password) return 0; - r = read_credential("passwd.hashed-password.root", (void**) &arg_root_password, NULL); - if (r == -ENOENT) { - r = read_credential("passwd.plaintext-password.root", (void**) &arg_root_password, NULL); - if (r < 0) - log_debug_errno(r, "Couldn't read credential 'passwd.{hashed|plaintext}-password.root', ignoring: %m"); - else { - arg_root_password_is_hashed = false; - return 0; - } - } else if (r < 0) - log_debug_errno(r, "Couldn't read credential 'passwd.hashed-password.root', ignoring: %m"); - else { - arg_root_password_is_hashed = true; + if (get_credential_user_password("root", &arg_root_password, &arg_root_password_is_hashed) >= 0) return 0; - } if (!arg_prompt_root_password) return 0; |