summaryrefslogtreecommitdiffstats
path: root/usr.bin/openssl/errstr.c
diff options
context:
space:
mode:
authordoug <doug@openbsd.org>2015-10-10 22:28:51 +0000
committerdoug <doug@openbsd.org>2015-10-10 22:28:51 +0000
commit9bc487ad89cdc45a96f768a9aa951381839f53be (patch)
tree655e99110a43716e981586dbeadf6f04b67e9f0b /usr.bin/openssl/errstr.c
parentpledge "stdio rpath wpath cpath fattr inet" after chroot and such (diff)
downloadwireguard-openbsd-9bc487ad89cdc45a96f768a9aa951381839f53be.tar.xz
wireguard-openbsd-9bc487ad89cdc45a96f768a9aa951381839f53be.zip
Initial support for pledges in openssl(1) commands.
openssl(1) has two mechanisms for operating: either a single execution of one command (looking at argv[0] or argv[1]) or as an interactive session than may execute any number of commands. We already have a top level pledge that should cover all commands and that's what interactive mode must continue using. However, we can tighten up the pledges when only executing one command. This is an initial stab at support and may contain regressions. Most commands only need "stdio rpath wpath cpath". The pledges could be further restricted by evaluating the situation after parsing options. deraadt@ and beck@ are roughly fine with this approach.
Diffstat (limited to 'usr.bin/openssl/errstr.c')
-rw-r--r--usr.bin/openssl/errstr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/openssl/errstr.c b/usr.bin/openssl/errstr.c
index 9cf7bfba4b7..7bd97d99b04 100644
--- a/usr.bin/openssl/errstr.c
+++ b/usr.bin/openssl/errstr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: errstr.c,v 1.4 2015/08/22 16:36:05 jsing Exp $ */
+/* $OpenBSD: errstr.c,v 1.5 2015/10/10 22:28:51 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -98,6 +98,11 @@ errstr_main(int argc, char **argv)
char buf[256];
int ret = 0;
+ if (single_execution) {
+ if (pledge("stdio rpath", NULL) == -1)
+ perror("pledge");
+ }
+
memset(&errstr_config, 0, sizeof(errstr_config));
if (options_parse(argc, argv, errstr_options, NULL, &argsused) != 0) {