changeset 5122:a44d7acff84b draft

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.
author Roy Marples <roy@marples.name>
date Sun, 05 Apr 2020 07:47:14 +0100
parents 200e3a305ec5
children 9422e8c904d5
files src/dhcpcd.c src/privsep.c
diffstat 2 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/dhcpcd.c	Tue Mar 31 11:51:24 2020 +0100
+++ b/src/dhcpcd.c	Sun Apr 05 07:47:14 2020 +0100
@@ -2130,12 +2130,7 @@
 	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
 
--- a/src/privsep.c	Tue Mar 31 11:51:24 2020 +0100
+++ b/src/privsep.c	Sun Apr 05 07:47:14 2020 +0100
@@ -115,6 +115,7 @@
 
 	/* 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;