s3:rpcclient: give errors and clean up correctly after failing to obtain secret
authorGarming Sam <garming@catalyst.net.nz>
Fri, 29 Nov 2013 01:45:20 +0000 (14:45 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 10 Dec 2013 22:29:10 +0000 (11:29 +1300)
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/rpcclient/rpcclient.c

index fa683b57d27052f73d368988d81f3cb22ec06b4f..ed2abc7c4f9caf1709a1cb700ebffc85030981f9 100644 (file)
@@ -786,6 +786,9 @@ static NTSTATUS do_cmd(struct cli_state *cli,
 
                        account_name = talloc_asprintf(mem_ctx, "%s$", _account_name);
                        if (account_name == NULL) {
+                               DEBUG(0, ("Out of memory creating account name to connect to %s.\n",
+                                         cmd_entry->table->name));
+                               TALLOC_FREE(cmd_entry->rpc_pipe);
                                SAFE_FREE(previous_nt_hash);
                                TALLOC_FREE(mem_ctx);
                                return NT_STATUS_NO_MEMORY;
@@ -799,6 +802,9 @@ static NTSTATUS do_cmd(struct cli_state *cli,
                                                talloc_autofree_context(),
                                                &rpcclient_netlogon_creds);
                        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);
                                SAFE_FREE(previous_nt_hash);
                                TALLOC_FREE(mem_ctx);
                                return ntresult;