/usr/include/ui-utilcpp/Cap.hpp is in libui-utilcpp-dev 1.8.5-1build3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | /**
* @file
*/
#ifndef UI_UTIL_CAP_HPP
#define UI_UTIL_CAP_HPP
// STDC++
#include <string>
// POSIX C
#ifdef __linux__
#include <sys/capability.h>
#endif
namespace UI {
namespace Util {
/** @brief C++ encapsulation for libcap's 'cap_t'. */
class Cap
{
private:
#ifdef __linux__
cap_t cap_;
#endif
public:
enum InitType { Proc_, Clear_ };
/** @brief Construct from process state, or cleared with proc=false. */
Cap(InitType const & initType=Proc_);
/** @brief Construct from textual representation (see man cap_from_text(3)). */
Cap(std::string const & s, InitType const & initType=Proc_);
Cap(Cap const & cap);
~Cap();
Cap & apply();
#ifdef HAVE_CAP_COMPARE
bool operator==(Cap const & cap) const;
#endif
/** @brief Get textual representation (see man cap_to_text(3)). */
std::string const get() const;
};
/** @brief Helper to enable effective capabilities safely for a scope. */
class CapScope
{
private:
std::string const capabilities_;
public:
CapScope(std::string const & capabilities);
~CapScope();
};
}}
#endif
|