diff options
author | Andrew Bartlett <abartlet@samba.org> | 2006-01-06 21:20:09 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:49:49 -0500 |
commit | 66700b484f674d66692f4a5a498f511f69db7faa (patch) | |
tree | 1523f5a0680dd2f03c1ce41a0ac9b7b18d02ff60 | |
parent | a8eec313549905724a8186a1a4c14480658e2967 (diff) | |
download | samba-66700b484f674d66692f4a5a498f511f69db7faa.tar.gz samba-66700b484f674d66692f4a5a498f511f69db7faa.tar.bz2 samba-66700b484f674d66692f4a5a498f511f69db7faa.zip |
r12747: Add a couple more token tests, used by the kludge ACL module.
Andrew Bartlett
(This used to be commit 10eadf48124d61f2eb586fb277a66aa4b9e6cad3)
-rw-r--r-- | source4/libcli/security/security_token.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source4/libcli/security/security_token.c b/source4/libcli/security/security_token.c index 04d10bf83b..6774894a86 100644 --- a/source4/libcli/security/security_token.c +++ b/source4/libcli/security/security_token.c @@ -190,3 +190,33 @@ BOOL is_anonymous_token(struct security_token *token) return False; } +BOOL is_authenticated_token(struct security_token *token) +{ + TALLOC_CTX *mem_ctx = talloc_new(token); + int i; + struct dom_sid *authenticated = dom_sid_parse_talloc(mem_ctx, SID_NT_ANONYMOUS); + for (i = 0; i < token->num_sids; i++) { + if (dom_sid_equal(token->sids[i], authenticated)) { + talloc_free(mem_ctx); + return True; + } + } + talloc_free(mem_ctx); + return False; +} + +BOOL is_administrator_token(struct security_token *token) +{ + TALLOC_CTX *mem_ctx = talloc_new(token); + int i; + struct dom_sid *administrators = dom_sid_parse_talloc(mem_ctx, SID_BUILTIN_ADMINISTRATORS); + for (i = 0; i < token->num_sids; i++) { + if (dom_sid_equal(token->sids[i], administrators)) { + talloc_free(mem_ctx); + return True; + } + } + talloc_free(mem_ctx); + return False; +} + |