diff options
author | Günther Deschner <gd@samba.org> | 2013-12-18 19:33:28 +0100 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2014-01-07 16:59:38 +0100 |
commit | a9cb3031bcba1e4f39c71e4e09508e4eec0e833e (patch) | |
tree | e2e3b79a47347fa3ffe3534663f163fdea723e25 /libgpo | |
parent | 19268c5c2654956e2a45c7f8ce27a699e96c930b (diff) | |
download | samba-a9cb3031bcba1e4f39c71e4e09508e4eec0e833e.tar.gz |
libgpo: allow to pass down deleted and changed gpo list to CSE plugins.
Guenther
Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'libgpo')
-rw-r--r-- | libgpo/gpext/gpext.c | 101 | ||||
-rw-r--r-- | libgpo/gpext/gpext.h | 6 | ||||
-rw-r--r-- | libgpo/gpo_util.c | 3 |
3 files changed, 71 insertions, 39 deletions
diff --git a/libgpo/gpext/gpext.c b/libgpo/gpext/gpext.c index 3596d0c74e4..6f960d24d02 100644 --- a/libgpo/gpext/gpext.c +++ b/libgpo/gpext/gpext.c @@ -744,14 +744,14 @@ NTSTATUS gpext_process_extension(TALLOC_CTX *mem_ctx, uint32_t flags, const struct security_token *token, struct registry_key *root_key, - struct GROUP_POLICY_OBJECT *gpo, + const struct GROUP_POLICY_OBJECT *deleted_gpo_list, + const struct GROUP_POLICY_OBJECT *changed_gpo_list, const char *extension_guid, const char *snapin_guid) { NTSTATUS status; struct gp_extension *ext = NULL; - struct GUID guid; - bool cse_found = false; + const struct GROUP_POLICY_OBJECT *gpo; status = gpext_init_gp_extensions(mem_ctx); if (!NT_STATUS_IS_OK(status)) { @@ -760,47 +760,76 @@ NTSTATUS gpext_process_extension(TALLOC_CTX *mem_ctx, return status; } - status = GUID_from_string(extension_guid, &guid); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - for (ext = extensions; ext; ext = ext->next) { - if (GUID_equal(ext->guid, &guid)) { - cse_found = true; - break; + struct GROUP_POLICY_OBJECT *deleted_gpo_list_filtered = NULL; + struct GROUP_POLICY_OBJECT *changed_gpo_list_filtered = NULL; + + for (gpo = deleted_gpo_list; gpo; gpo = gpo->next) { + + bool is_present = false; + + status = gpext_check_gpo_for_gpext_presence(mem_ctx, + flags, + gpo, + ext->guid, + &is_present); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (is_present) { + struct GROUP_POLICY_OBJECT *new_gpo; + + status = gpo_copy(mem_ctx, gpo, &new_gpo); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + DLIST_ADD(deleted_gpo_list_filtered, new_gpo); + } } - } - if (!cse_found) { - goto no_ext; - } + for (gpo = changed_gpo_list; gpo; gpo = gpo->next) { - status = ext->methods->initialize(mem_ctx); - NT_STATUS_NOT_OK_RETURN(status); + bool is_present = false; - status = ext->methods->process_group_policy(mem_ctx, - flags, - root_key, - token, - gpo, - extension_guid, - snapin_guid); - if (!NT_STATUS_IS_OK(status)) { - ext->methods->shutdown(); - } + status = gpext_check_gpo_for_gpext_presence(mem_ctx, + flags, + gpo, + ext->guid, + &is_present); + if (!NT_STATUS_IS_OK(status)) { + return status; + } - return status; + if (is_present) { + struct GROUP_POLICY_OBJECT *new_gpo; - no_ext: - if (flags & GPO_INFO_FLAG_VERBOSE) { - DEBUG(0,("process_extension: no extension available for:\n")); - DEBUGADD(0,("%s (%s) (snapin: %s)\n", - extension_guid, - cse_gpo_guid_string_to_name(extension_guid), - snapin_guid)); + status = gpo_copy(mem_ctx, gpo, &new_gpo); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + DLIST_ADD(changed_gpo_list_filtered, new_gpo); + } + } + + status = ext->methods->initialize(mem_ctx); + NT_STATUS_NOT_OK_RETURN(status); + + status = ext->methods->process_group_policy(mem_ctx, + flags, + root_key, + token, + deleted_gpo_list_filtered, + changed_gpo_list_filtered, + extension_guid, + snapin_guid); + if (!NT_STATUS_IS_OK(status)) { + ext->methods->shutdown(); + } } - return NT_STATUS_OK; + return status; } diff --git a/libgpo/gpext/gpext.h b/libgpo/gpext/gpext.h index c8024a25e86..767bd062b91 100644 --- a/libgpo/gpext/gpext.h +++ b/libgpo/gpext/gpext.h @@ -65,7 +65,8 @@ struct gp_extension_methods { uint32_t flags, struct registry_key *root_key, const struct security_token *token, - struct GROUP_POLICY_OBJECT *gpo, + struct GROUP_POLICY_OBJECT *deleted_gpo_list, + struct GROUP_POLICY_OBJECT *changed_gpo_list, const char *extension_guid, const char *snapin_guid); @@ -108,7 +109,8 @@ NTSTATUS gpext_process_extension(TALLOC_CTX *mem_ctx, uint32_t flags, const struct security_token *token, struct registry_key *root_key, - struct GROUP_POLICY_OBJECT *gpo, + const struct GROUP_POLICY_OBJECT *deleted_gpo_list, + const struct GROUP_POLICY_OBJECT *changed_gpo_list, const char *extension_guid, const char *snapin_guid); diff --git a/libgpo/gpo_util.c b/libgpo/gpo_util.c index 88ebdc0d401..3edb4a59c72 100644 --- a/libgpo/gpo_util.c +++ b/libgpo/gpo_util.c @@ -467,7 +467,8 @@ static NTSTATUS gpo_process_a_gpo(TALLOC_CTX *mem_ctx, } ntstatus = gpext_process_extension(mem_ctx, - flags, token, root_key, gpo, + flags, token, root_key, + NULL, gpo, gp_ext->extensions_guid[i], gp_ext->snapins_guid[i]); if (!NT_STATUS_IS_OK(ntstatus)) { |