]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
privsep: chdir after chroot
authorRoy Marples <roy@marples.name>
Fri, 17 Jan 2020 14:02:59 +0000 (14:02 +0000)
committerRoy Marples <roy@marples.name>
Fri, 17 Jan 2020 14:02:59 +0000 (14:02 +0000)
chroot itself does not actually change the directory....

src/privsep.c

index 0610f03d62eac362ab08d888769f8b520f9a8f8c..57b76b82ff6360194ae03a5ca4b178525863adbb 100644 (file)
@@ -212,6 +212,8 @@ ps_dostart(struct dhcpcd_ctx *ctx,
 
        if (chroot(pw->pw_dir) == -1)
                logerr("%s: chroot `%s'", __func__, pw->pw_dir);
+       if (chdir("/") == -1)
+               logerr("%s: chdir `/'", __func__);
 
 dropprivs:
        if (setgroups(1, &pw->pw_gid) == -1 ||