| 1 |
.TH "CAPNG_STAGE_ADDITIONAL_GROUPS" "3" "Mar 2026" "Red Hat" \ |
| 2 |
"Libcap-ng API" |
| 3 |
.SH NAME |
| 4 |
capng_stage_additional_groups \- stage additional gids for |
| 5 |
capng_change_id |
| 6 |
.SH "SYNOPSIS" |
| 7 |
.B #include <cap-ng.h> |
| 8 |
.sp |
| 9 |
int capng_stage_additional_groups(const gid_t *gids, size_t count); |
| 10 |
|
| 11 |
.SH "DESCRIPTION" |
| 12 |
|
| 13 |
This function stages an additional gid list for the next |
| 14 |
.BR capng_change_id (3) |
| 15 |
call that uses |
| 16 |
.BR CAPNG_APPLY_STAGED_GROUPS . |
| 17 |
The gids are copied into libcap-ng internal state. Once |
| 18 |
.B capng_change_id |
| 19 |
returns, libcap-ng clears the staged gids whether they were applied, |
| 20 |
ignored because the flag was not set, or discarded because the call |
| 21 |
failed. If staged gids remain unused, libcap-ng also clears them when the |
| 22 |
thread-local state is deinitialized. |
| 23 |
|
| 24 |
Passing a |
| 25 |
.I count |
| 26 |
of 0 clears any currently staged gids. |
| 27 |
|
| 28 |
Normally, you should stick to using the supplemantal groups that are associated with the uid's account that is being changed to. This is provided to simulate the gid model that systemd uses. This interface is available in libcap-ng 0.9.3 and later. |
| 29 |
|
| 30 |
.SH "RETURN VALUE" |
| 31 |
|
| 32 |
This returns 0 on success and -1 on failure. A non-zero |
| 33 |
.I count |
| 34 |
with a NULL |
| 35 |
.I gids |
| 36 |
pointer fails with |
| 37 |
.B errno |
| 38 |
set to |
| 39 |
.BR EINVAL . |
| 40 |
|
| 41 |
.SH "SEE ALSO" |
| 42 |
|
| 43 |
.BR capng_change_id (3), |
| 44 |
.BR capabilities (7) |
| 45 |
|
| 46 |
.SH AUTHOR |
| 47 |
Steve Grubb |