As Theo says, there's probably room for stricter pledge requests, but
this would involve refactoring.
-/* $OpenBSD: inetd.c,v 1.143 2015/01/16 06:40:17 deraadt Exp $ */
+/* $OpenBSD: inetd.c,v 1.144 2015/10/18 16:11:19 jca Exp $ */
/*
* Copyright (c) 1983,1991 The Regents of the University of California.
int ch;
extern char *optarg;
extern int optind;
-
+
while ((ch = getopt(argc, argv, "dR:")) != -1)
switch (ch) {
case 'd':
(void) setlogin("");
}
+ if (pledge("stdio rpath getpw dns inet proc exec id abort", NULL) == -1)
+ err(1, "pledge");
+
if (uid == 0) {
gid_t gid = getgid();
sleep(1);
return;
}
+
+ if (pledge("stdio rpath getpw inet proc exec id abort", NULL) == -1)
+ err(1, "pledge");
+
if (pid && sep->se_wait) {
sep->se_wait = pid;
event_del(&sep->se_event);