From: Roy Marples Date: Sun, 5 Apr 2020 06:47:14 +0000 (+0100) Subject: privsep: If we fail to init privsep, continue X-Git-Tag: v9.0.1~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbc2deb7e4cb2a66449269fbb81d79927151462b;p=thirdparty%2Fdhcpcd.git privsep: If we fail to init privsep, continue 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. --- diff --git a/src/dhcpcd.c b/src/dhcpcd.c index 2ffea5bd..90f02ba2 100644 --- a/src/dhcpcd.c +++ b/src/dhcpcd.c @@ -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 diff --git a/src/privsep.c b/src/privsep.c index be4dc34e..f074ee2f 100644 --- a/src/privsep.c +++ b/src/privsep.c @@ -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;