Skip to content

Commit

Permalink
libgpo: remove ads reference from dump calls and make them take const…
Browse files Browse the repository at this point in the history
… structs.

Guenther

Signed-off-by: Günther Deschner <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
  • Loading branch information
gd authored and cryptomilk committed Jan 7, 2014
1 parent c39425f commit 9a4e007
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 47 deletions.
10 changes: 3 additions & 7 deletions libgpo/gpo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions libgpo/gpo_ldap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down
44 changes: 13 additions & 31 deletions libgpo/gpo_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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;

Expand Down Expand Up @@ -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);
}
}
}

Expand Down
12 changes: 6 additions & 6 deletions source3/utils/net_ads_gpo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9a4e007

Please sign in to comment.