1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

libgpo: remove ads reference from dump calls and make them take const structs.

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Günther Deschner 2013-12-18 15:45:58 +01:00 committed by Andreas Schneider
parent c39425f14b
commit 9a4e007d90
4 changed files with 25 additions and 47 deletions

View File

@ -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_gpo_name_to_guid_string(const char *name);
const char *cse_snapin_gpo_guid_string_to_name(const char *guid); 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_gp_ext(struct GP_EXT *gp_ext, int debuglevel);
void dump_gpo(ADS_STRUCT *ads, void dump_gpo(const struct GROUP_POLICY_OBJECT *gpo,
TALLOC_CTX *mem_ctx,
struct GROUP_POLICY_OBJECT *gpo,
int debuglevel); int debuglevel);
void dump_gpo_list(ADS_STRUCT *ads, void dump_gpo_list(const struct GROUP_POLICY_OBJECT *gpo_list,
TALLOC_CTX *mem_ctx,
struct GROUP_POLICY_OBJECT *gpo_list,
int debuglevel); 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, NTSTATUS gpo_process_a_gpo(TALLOC_CTX *mem_ctx,
const struct security_token *token, const struct security_token *token,
struct registry_key *root_key, struct registry_key *root_key,

View File

@ -756,7 +756,7 @@ ADS_STATUS ads_get_gpo_list(ADS_STRUCT *ads,
if (ADS_ERR_OK(status)) { if (ADS_ERR_OK(status)) {
if (DEBUGLEVEL >= 100) { 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, 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 (ADS_ERR_OK(status)) {
if (DEBUGLEVEL >= 100) { if (DEBUGLEVEL >= 100) {
dump_gplink(ads, mem_ctx, &gp_link); dump_gplink(&gp_link);
} }
/* block inheritance from now on */ /* block inheritance from now on */
@ -840,7 +840,7 @@ ADS_STATUS ads_get_gpo_list(ADS_STRUCT *ads,
if (ADS_ERR_OK(status)) { if (ADS_ERR_OK(status)) {
if (DEBUGLEVEL >= 100) { if (DEBUGLEVEL >= 100) {
dump_gplink(ads, mem_ctx, &gp_link); dump_gplink(&gp_link);
} }
/* block inheritance from now on */ /* block inheritance from now on */

View File

@ -228,15 +228,14 @@ void dump_gp_ext(struct GP_EXT *gp_ext, int debuglevel)
/**************************************************************** /****************************************************************
****************************************************************/ ****************************************************************/
void dump_gpo(ADS_STRUCT *ads, void dump_gpo(const struct GROUP_POLICY_OBJECT *gpo,
TALLOC_CTX *mem_ctx,
struct GROUP_POLICY_OBJECT *gpo,
int debuglevel) int debuglevel)
{ {
int lvl = debuglevel; int lvl = debuglevel;
TALLOC_CTX *frame = talloc_stackframe();
if (gpo == NULL) { if (gpo == NULL) {
return; goto out;
} }
DEBUG(lvl,("---------------------\n\n")); DEBUG(lvl,("---------------------\n\n"));
@ -300,9 +299,9 @@ void dump_gpo(ADS_STRUCT *ads,
struct GP_EXT *gp_ext = NULL; 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)) { &gp_ext)) {
return; goto out;
} }
dump_gp_ext(gp_ext, lvl); dump_gp_ext(gp_ext, lvl);
} }
@ -313,9 +312,9 @@ void dump_gpo(ADS_STRUCT *ads,
struct GP_EXT *gp_ext = NULL; 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)) { &gp_ext)) {
return; goto out;
} }
dump_gp_ext(gp_ext, lvl); dump_gp_ext(gp_ext, lvl);
} }
@ -324,29 +323,28 @@ void dump_gpo(ADS_STRUCT *ads,
NDR_PRINT_DEBUG(security_descriptor, gpo->security_descriptor); NDR_PRINT_DEBUG(security_descriptor, gpo->security_descriptor);
} }
out:
talloc_free(frame);
} }
/**************************************************************** /****************************************************************
****************************************************************/ ****************************************************************/
void dump_gpo_list(ADS_STRUCT *ads, void dump_gpo_list(const struct GROUP_POLICY_OBJECT *gpo_list,
TALLOC_CTX *mem_ctx,
struct GROUP_POLICY_OBJECT *gpo_list,
int debuglevel) int debuglevel)
{ {
struct GROUP_POLICY_OBJECT *gpo = NULL; const struct GROUP_POLICY_OBJECT *gpo = NULL;
for (gpo = gpo_list; gpo; gpo = gpo->next) { 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 i;
int lvl = 10; 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,("GPO_LINK_OPT_DISABLED"));
} }
DEBUGADD(lvl,("\n")); 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);
}
} }
} }

View File

@ -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) { for (gpo = gpo_list; gpo; gpo = gpo->next) {
dump_gpo(ads, mem_ctx, gpo, 0); dump_gpo(gpo, 0);
#if 0 #if 0
char *server, *share, *nt_path, *unix_path; 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) { for (gpo = read_list; gpo; gpo = gpo->next) {
dump_gpo(ads, mem_ctx, gpo, 0); dump_gpo(gpo, 0);
#if 0 #if 0
char *server, *share, *nt_path, *unix_path; 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; goto out;
} }
dump_gpo(ads, mem_ctx, &gpo, 0); dump_gpo(&gpo, 0);
} }
out: out:
@ -350,7 +350,7 @@ static int net_ads_gpo_list(struct net_context *c, int argc, const char **argv)
goto out; goto out;
} }
dump_gpo_list(ads, mem_ctx, gpo_list, 0); dump_gpo_list(gpo_list, 0);
out: out:
ads_msgfree(ads, res); 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; goto out;
} }
dump_gplink(ads, mem_ctx, &gp_link); dump_gplink(&gp_link);
out: out:
talloc_destroy(mem_ctx); 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; goto out;
} }
dump_gpo(ads, mem_ctx, &gpo, 1); dump_gpo(&gpo, 1);
out: out:
talloc_destroy(mem_ctx); talloc_destroy(mem_ctx);