]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
privsep: If we fail to init privsep, continue
authorRoy Marples <roy@marples.name>
Sun, 5 Apr 2020 06:47:14 +0000 (07:47 +0100)
committerRoy Marples <roy@marples.name>
Sun, 5 Apr 2020 06:47:14 +0000 (07:47 +0100)
We continue if the privsep user cannot be found, so do the same
if passwd or similar is missing from the system.
This helps people who use dhcpcd in ramdisks to oneshot the config
for example to start iSCSI.

src/dhcpcd.c
src/privsep.c

index 2ffea5bdb01ee77bc2c44809d32ba477444c4486..90f02ba2f4c4b882e9484db6df858360689fc11e 100644 (file)
@@ -2130,12 +2130,7 @@ printpidfile:
        freopen(_PATH_DEVNULL, "r", stdin);
 
 #ifdef PRIVSEP
-       if (ps_init(&ctx) == -1) {
-               if (errno != 0) {
-                       logerr("ps_init");
-                       goto exit_failure;
-               }
-       } else
+       if (ps_init(&ctx) == 0)
                script_runchroot(&ctx, ifo->script);
 #endif
 
index be4dc34efc5188a379c3b8fb00f4ee2dbffe85ee..f074ee2fab5558ea20e1adfa51837d7a78c05cf8 100644 (file)
@@ -115,6 +115,7 @@ ps_init(struct dhcpcd_ctx *ctx)
 
        /* If we pickup the _dhcp user refuse the default directory */
        if (strcmp(pw->pw_dir, "/var/empty") == 0) {
+               ctx->options &= ~DHCPCD_PRIVSEP;
                logerrx("refusing chroot: %s: %s", PRIVSEP_USER, pw->pw_dir);
                errno = 0;
                return -1;