CAPNG_HAVE_CAPABILITIES(3)

πŸ“¦
version 0.9.6 Β· 3 versions
  • 0.9.6 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.8.2 Β· centos-stream 9
  • 0.7.9 Β· ubuntu jammy
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– CAPNG_HAVE_CAPABILITIES πŸ’–

okay bestie, so this one is from the Libcap-ng API and it's literally just two little functions that peek at your capabilities and tell you what's up πŸ‘€ no cap, that's the whole vibe.


✨ NAME ✨

capng_have_capabilities, capng_have_permitted_capabilities β€” check for capabilities πŸ•΅οΈβ™€οΈ


🌸 SYNOPSIS 🌸

#include <cap-ng.h>

capng_results_t capng_have_capabilities(capng_select_t set);
capng_results_t capng_have_permitted_capabilities(void);

πŸ¦‹ DESCRIPTION πŸ¦‹

So capng_have_capabilities looks at the internal capability sets you picked and reports back what the status is, periodt. Quick warning though: those sets have to be set up before you call this β€” like, you gotta run capng_get_caps_process, or capng_get_caps_fd, or set them up some other way first. It's giving "you can't vibe check a set that doesn't exist yet" πŸ’…

When you call it, you pass in which set you wanna check:

  • CAPNG_SELECT_CAPS β€” the traditional capabilities, the OGs
  • CAPNG_SELECT_BOUNDS β€” the bounding set
  • CAPNG_SELECT_BOTH β€” if you want both of the above, bestie
  • CAPNG_SELECT_AMBIENT β€” if you're only checking the ambient capabilities
  • CAPNG_SELECT_ALL β€” if you wanna test all the sets, main character energy

And here's the tea 🍡: when it checks capabilities, it only looks at the effective capabilities. That's it. That's the whole check.

BUT. If the source of your capabilities comes from a file, then you might also need to check the permitted capabilities. That's literally why capng_have_permitted_capabilities exists β€” it was created for exactly this situation. It takes no arguments because it's unbothered, it simply checks the permitted set. Iconic behaviour honestly 🫢


⭐ RETURN VALUE ⭐

This function returns one of these four values, and they're all self explanatory fr fr:

  • CAPNG_FAIL
  • CAPNG_NONE
  • CAPNG_PARTIAL
  • CAPNG_FULL

🌈 SEE ALSO 🌈


πŸ‘‘ AUTHOR πŸ‘‘

Steve Grubb ✨


Red Hat πŸŽ€ Sept 2020 πŸ¦‹ Libcap-ng API β€” okay that's the whole page bestie, go forth and check those capabilities, you ate πŸ’…πŸ’–βœ¨

πŸ“¦ where this page comes from