diff options
author | Günther Deschner <gd@samba.org> | 2013-12-18 19:59:09 +0100 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2014-01-07 16:59:38 +0100 |
commit | 19268c5c2654956e2a45c7f8ce27a699e96c930b (patch) | |
tree | fd1f0144882a7217409d40450a744ef5cde29f55 /libgpo/gpext | |
parent | 288e883fb0612ffbbcf17c5bf8341872153a3092 (diff) | |
download | samba-19268c5c2654956e2a45c7f8ce27a699e96c930b.tar.gz |
libgpo/gpext: add new gpext_check_gpo_for_gpext_presence() helper function.
It will be used to inspect single members of a gpo list for the presence of a CSE guid.
Guenther
Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'libgpo/gpext')
-rw-r--r-- | libgpo/gpext/gpext.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/libgpo/gpext/gpext.c b/libgpo/gpext/gpext.c index e817f48fd2a..3596d0c74e4 100644 --- a/libgpo/gpext/gpext.c +++ b/libgpo/gpext/gpext.c @@ -694,6 +694,52 @@ NTSTATUS gpext_process_gpo_list_with_extension(TALLOC_CTX *mem_ctx, /**************************************************************** ****************************************************************/ +static NTSTATUS gpext_check_gpo_for_gpext_presence(TALLOC_CTX *mem_ctx, + uint32_t flags, + const struct GROUP_POLICY_OBJECT *gpo, + const struct GUID *guid, + bool *gpext_guid_present) +{ + struct GP_EXT *gp_ext = NULL; + int i; + bool ok; + + *gpext_guid_present = false; + + + if (gpo->link_type == GP_LINK_LOCAL) { + return NT_STATUS_OK; + } + + ok = gpo_get_gp_ext_from_gpo(mem_ctx, flags, gpo, &gp_ext); + if (!ok) { + return NT_STATUS_INVALID_PARAMETER; + } + + if (gp_ext == NULL) { + return NT_STATUS_OK; + } + + for (i = 0; i < gp_ext->num_exts; i++) { + struct GUID guid2; + NTSTATUS status; + + status = GUID_from_string(gp_ext->extensions_guid[i], &guid2); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + if (GUID_equal(guid, &guid2)) { + *gpext_guid_present = true; + return NT_STATUS_OK; + } + } + + return NT_STATUS_OK; +} + +/**************************************************************** +****************************************************************/ + NTSTATUS gpext_process_extension(TALLOC_CTX *mem_ctx, uint32_t flags, const struct security_token *token, |