aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils/capabilities.h
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2013-07-08 17:48:16 +0200
committerTobias Brunner <tobias@strongswan.org>2013-07-18 15:25:35 +0200
commit027676f7500b7d94140adc979959541b08fc4a89 (patch)
tree746ac5709bbdeb536ed8ae8b43c6cd32a8f59f0a /src/libstrongswan/utils/capabilities.h
parent56b753ca04df7f1cdaefc7542c1c6d6940093850 (diff)
downloadstrongswan-027676f7500b7d94140adc979959541b08fc4a89.tar.bz2
strongswan-027676f7500b7d94140adc979959541b08fc4a89.tar.xz
capabilities: Add function to check if a capability is held, without keeping it
This can be useful if capabilities are not required anymore after dropping privileges.
Diffstat (limited to 'src/libstrongswan/utils/capabilities.h')
-rw-r--r--src/libstrongswan/utils/capabilities.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstrongswan/utils/capabilities.h b/src/libstrongswan/utils/capabilities.h
index 4128909b6..fe11a4dfc 100644
--- a/src/libstrongswan/utils/capabilities.h
+++ b/src/libstrongswan/utils/capabilities.h
@@ -54,6 +54,8 @@ struct capabilities_t {
* Register a capability to keep while calling drop(). Verifies that the
* capability is currently held.
*
+ * @note CAP_CHOWN is handled specially as it might not be required.
+ *
* @param cap capability to keep
* @return FALSE if the capability is currently not held
*/
@@ -61,6 +63,16 @@ struct capabilities_t {
u_int cap) __attribute__((warn_unused_result));
/**
+ * Check if the given capability is currently held.
+ *
+ * @note CAP_CHOWN is handled specially as it might not be required.
+ *
+ * @param cap capability to check
+ * @return TRUE if the capability is currently held
+ */
+ bool (*check)(capabilities_t *this, u_int cap);
+
+ /**
* Get the user ID set through set_uid/resolve_uid.
*
* @return currently set user ID