diff options
-rw-r--r-- | util-linux/setpriv.c | 23 |
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 | ||