Commit Graph

3 Commits

Author SHA1 Message Date
Karel Zak 966420219c lib/caputils: split to multiple functions, add test
Let's split the code to make it possible to test separately bsearch as
well as procfs based cap_last_cap().

 $ ./test_caputils --last-by-bsearch
 last cap: 39
 $ ./test_caputils --last-by-procfs
 last cap: 39
 $ ./test_caputils --last
 last cap: 39

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-20 11:21:41 +01:00
Érico Rolim 5d95818757 lib/caputils: add fall back for last cap using prctl.
This allows the rest of the programs using cap_last_cap to trust the
value returned by it, since it will either be obtained from procfs
(straight from kernel) or with prctl.

Also checked if the file under /proc is actually mounted in a procfs.
2020-11-18 14:39:33 -03:00
James Peach cef4decf04 unshare: add --keep-caps option
Add the --keep-caps option to unshare to preserve capabilities that
are granted when creating a new user namespace. This allows the child
process to retain privilege within the new user namespace without also
being UID 0.
2019-09-09 20:23:08 -07:00