summaryrefslogtreecommitdiff
path: root/usr.bin/openssl/asn1pars.c
diff options
context:
space:
mode:
authorDoug Hogan <doug@cvs.openbsd.org>2015-10-10 22:28:52 +0000
committerDoug Hogan <doug@cvs.openbsd.org>2015-10-10 22:28:52 +0000
commitf3387a448636cc68a1b808bebb2d1be7dc9fdb1a (patch)
treeffee9f85c8d2f7db098aeb18105934f93aa237a6 /usr.bin/openssl/asn1pars.c
parent39255032ff4a0f6ea77ba504e5dd2595bbff43ce (diff)
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/asn1pars.c')
-rw-r--r--usr.bin/openssl/asn1pars.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/openssl/asn1pars.c b/usr.bin/openssl/asn1pars.c
index da3bf761ce4..2ce9d1a3bad 100644
--- a/usr.bin/openssl/asn1pars.c
+++ b/usr.bin/openssl/asn1pars.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asn1pars.c,v 1.4 2015/08/19 18:25:31 deraadt Exp $ */
+/* $OpenBSD: asn1pars.c,v 1.5 2015/10/10 22:28:51 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -247,6 +247,11 @@ asn1parse_main(int argc, char **argv)
BUF_MEM *buf = NULL;
ASN1_TYPE *at = NULL;
+ if (single_execution) {
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ perror("pledge");
+ }
+
memset(&asn1pars_config, 0, sizeof(asn1pars_config));
asn1pars_config.informat = FORMAT_PEM;