summaryrefslogtreecommitdiff
path: root/libcli/security
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-09-21 07:14:38 +1000
committerAndrew Tridgell <tridge@samba.org>2010-10-14 02:35:05 +0000
commitf7ffc12e2d43bd2dddb0a29eb778ff69a6b2802d (patch)
tree72651753a8def1de3c6c6ef61ff51cb9751d0ef6 /libcli/security
parenta879a4610dac03b814ad40800f408416d250c6be (diff)
downloadsamba-f7ffc12e2d43bd2dddb0a29eb778ff69a6b2802d.tar.gz
samba-f7ffc12e2d43bd2dddb0a29eb778ff69a6b2802d.tar.bz2
samba-f7ffc12e2d43bd2dddb0a29eb778ff69a6b2802d.zip
libcli/security Use static SIDs rather than parsing from strings
This should make the security_token_is_*() calls a little faster. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'libcli/security')
-rw-r--r--libcli/security/dom_sid.h1
-rw-r--r--libcli/security/security_token.c10
2 files changed, 6 insertions, 5 deletions
diff --git a/libcli/security/dom_sid.h b/libcli/security/dom_sid.h
index 8c60f761e4..3d1161fdc7 100644
--- a/libcli/security/dom_sid.h
+++ b/libcli/security/dom_sid.h
@@ -30,6 +30,7 @@ extern const struct dom_sid global_sid_World_Domain;
extern const struct dom_sid global_sid_World;
extern const struct dom_sid global_sid_Creator_Owner_Domain;
extern const struct dom_sid global_sid_NT_Authority;
+extern const struct dom_sid global_sid_Enterprise_DCs;
extern const struct dom_sid global_sid_System;
extern const struct dom_sid global_sid_NULL;
extern const struct dom_sid global_sid_Authenticated_Users;
diff --git a/libcli/security/security_token.c b/libcli/security/security_token.c
index 03dc528b93..40f13820ee 100644
--- a/libcli/security/security_token.c
+++ b/libcli/security/security_token.c
@@ -95,12 +95,12 @@ bool security_token_is_sid_string(const struct security_token *token, const char
bool security_token_is_system(const struct security_token *token)
{
- return security_token_is_sid_string(token, SID_NT_SYSTEM);
+ return security_token_is_sid(token, &global_sid_System);
}
bool security_token_is_anonymous(const struct security_token *token)
{
- return security_token_is_sid_string(token, SID_NT_ANONYMOUS);
+ return security_token_is_sid(token, &global_sid_Anonymous);
}
bool security_token_has_sid(const struct security_token *token, const struct dom_sid *sid)
@@ -128,15 +128,15 @@ bool security_token_has_sid_string(const struct security_token *token, const cha
bool security_token_has_builtin_administrators(const struct security_token *token)
{
- return security_token_has_sid_string(token, SID_BUILTIN_ADMINISTRATORS);
+ return security_token_has_sid(token, &global_sid_Builtin_Administrators);
}
bool security_token_has_nt_authenticated_users(const struct security_token *token)
{
- return security_token_has_sid_string(token, SID_NT_AUTHENTICATED_USERS);
+ return security_token_has_sid(token, &global_sid_Authenticated_Users);
}
bool security_token_has_enterprise_dcs(const struct security_token *token)
{
- return security_token_has_sid_string(token, SID_NT_ENTERPRISE_DCS);
+ return security_token_has_sid(token, &global_sid_Enterprise_DCs);
}