diff options
Diffstat (limited to 'usr/src/cmd/ptools/ppriv/ppriv.c')
-rw-r--r-- | usr/src/cmd/ptools/ppriv/ppriv.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/usr/src/cmd/ptools/ppriv/ppriv.c b/usr/src/cmd/ptools/ppriv/ppriv.c index d9a155a959..a695c1a09b 100644 --- a/usr/src/cmd/ptools/ppriv/ppriv.c +++ b/usr/src/cmd/ptools/ppriv/ppriv.c @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * * Program to examine or set process privileges. */ @@ -60,6 +59,7 @@ static boolean_t Don = B_FALSE; static boolean_t Doff = B_FALSE; static boolean_t list = B_FALSE; static boolean_t mac_aware = B_FALSE; +static boolean_t pfexec = B_FALSE; static boolean_t xpol = B_FALSE; static int mode = PRIV_STR_PORT; @@ -78,7 +78,7 @@ main(int argc, char **argv) else command = argv[0]; - while ((opt = getopt(argc, argv, "lDMNevs:xS")) != EOF) { + while ((opt = getopt(argc, argv, "lDMNPevs:xS")) != EOF) { switch (opt) { case 'l': list = B_TRUE; @@ -94,6 +94,10 @@ main(int argc, char **argv) set = B_TRUE; Doff = B_TRUE; break; + case 'P': + set = B_TRUE; + pfexec = B_TRUE; + break; case 'e': exec = B_TRUE; break; @@ -493,7 +497,7 @@ privupdate(prpriv_t *pr, const char *arg) } } - if (Doff || Don || xpol) { + if (Doff || Don || pfexec || xpol) { priv_info_uint_t *pii; int sz = PRIV_PRPRIV_SIZE(pr); char *x = (char *)pr + PRIV_PRPRIV_INFO_OFFSET(pr); @@ -530,6 +534,8 @@ done: fl |= PRIV_DEBUG; if (Doff) fl &= ~PRIV_DEBUG; + if (pfexec) + fl |= PRIV_PFEXEC; if (xpol) fl |= PRIV_XPOLICY; @@ -552,6 +558,10 @@ privupdate_self(void) if (setpflags(NET_MAC_AWARE_INHERIT, 1) != 0) fatal("setpflags(NET_MAC_AWARE_INHERIT)"); } + if (pfexec) { + if (setpflags(PRIV_PFEXEC, 1) != 0) + fatal("setpflags(PRIV_PFEXEC)"); + } if (sets != NULL) { priv_set_t *target = priv_allocset(); @@ -592,6 +602,8 @@ privupdate_self(void) (void) setpflags(PRIV_DEBUG, Don ? 1 : 0); if (xpol) (void) setpflags(PRIV_XPOLICY, 1); + if (pfexec) + (void) setpflags(PRIV_PFEXEC, 1); } static int @@ -649,6 +661,7 @@ static struct { { PRIV_AWARE_INHERIT, "PRIV_AWARE_INHERIT" }, { PRIV_AWARE_RESET, "PRIV_AWARE_RESET" }, { PRIV_XPOLICY, "PRIV_XPOLICY" }, + { PRIV_PFEXEC, "PRIV_PFEXEC" }, { NET_MAC_AWARE, "NET_MAC_AWARE" }, { NET_MAC_AWARE_INHERIT, "NET_MAC_AWARE_INHERIT" }, }; |