summaryrefslogtreecommitdiff
path: root/source4/libgpo
diff options
context:
space:
mode:
authorWilco Baan Hofman <wilco@baanhofman.nl>2009-03-01 18:44:58 +0100
committerGünther Deschner <gd@samba.org>2009-04-20 23:16:16 +0200
commit68ff179b2960c80c56978869e2dd97806b10a214 (patch)
treea35fce8e907fc61f9bdb3f668c6111fd20b8a956 /source4/libgpo
parentff33d50fabd6d5262d1917678d83c7c01351f04d (diff)
downloadsamba-68ff179b2960c80c56978869e2dd97806b10a214.tar.gz
samba-68ff179b2960c80c56978869e2dd97806b10a214.tar.bz2
samba-68ff179b2960c80c56978869e2dd97806b10a214.zip
Add nt_token_check_sid convenience function. Map NT_USER_TOKEN to struct security_token. Fix build errors.
Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source4/libgpo')
-rw-r--r--source4/libgpo/ads_convenience.c25
-rw-r--r--source4/libgpo/ads_convenience.h4
2 files changed, 29 insertions, 0 deletions
diff --git a/source4/libgpo/ads_convenience.c b/source4/libgpo/ads_convenience.c
index e168cb5e0e..77c4f5bdc2 100644
--- a/source4/libgpo/ads_convenience.c
+++ b/source4/libgpo/ads_convenience.c
@@ -235,6 +235,31 @@ ADS_STATUS ads_build_nt_error(NTSTATUS nt_status)
return ret;
}
+
+bool nt_token_check_sid( const struct dom_sid *sid, const NT_USER_TOKEN *token)
+{
+ int i;
+
+ if (!sid || !token) {
+ return false;
+ }
+
+ if (dom_sid_equal(sid, token->user_sid)) {
+ return true;
+ }
+ if (dom_sid_equal(sid, token->group_sid)) {
+ return true;
+ }
+ for (i = 0; i < token->num_sids; i++) {
+ if (dom_sid_equal(sid, token->sids[i])) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
/*
FIXME
Stub write functions, these do not do anything, though they should. -- Wilco
diff --git a/source4/libgpo/ads_convenience.h b/source4/libgpo/ads_convenience.h
index 48e7357fda..bce2cc4eea 100644
--- a/source4/libgpo/ads_convenience.h
+++ b/source4/libgpo/ads_convenience.h
@@ -47,6 +47,9 @@ typedef struct {
struct ldb_context *ldbctx;
} ADS_STRUCT;
+
+typedef struct security_token NT_USER_TOKEN;
+
typedef struct ldb_result LDAPMessage;
typedef void ** ADS_MODLIST;
@@ -85,6 +88,7 @@ ADS_STATUS ads_msgfree(ADS_STRUCT *ads, LDAPMessage *res);
NTSTATUS ads_ntstatus(ADS_STATUS status);
ADS_STATUS ads_build_ldap_error(int ldb_error);
ADS_STATUS ads_build_nt_error(NTSTATUS nt_status);
+bool nt_token_check_sid( const struct dom_sid *sid, const NT_USER_TOKEN *token);
ADS_MODLIST ads_init_mods(TALLOC_CTX *ctx);
ADS_STATUS ads_mod_str(TALLOC_CTX *ctx, ADS_MODLIST *mods, const char *name, const char *val);
ADS_STATUS ads_gen_mod(ADS_STRUCT *ads, const char *mod_dn, ADS_MODLIST mods);