s3:rpcclient: close the connection if setting up the netlogon secure channel fails
authorStefan Metzmacher <metze@samba.org>
Fri, 29 Nov 2013 07:45:38 +0000 (08:45 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 23 Dec 2013 08:18:15 +0000 (09:18 +0100)
This is based on a patch from  Garming Sam <garming@catalyst.net.nz>.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/rpcclient/rpcclient.c

index c88e6b30d81489ac3d78f58302d23cf8e1065a15..eae6bbdb5278e517d3f5dbf630351dd8cd805032 100644 (file)
@@ -769,6 +769,10 @@ static NTSTATUS do_cmd(struct cli_state *cli,
                                               trust_password, &machine_account,
                                               &sec_channel_type))
                        {
+                               DEBUG(0, ("Failed to fetch trust password for %s to connect to %s.\n",
+                                         get_cmdline_auth_info_domain(auth_info),
+                                         cmd_entry->table->name));
+                               TALLOC_FREE(cmd_entry->rpc_pipe);
                                talloc_free(mem_ctx);
                                return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
                        }
@@ -785,6 +789,7 @@ static NTSTATUS do_cmd(struct cli_state *cli,
                        if (!NT_STATUS_IS_OK(ntresult)) {
                                DEBUG(0, ("Could not initialise credentials for %s.\n",
                                          cmd_entry->table->name));
+                               TALLOC_FREE(cmd_entry->rpc_pipe);
                                talloc_free(mem_ctx);
                                return ntresult;
                        }