diff options
author | 2015-10-12 16:54:30 +0000 | |
---|---|---|
committer | 2015-10-12 16:54:30 +0000 | |
commit | 5b15ea38d0ab80cbf822aa0248261774b9f199be (patch) | |
tree | 964b3890b6fc6b7a3f79f3bda05fbd87f183ae44 /libexec/comsat | |
parent | ftp(1) was static for years, as a recovery seatbelt. These days (diff) | |
download | wireguard-openbsd-5b15ea38d0ab80cbf822aa0248261774b9f199be.tar.xz wireguard-openbsd-5b15ea38d0ab80cbf822aa0248261774b9f199be.zip |
Call pledge(2) after initial getsockname(2) to avoid "inet" addition.
From & OK deraadt@
Diffstat (limited to 'libexec/comsat')
-rw-r--r-- | libexec/comsat/comsat.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libexec/comsat/comsat.c b/libexec/comsat/comsat.c index 9795b4d8063..0ba89612911 100644 --- a/libexec/comsat/comsat.c +++ b/libexec/comsat/comsat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: comsat.c,v 1.43 2015/10/10 20:35:00 deraadt Exp $ */ +/* $OpenBSD: comsat.c,v 1.44 2015/10/12 16:54:30 uebayasi Exp $ */ /* * Copyright (c) 1980, 1993 @@ -83,9 +83,6 @@ main(int argc, char *argv[]) char msgbuf[100]; sigset_t sigset; - if (pledge("stdio rpath wpath proc tty", NULL) == -1) - err(1, "pledge"); - /* verify proper invocation */ fromlen = sizeof(from); if (getsockname(0, (struct sockaddr *)&from, &fromlen) == -1) { @@ -93,6 +90,10 @@ main(int argc, char *argv[]) "comsat: getsockname: %s.\n", strerror(errno)); exit(1); } + + if (pledge("stdio rpath wpath proc tty", NULL) == -1) + err(1, "pledge"); + openlog("comsat", LOG_PID, LOG_DAEMON); if (chdir(_PATH_MAILDIR)) { syslog(LOG_ERR, "chdir: %s: %m", _PATH_MAILDIR); |