summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-05-05 17:55:10 +0100
committerRoy Marples <roy@marples.name>2020-05-05 17:55:10 +0100
commitc0567cc03ec3a75d8edab2abb5789efda54d4c66 (patch)
treec49887a28a5ebee009a64e878999a9718cb6ece4 /src
parent4934b0f3357194d28c57f6561d74442f4c7430e5 (diff)
downloaddhcpcd-c0567cc03ec3a75d8edab2abb5789efda54d4c66.tar.xz
privsep: Allow a blank string to force privsep users home directory
So FreeBSD users can set it like other OS's if they so choose.
Diffstat (limited to 'src')
-rw-r--r--src/dhcpcd.8.in3
-rw-r--r--src/dhcpcd.c10
2 files changed, 11 insertions, 2 deletions
diff --git a/src/dhcpcd.8.in b/src/dhcpcd.8.in
index 83d090f5..4188d6be 100644
--- a/src/dhcpcd.8.in
+++ b/src/dhcpcd.8.in
@@ -269,7 +269,8 @@ to the
.Ar chroot
directory rather than the
@CHDIR^@privilege separation users home directory.@CHDIR$@
-@CHDIR@
+@CHDIR1@
+@CHDIR2@
The privilege separation user is @PRIVSEP_USER@.
.It Fl D , Fl Fl duid
Use a DHCP Unique Identifier.
diff --git a/src/dhcpcd.c b/src/dhcpcd.c
index 71ae45ac..060f2e93 100644
--- a/src/dhcpcd.c
+++ b/src/dhcpcd.c
@@ -1896,7 +1896,15 @@ main(int argc, char **argv)
break;
#ifdef PRIVSEP
case O_CHROOT:
- ctx.ps_chroot = optarg;
+#ifdef PRIVSEP_CHROOT
+ if (*optarg == '\0' ||
+ (((optarg[0] == '"' && optarg[1] == '"') ||
+ (optarg[0] == '\'' && optarg[1] == '\'')) &&
+ optarg[2] == '\0'))
+ ctx.ps_chroot = NULL;
+ else
+#endif
+ ctx.ps_chroot = optarg;
break;
#endif
case '?':