summaryrefslogtreecommitdiff
path: root/source4/utils/net/net_gpo.c
diff options
context:
space:
mode:
authorWilco Baan Hofman <wilco@baanhofman.nl>2010-05-24 20:11:15 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-06-20 17:19:13 +0200
commit9b5e0fe6bb363aaaba513b0604476616d6cc9fd8 (patch)
tree9d33db4d7ab02a0e5b41185ef1edbcec88d3de51 /source4/utils/net/net_gpo.c
parentc09922cfae1364f2ce8736ae59053805a337658b (diff)
downloadsamba-9b5e0fe6bb363aaaba513b0604476616d6cc9fd8.tar.gz
samba-9b5e0fe6bb363aaaba513b0604476616d6cc9fd8.tar.bz2
samba-9b5e0fe6bb363aaaba513b0604476616d6cc9fd8.zip
Add talloc_frees in error cases in net_gpo.c
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Diffstat (limited to 'source4/utils/net/net_gpo.c')
-rw-r--r--source4/utils/net/net_gpo.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source4/utils/net/net_gpo.c b/source4/utils/net/net_gpo.c
index 6e2abc4b4d..971e88c5dd 100644
--- a/source4/utils/net/net_gpo.c
+++ b/source4/utils/net/net_gpo.c
@@ -55,6 +55,7 @@ static int net_gpo_list_all(struct net_context *ctx, int argc, const char **argv
rv = gp_list_all_gpos(gp_ctx, &gpo);
if (!NT_STATUS_IS_OK(rv)) {
DEBUG(0, ("Failed to list all GPO's: %s\n", get_friendly_nt_error_msg(rv)));
+ talloc_free(gp_ctx);
return 1;
}
@@ -112,6 +113,7 @@ static int net_gpo_get_gpo(struct net_context *ctx, int argc, const char **argv)
rv = gp_get_gpo_info(gp_ctx, argv[0], &gpo);
if (!NT_STATUS_IS_OK(rv)) {
DEBUG(0, ("Failed to get GPO: %s\n", get_friendly_nt_error_msg(rv)));
+ talloc_free(gp_ctx);
return 1;
}
@@ -169,6 +171,7 @@ static int net_gpo_link_get(struct net_context *ctx, int argc, const char **argv
rv = gp_get_gplinks(gp_ctx, argv[0], &links);
if (!NT_STATUS_IS_OK(rv)) {
DEBUG(0, ("Failed to get gplinks: %s\n", get_friendly_nt_error_msg(rv)));
+ talloc_free(gp_ctx);
return 1;
}
@@ -372,6 +375,7 @@ static int net_gpo_link_del(struct net_context *ctx, int argc, const char **argv
status = gp_del_gplink(gp_ctx, argv[0], argv[1]);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Failed to delete gplink: %s\n", get_friendly_nt_error_msg(status)));
+ talloc_free(gp_ctx);
return 1;
}
d_printf("Deleted gplink.\nCurrent Group Policy links:\n\n");
@@ -409,6 +413,7 @@ static int net_gpo_inheritance_get(struct net_context *ctx, int argc, const char
status = gp_get_inheritance(gp_ctx, argv[0], &inheritance);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Failed to set GPO link on container: %s\n", get_friendly_nt_error_msg(status)));
+ talloc_free(gp_ctx);
return 1;
}
@@ -456,6 +461,7 @@ static int net_gpo_inheritance_set(struct net_context *ctx, int argc, const char
status = gp_set_inheritance(gp_ctx, argv[0], inheritance);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Failed to set GPO link on container: %s\n", get_friendly_nt_error_msg(status)));
+ talloc_free(gp_ctx);
return 1;
}
@@ -492,12 +498,14 @@ static int net_gpo_fetch(struct net_context *ctx, int argc, const char **argv)
rv = gp_get_gpo_info(gp_ctx, argv[0], &gpo);
if (!NT_STATUS_IS_OK(rv)) {
DEBUG(0, ("Failed to get GPO: %s\n", get_friendly_nt_error_msg(rv)));
+ talloc_free(gp_ctx);
return 1;
}
rv = gp_fetch_gpt(gp_ctx, gpo, &path);
if (!NT_STATUS_IS_OK(rv)) {
DEBUG(0, ("Failed to fetch GPO: %s\n", get_friendly_nt_error_msg(rv)));
+ talloc_free(gp_ctx);
return 1;
}
d_printf("%s\n", path);
@@ -530,6 +538,7 @@ static int net_gpo_create(struct net_context *ctx, int argc, const char **argv)
rv = gp_create_gpo(gp_ctx, argv[0], &gpo);
if (!NT_STATUS_IS_OK(rv)) {
DEBUG(0, ("Failed to create GPO: %s\n", get_friendly_nt_error_msg(rv)));
+ talloc_free(gp_ctx);
return 1;
}
@@ -564,12 +573,14 @@ static int net_gpo_set_acl(struct net_context *ctx, int argc, const char **argv)
sd = sddl_decode(gp_ctx, argv[1], samdb_domain_sid(gp_ctx->ldb_ctx));
if (sd == NULL) {
DEBUG(0, ("Invalid SDDL\n"));
+ talloc_free(gp_ctx);
return 1;
}
rv = gp_set_acl(gp_ctx, argv[0], sd);
if (!NT_STATUS_IS_OK(rv)) {
DEBUG(0, ("Failed to set ACL on GPO: %s\n", get_friendly_nt_error_msg(rv)));
+ talloc_free(gp_ctx);
return 1;
}