summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-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);