summaryrefslogtreecommitdiff
path: root/source3/utils/net_rpc.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2007-09-17 15:11:20 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:30:50 -0500
commit1130482add933d6a3e0b7f13717e0ae72588c6a2 (patch)
treef0288bcf212a1bcbfefddee50185875b3ce7a47e /source3/utils/net_rpc.c
parent4f051e735b85a24f37e2b844bcbb348f36600420 (diff)
downloadsamba-1130482add933d6a3e0b7f13717e0ae72588c6a2.tar.gz
samba-1130482add933d6a3e0b7f13717e0ae72588c6a2.tar.bz2
samba-1130482add933d6a3e0b7f13717e0ae72588c6a2.zip
r25197: Change net_make_ipc_connection() and net_make_ipc_connection_ex() to
return NTSTATUS to allow for better error propagation. Michael (This used to be commit 46093004a788dae83a4ddb888ca5d72f555c236c)
Diffstat (limited to 'source3/utils/net_rpc.c')
-rw-r--r--source3/utils/net_rpc.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 273a4c7dbd..e44d33d874 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -115,7 +115,12 @@ int run_rpc_command(struct cli_state *cli_arg,
/* make use of cli_state handed over as an argument, if possible */
if (!cli_arg) {
- cli = net_make_ipc_connection(conn_flags);
+ nt_status = net_make_ipc_connection(conn_flags, &cli);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ DEBUG(1, ("failed to make ipc connection: %s\n",
+ nt_errstr(nt_status)));
+ return -1;
+ }
} else {
cli = cli_arg;
}
@@ -5821,8 +5826,10 @@ static int rpc_trustdom_vampire(int argc, const char **argv)
};
/* open \PIPE\lsarpc and open policy handle */
- if (!(cli = net_make_ipc_connection(NET_FLAGS_PDC))) {
- DEBUG(0, ("Couldn't connect to domain controller\n"));
+ nt_status = net_make_ipc_connection(NET_FLAGS_PDC, &cli);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ DEBUG(0, ("Couldn't connect to domain controller: %s\n",
+ nt_errstr(nt_status)));
talloc_destroy(mem_ctx);
return -1;
};
@@ -5964,8 +5971,10 @@ static int rpc_trustdom_list(int argc, const char **argv)
};
/* open \PIPE\lsarpc and open policy handle */
- if (!(cli = net_make_ipc_connection(NET_FLAGS_PDC))) {
- DEBUG(0, ("Couldn't connect to domain controller\n"));
+ nt_status = net_make_ipc_connection(NET_FLAGS_PDC, &cli);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ DEBUG(0, ("Couldn't connect to domain controller: %s\n",
+ nt_errstr(nt_status)));
talloc_destroy(mem_ctx);
return -1;
};
@@ -6132,8 +6141,10 @@ static int rpc_trustdom_list(int argc, const char **argv)
d_printf("%s%s", trusting_dom_names[i], padding);
/* connect to remote domain controller */
- remote_cli = net_make_ipc_connection(NET_FLAGS_PDC | NET_FLAGS_ANONYMOUS);
- if (remote_cli) {
+ nt_status = net_make_ipc_connection(
+ NET_FLAGS_PDC | NET_FLAGS_ANONYMOUS,
+ &remote_cli);
+ if (NT_STATUS_IS_OK(nt_status)) {
/* query for domain's sid */
if (run_rpc_command(remote_cli, PI_LSARPC, 0, rpc_query_domain_sid, argc, argv))
d_fprintf(stderr, "couldn't get domain's sid\n");
@@ -6141,7 +6152,9 @@ static int rpc_trustdom_list(int argc, const char **argv)
cli_shutdown(remote_cli);
} else {
- d_fprintf(stderr, "domain controller is not responding\n");
+ d_fprintf(stderr, "domain controller is not "
+ "responding: %s\n",
+ nt_errstr(nt_status));
};
};