aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-07-06 22:59:23 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-07-06 22:59:23 +0200
commitf34c701fa8ac90e900488453b8efbe93a1378280 (patch)
tree5b52d30f72325c2aa800a58d14b21adea8d7eb5d
parentad63102943d3f648b37b65f5c734b2c345a3b280 (diff)
downloadbusybox-w32-f34c701fa8ac90e900488453b8efbe93a1378280.tar.gz
busybox-w32-f34c701fa8ac90e900488453b8efbe93a1378280.tar.bz2
busybox-w32-f34c701fa8ac90e900488453b8efbe93a1378280.zip
setpriv: dump capability bounding set
As with the previous commit, this one implements the ability to dump the capability bounding set. function old new delta setpriv_main 838 982 +144 .rodata 146101 146148 +47 Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--util-linux/setpriv.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/util-linux/setpriv.c b/util-linux/setpriv.c
index a509204a2..c3f9ea153 100644
--- a/util-linux/setpriv.c
+++ b/util-linux/setpriv.c
@@ -82,6 +82,10 @@
82#include <sys/prctl.h> 82#include <sys/prctl.h>
83#include "libbb.h" 83#include "libbb.h"
84 84
85#ifndef PR_CAPBSET_READ
86#define PR_CAPBSET_READ 23
87#endif
88
85#ifndef PR_SET_NO_NEW_PRIVS 89#ifndef PR_SET_NO_NEW_PRIVS
86#define PR_SET_NO_NEW_PRIVS 38 90#define PR_SET_NO_NEW_PRIVS 38
87#endif 91#endif
@@ -247,6 +251,25 @@ static int dump(void)
247 } 251 }
248 if (!fmt[0]) 252 if (!fmt[0])
249 printf("[none]"); 253 printf("[none]");
254
255 printf("\nCapability bounding set: ");
256 fmt = "";
257 for (i = 0; cap_valid(i); i++) {
258 int ret = prctl(PR_CAPBSET_READ, (unsigned long) i, 0UL, 0UL, 0UL);
259 if (ret < 0)
260 bb_simple_perror_msg_and_die("prctl: CAPBSET_READ");
261 if (ret) {
262# if ENABLE_FEATURE_SETPRIV_CAPABILITY_NAMES
263 if (i < ARRAY_SIZE(capabilities))
264 printf("%s%s", fmt, capabilities[i]);
265 else
266# endif
267 printf("%scap_%u", fmt, i);
268 fmt = ",";
269 }
270 }
271 if (!fmt[0])
272 printf("[none]");
250 bb_putchar('\n'); 273 bb_putchar('\n');
251# endif 274# endif
252 275