From: kn Date: Tue, 4 Oct 2022 07:05:28 +0000 (+0000) Subject: Drop cpath promise unless file creation is allowed X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=704f9ac0912415fe2ddb42fcda5bad4ae67bfe9e;p=openbsd Drop cpath promise unless file creation is allowed OK millert --- diff --git a/usr.sbin/tftpd/tftpd.c b/usr.sbin/tftpd/tftpd.c index 9051c2ef177..132e3b87985 100644 --- a/usr.sbin/tftpd/tftpd.c +++ b/usr.sbin/tftpd/tftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tftpd.c,v 1.47 2021/10/24 21:24:19 deraadt Exp $ */ +/* $OpenBSD: tftpd.c,v 1.48 2022/10/04 07:05:28 kn Exp $ */ /* * Copyright (c) 2012 David Gwynne @@ -391,8 +391,13 @@ main(int argc, char *argv[]) if (!debug && rdaemon(devnull) == -1) err(1, "unable to daemonize"); - if (pledge("stdio rpath wpath cpath fattr dns inet", NULL) == -1) - lerr(1, "pledge"); + if (cancreate) { + if (pledge("stdio rpath wpath cpath fattr dns inet", NULL) == -1) + lerr(1, "pledge"); + } else { + if (pledge("stdio rpath wpath fattr dns inet", NULL) == -1) + lerr(1, "pledge"); + } event_init();