summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2013-08-06 13:26:53 +0200
committerGünther Deschner <gd@samba.org>2013-08-06 14:41:58 +0200
commit0ede70c51af54212c700fb1791e2a192e412d851 (patch)
tree016eb35bd4c2664d34d0de015187db37a8376e80
parenteb50fb8f3bf670bd7d1cf8fd4368ef4a73083696 (diff)
downloadsamba-0ede70c51af54212c700fb1791e2a192e412d851.tar.gz
samba-0ede70c51af54212c700fb1791e2a192e412d851.tar.bz2
samba-0ede70c51af54212c700fb1791e2a192e412d851.zip
libcli: Add security_token_system_privilege().
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
-rw-r--r--libcli/security/privileges.c13
-rw-r--r--libcli/security/privileges.h10
2 files changed, 23 insertions, 0 deletions
diff --git a/libcli/security/privileges.c b/libcli/security/privileges.c
index adb67c19f2..d2731c3dd0 100644
--- a/libcli/security/privileges.c
+++ b/libcli/security/privileges.c
@@ -422,6 +422,19 @@ bool security_token_has_privilege(const struct security_token *token, enum sec_p
return false;
}
+bool security_token_system_privilege(const struct security_token *token)
+{
+ if (token == NULL) {
+ return false;
+ }
+
+ if (token->privilege_mask == (uint64_t)~0) {
+ return true;
+ }
+
+ return false;
+}
+
/*
set a bit in the privilege mask
*/
diff --git a/libcli/security/privileges.h b/libcli/security/privileges.h
index a65dbdfcd7..eb3ab5e784 100644
--- a/libcli/security/privileges.h
+++ b/libcli/security/privileges.h
@@ -89,6 +89,16 @@ const char *sec_privilege_name_from_index(int idx);
*/
bool security_token_has_privilege(const struct security_token *token, enum sec_privilege privilege);
+
+/**
+ * @brief Check if the security token has system privileges.
+ *
+ * @param[in] token The token to check.
+ *
+ * @return True if the token has system privileges, false if not.
+ */
+bool security_token_system_privilege(const struct security_token *token);
+
/*
set a bit in the privilege mask
*/