Commit 4d791f65 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 4ee3dabd
...@@ -41,7 +41,7 @@ int main(int argc, const char *argv[]) { ...@@ -41,7 +41,7 @@ int main(int argc, const char *argv[]) {
if (argc < 2) if (argc < 2)
die("usage: capdo prog arguments..."); die("usage: capdo prog arguments...");
// permitted -> inheritable (so that we can raise ambient) // permitted -> inheritable (so that we can raise ambient below)
caps = cap_get_proc(); caps = cap_get_proc();
if (!caps) if (!caps)
die("cap_get_proc failed"); die("cap_get_proc failed");
...@@ -59,6 +59,7 @@ int main(int argc, const char *argv[]) { ...@@ -59,6 +59,7 @@ int main(int argc, const char *argv[]) {
cap_set_proc(caps) && die_err("cap_set_proc"); cap_set_proc(caps) && die_err("cap_set_proc");
// raise ambient capabilities to what is permitted/inheritable // raise ambient capabilities to what is permitted/inheritable
// this way executed program will have the same capabilities that we have
for (cap = 0; cap <= CAP_LAST_CAP; cap++) { for (cap = 0; cap <= CAP_LAST_CAP; cap++) {
if (capbits & (1ULL << cap)) if (capbits & (1ULL << cap))
prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, cap, 0, 0) && die_err("prctl ambient raise"); prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, cap, 0, 0) && die_err("prctl ambient raise");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment