summaryrefslogtreecommitdiff
path: root/src/firstboot
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2022-07-05 14:53:45 +0200
committerLennart Poettering <lennart@poettering.net>2022-07-05 17:09:16 +0200
commit87a3a4a802b9fcfd92299e2984741835ed50fef4 (patch)
treef5f067e73e88e2a216933e3217b9b4c9952de2ed /src/firstboot
parente386a6d69bd206b031636df1fa952047db3d1a6e (diff)
downloadsystemd-87a3a4a802b9fcfd92299e2984741835ed50fef4.tar.gz
firstboot: Don't skip passwd/shadow logic if only one of the files exists
If one of the files exists but not the other one, we want to make sure we create the other file to make sure the passwd database is in a valid state.
Diffstat (limited to 'src/firstboot')
-rw-r--r--src/firstboot/firstboot.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c
index 39160182ef..0716914b26 100644
--- a/src/firstboot/firstboot.c
+++ b/src/firstboot/firstboot.c
@@ -871,11 +871,9 @@ static int process_root_args(void) {
etc_passwd = prefix_roota(arg_root, "/etc/passwd");
etc_shadow = prefix_roota(arg_root, "/etc/shadow");
- /* We only mess with passwd and shadow if both do not exist or --force is specified. These files are
- * tightly coupled and hence we make sure we have permission from the user to create/modify both
- * files. */
- if ((laccess(etc_passwd, F_OK) >= 0 || laccess(etc_shadow, F_OK) >= 0) && !arg_force)
+ if (laccess(etc_passwd, F_OK) >= 0 && laccess(etc_shadow, F_OK) >= 0 && !arg_force)
return 0;
+
/* Don't create/modify passwd and shadow if not asked */
if (!(arg_root_password || arg_prompt_root_password || arg_copy_root_password || arg_delete_root_password ||
arg_root_shell || arg_prompt_root_shell || arg_copy_root_shell))