Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capng_apply: apply CAPNG_SELECT_CAPS before CAPNG_SELECT_BOUNDS #23

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/cap-ng.c
Expand Up @@ -684,6 +684,13 @@ int capng_apply(capng_select_t set)
if (m.state < CAPNG_INIT)
return -1;

if (set & CAPNG_SELECT_CAPS) {
if (capset((cap_user_header_t)&m.hdr,
(cap_user_data_t)&m.data) == 0)
m.state = CAPNG_APPLIED;
else
return -5;
}
if (set & CAPNG_SELECT_BOUNDS) {
#ifdef PR_CAPBSET_DROP
struct cap_ng state;
Expand All @@ -708,13 +715,6 @@ int capng_apply(capng_select_t set)
}
#endif
}
if (set & CAPNG_SELECT_CAPS) {
if (capset((cap_user_header_t)&m.hdr,
(cap_user_data_t)&m.data) == 0)
m.state = CAPNG_APPLIED;
else
return -5;
}
// Put ambient last so that inheritable and permitted are set
if (set & CAPNG_SELECT_AMBIENT) {
#ifdef PR_CAP_AMBIENT
Expand Down