From: Günther Deschner Date: Wed, 18 Dec 2013 14:45:58 +0000 (+0100) Subject: libgpo: remove ads reference from dump calls and make them take const structs. X-Git-Url: http://git.samba.org/?p=metze%2Fsamba%2Fwip.git;a=commitdiff_plain;h=9a4e007d9000f4f02474394659110dcb9b136d0e libgpo: remove ads reference from dump calls and make them take const structs. Guenther Signed-off-by: Günther Deschner Reviewed-by: Andreas Schneider --- diff --git a/libgpo/gpo.h b/libgpo/gpo.h index 40ecd34b6e95..91ce006cd097 100644 --- a/libgpo/gpo.h +++ b/libgpo/gpo.h @@ -228,15 +228,11 @@ const char *cse_gpo_guid_string_to_name(const char *guid); const char *cse_gpo_name_to_guid_string(const char *name); const char *cse_snapin_gpo_guid_string_to_name(const char *guid); void dump_gp_ext(struct GP_EXT *gp_ext, int debuglevel); -void dump_gpo(ADS_STRUCT *ads, - TALLOC_CTX *mem_ctx, - struct GROUP_POLICY_OBJECT *gpo, +void dump_gpo(const struct GROUP_POLICY_OBJECT *gpo, int debuglevel); -void dump_gpo_list(ADS_STRUCT *ads, - TALLOC_CTX *mem_ctx, - struct GROUP_POLICY_OBJECT *gpo_list, +void dump_gpo_list(const struct GROUP_POLICY_OBJECT *gpo_list, int debuglevel); -void dump_gplink(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, struct GP_LINK *gp_link); +void dump_gplink(const struct GP_LINK *gp_link); NTSTATUS gpo_process_a_gpo(TALLOC_CTX *mem_ctx, const struct security_token *token, struct registry_key *root_key, diff --git a/libgpo/gpo_ldap.c b/libgpo/gpo_ldap.c index d46c48f8f3e5..f797c2f8ad53 100644 --- a/libgpo/gpo_ldap.c +++ b/libgpo/gpo_ldap.c @@ -756,7 +756,7 @@ ADS_STATUS ads_get_gpo_list(ADS_STRUCT *ads, if (ADS_ERR_OK(status)) { if (DEBUGLEVEL >= 100) { - dump_gplink(ads, mem_ctx, &gp_link); + dump_gplink(&gp_link); } status = add_gplink_to_gpo_list(ads, mem_ctx, gpo_list, @@ -794,7 +794,7 @@ ADS_STATUS ads_get_gpo_list(ADS_STRUCT *ads, if (ADS_ERR_OK(status)) { if (DEBUGLEVEL >= 100) { - dump_gplink(ads, mem_ctx, &gp_link); + dump_gplink(&gp_link); } /* block inheritance from now on */ @@ -840,7 +840,7 @@ ADS_STATUS ads_get_gpo_list(ADS_STRUCT *ads, if (ADS_ERR_OK(status)) { if (DEBUGLEVEL >= 100) { - dump_gplink(ads, mem_ctx, &gp_link); + dump_gplink(&gp_link); } /* block inheritance from now on */ diff --git a/libgpo/gpo_util.c b/libgpo/gpo_util.c index 8689f2c4cd76..9cba41099bba 100644 --- a/libgpo/gpo_util.c +++ b/libgpo/gpo_util.c @@ -228,15 +228,14 @@ void dump_gp_ext(struct GP_EXT *gp_ext, int debuglevel) /**************************************************************** ****************************************************************/ -void dump_gpo(ADS_STRUCT *ads, - TALLOC_CTX *mem_ctx, - struct GROUP_POLICY_OBJECT *gpo, +void dump_gpo(const struct GROUP_POLICY_OBJECT *gpo, int debuglevel) { int lvl = debuglevel; + TALLOC_CTX *frame = talloc_stackframe(); if (gpo == NULL) { - return; + goto out; } DEBUG(lvl,("---------------------\n\n")); @@ -300,9 +299,9 @@ void dump_gpo(ADS_STRUCT *ads, struct GP_EXT *gp_ext = NULL; - if (!ads_parse_gp_ext(mem_ctx, gpo->machine_extensions, + if (!ads_parse_gp_ext(frame, gpo->machine_extensions, &gp_ext)) { - return; + goto out; } dump_gp_ext(gp_ext, lvl); } @@ -313,9 +312,9 @@ void dump_gpo(ADS_STRUCT *ads, struct GP_EXT *gp_ext = NULL; - if (!ads_parse_gp_ext(mem_ctx, gpo->user_extensions, + if (!ads_parse_gp_ext(frame, gpo->user_extensions, &gp_ext)) { - return; + goto out; } dump_gp_ext(gp_ext, lvl); } @@ -324,29 +323,28 @@ void dump_gpo(ADS_STRUCT *ads, NDR_PRINT_DEBUG(security_descriptor, gpo->security_descriptor); } + out: + talloc_free(frame); } /**************************************************************** ****************************************************************/ -void dump_gpo_list(ADS_STRUCT *ads, - TALLOC_CTX *mem_ctx, - struct GROUP_POLICY_OBJECT *gpo_list, +void dump_gpo_list(const struct GROUP_POLICY_OBJECT *gpo_list, int debuglevel) { - struct GROUP_POLICY_OBJECT *gpo = NULL; + const struct GROUP_POLICY_OBJECT *gpo = NULL; for (gpo = gpo_list; gpo; gpo = gpo->next) { - dump_gpo(ads, mem_ctx, gpo, debuglevel); + dump_gpo(gpo, debuglevel); } } /**************************************************************** ****************************************************************/ -void dump_gplink(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, struct GP_LINK *gp_link) +void dump_gplink(const struct GP_LINK *gp_link) { - ADS_STATUS status; int i; int lvl = 10; @@ -386,22 +384,6 @@ void dump_gplink(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, struct GP_LINK *gp_link) DEBUGADD(lvl,("GPO_LINK_OPT_DISABLED")); } DEBUGADD(lvl,("\n")); - - if (ads != NULL && mem_ctx != NULL) { - - struct GROUP_POLICY_OBJECT gpo; - - status = ads_get_gpo(ads, mem_ctx, - gp_link->link_names[i], - NULL, NULL, &gpo); - if (!ADS_ERR_OK(status)) { - DEBUG(lvl,("get gpo for %s failed: %s\n", - gp_link->link_names[i], - ads_errstr(status))); - return; - } - dump_gpo(ads, mem_ctx, &gpo, lvl); - } } } diff --git a/source3/utils/net_ads_gpo.c b/source3/utils/net_ads_gpo.c index 0a698da0d041..b9b0a1422967 100644 --- a/source3/utils/net_ads_gpo.c +++ b/source3/utils/net_ads_gpo.c @@ -127,7 +127,7 @@ static int net_ads_gpo_refresh(struct net_context *c, int argc, const char **arg for (gpo = gpo_list; gpo; gpo = gpo->next) { - dump_gpo(ads, mem_ctx, gpo, 0); + dump_gpo(gpo, 0); #if 0 char *server, *share, *nt_path, *unix_path; @@ -172,7 +172,7 @@ static int net_ads_gpo_refresh(struct net_context *c, int argc, const char **arg for (gpo = read_list; gpo; gpo = gpo->next) { - dump_gpo(ads, mem_ctx, gpo, 0); + dump_gpo(gpo, 0); #if 0 char *server, *share, *nt_path, *unix_path; @@ -278,7 +278,7 @@ static int net_ads_gpo_list_all(struct net_context *c, int argc, const char **ar goto out; } - dump_gpo(ads, mem_ctx, &gpo, 0); + dump_gpo(&gpo, 0); } out: @@ -350,7 +350,7 @@ static int net_ads_gpo_list(struct net_context *c, int argc, const char **argv) goto out; } - dump_gpo_list(ads, mem_ctx, gpo_list, 0); + dump_gpo_list(gpo_list, 0); out: ads_msgfree(ads, res); @@ -480,7 +480,7 @@ static int net_ads_gpo_link_get(struct net_context *c, int argc, const char **ar goto out; } - dump_gplink(ads, mem_ctx, &gp_link); + dump_gplink(&gp_link); out: talloc_destroy(mem_ctx); @@ -615,7 +615,7 @@ static int net_ads_gpo_get_gpo(struct net_context *c, int argc, const char **arg goto out; } - dump_gpo(ads, mem_ctx, &gpo, 1); + dump_gpo(&gpo, 1); out: talloc_destroy(mem_ctx);