Index | Thread | Search

From:
spiros thanasoulas <dsp@2f30.org>
Subject:
lpd control missing chdir after chroot
To:
tech@openbsd.org
Date:
Tue, 13 Feb 2024 09:52:47 -0700

Download raw body.

Thread
This adds it in the same fashion as it appears in frontend.c

Index: control.c
===================================================================
RCS file: /cvs/src/usr.sbin/lpd/control.c,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 control.c
--- control.c   28 Dec 2022 21:30:17 -0000      1.2
+++ control.c   13 Feb 2024 16:47:43 -0000
@@ -78,6 +78,8 @@ control(int debug, int verbose)

        if (chroot(pw->pw_dir) == 1)
                fatal("%s: chroot", __func__);
+        if (chdir("/") == -1)
+                fatal("%s: chdir", __func__);

        if (pledge("stdio unix recvfd sendfd", NULL) == -1)
                fatal("%s: pledge", __func__);