summaryrefslogtreecommitdiff
path: root/source3/libnet
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-06-04 02:43:41 +0200
committerGünther Deschner <gd@samba.org>2008-06-04 02:43:41 +0200
commitdddc5725dbb1acb6a2c0379e072fce8e42801548 (patch)
tree36a73ab4024a738d2c4f22b88014db2de00687cf /source3/libnet
parentaa8bfd39ebf33fe569527b744b9008219d0829a1 (diff)
downloadsamba-dddc5725dbb1acb6a2c0379e072fce8e42801548.tar.gz
samba-dddc5725dbb1acb6a2c0379e072fce8e42801548.tar.bz2
samba-dddc5725dbb1acb6a2c0379e072fce8e42801548.zip
libnetjoin: only close existing policy handles while unjoining.
Guenther (This used to be commit 6dbed6e7b7300962e11fdce1a713e6f3ea2cb619)
Diffstat (limited to 'source3/libnet')
-rw-r--r--source3/libnet/libnet_join.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index d0ecd225ad..1ab75d7882 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -1115,6 +1115,10 @@ static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx,
struct samr_Ids name_types;
union samr_UserInfo *info = NULL;
+ ZERO_STRUCT(sam_pol);
+ ZERO_STRUCT(domain_pol);
+ ZERO_STRUCT(user_pol);
+
status = cli_full_connection(&cli, NULL,
r->in.dc_name,
NULL, 0,
@@ -1216,8 +1220,12 @@ static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx,
done:
if (pipe_hnd) {
- rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);
- rpccli_samr_Close(pipe_hnd, mem_ctx, &sam_pol);
+ if (is_valid_policy_hnd(&domain_pol)) {
+ rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);
+ }
+ if (is_valid_policy_hnd(&sam_pol)) {
+ rpccli_samr_Close(pipe_hnd, mem_ctx, &sam_pol);
+ }
TALLOC_FREE(pipe_hnd);
}