summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-07-20 11:04:31 +0200
committerVolker Lendecke <vl@samba.org>2008-07-20 17:06:22 +0200
commit18fb7e09776e26dacfa2329607f8a20699ad2969 (patch)
tree10f9abeae7e6fb1494b0873fe377a1d5b9ad7669
parenteb68e95d9a20ab844ea6487ba44997aebc57c47b (diff)
downloadsamba-18fb7e09776e26dacfa2329607f8a20699ad2969.tar.gz
samba-18fb7e09776e26dacfa2329607f8a20699ad2969.tar.bz2
samba-18fb7e09776e26dacfa2329607f8a20699ad2969.zip
Refactoring: Change calling conventions for cli_rpc_pipe_open
Pass in ndr_syntax_id instead of pipe_idx, return NTSTATUS (This used to be commit 6c122457ff3f22e20dbb595dc6d5fb49689f4d61)
-rw-r--r--source3/rpc_client/cli_pipe.c58
1 files changed, 23 insertions, 35 deletions
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index b0bbeda3ae..1a55bc20da 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -2965,36 +2965,20 @@ static NTSTATUS rpc_pipe_open_np(struct cli_state *cli,
Open a pipe to a remote server.
****************************************************************************/
-static struct rpc_pipe_client *cli_rpc_pipe_open(struct cli_state *cli,
- int pipe_idx,
- NTSTATUS *perr)
+static NTSTATUS cli_rpc_pipe_open(struct cli_state *cli,
+ const struct ndr_syntax_id *interface,
+ struct rpc_pipe_client **presult)
{
- struct rpc_pipe_client *result = NULL;
-
- *perr = NT_STATUS_PIPE_NOT_AVAILABLE;
-
- switch (pipe_idx) {
- case PI_DRSUAPI:
- *perr = rpc_pipe_open_tcp(NULL, cli->desthost,
- &ndr_table_drsuapi.syntax_id,
- &result);
- if (!NT_STATUS_IS_OK(*perr)) {
- return NULL;
- }
- break;
- default:
- *perr = rpc_pipe_open_np(
- cli, pipe_names[pipe_idx].abstr_syntax,
- &result);
- if (result == NULL) {
- return NULL;
- }
- break;
+ if (ndr_syntax_id_equal(interface, &ndr_table_drsuapi.syntax_id)) {
+ /*
+ * We should have a better way to figure out this drsuapi
+ * speciality...
+ */
+ return rpc_pipe_open_tcp(NULL, cli->desthost, interface,
+ presult);
}
- *perr = NT_STATUS_OK;
-
- return result;
+ return rpc_pipe_open_np(cli, interface, presult);
}
/****************************************************************************
@@ -3006,8 +2990,9 @@ struct rpc_pipe_client *cli_rpc_pipe_open_noauth(struct cli_state *cli, int pipe
struct rpc_pipe_client *result;
struct cli_pipe_auth_data *auth;
- result = cli_rpc_pipe_open(cli, pipe_idx, perr);
- if (result == NULL) {
+ *perr = cli_rpc_pipe_open(cli, pipe_names[pipe_idx].abstr_syntax,
+ &result);
+ if (!NT_STATUS_IS_OK(*perr)) {
return NULL;
}
@@ -3074,8 +3059,9 @@ static struct rpc_pipe_client *cli_rpc_pipe_open_ntlmssp_internal(struct cli_sta
struct rpc_pipe_client *result;
struct cli_pipe_auth_data *auth;
- result = cli_rpc_pipe_open(cli, pipe_idx, perr);
- if (result == NULL) {
+ *perr = cli_rpc_pipe_open(cli, pipe_names[pipe_idx].abstr_syntax,
+ &result);
+ if (!NT_STATUS_IS_OK(*perr)) {
return NULL;
}
@@ -3249,8 +3235,9 @@ struct rpc_pipe_client *cli_rpc_pipe_open_schannel_with_key(struct cli_state *cl
struct rpc_pipe_client *result;
struct cli_pipe_auth_data *auth;
- result = cli_rpc_pipe_open(cli, pipe_idx, perr);
- if (result == NULL) {
+ *perr = cli_rpc_pipe_open(cli, pipe_names[pipe_idx].abstr_syntax,
+ &result);
+ if (!NT_STATUS_IS_OK(*perr)) {
return NULL;
}
@@ -3408,8 +3395,9 @@ struct rpc_pipe_client *cli_rpc_pipe_open_krb5(struct cli_state *cli,
struct rpc_pipe_client *result;
struct cli_pipe_auth_data *auth;
- result = cli_rpc_pipe_open(cli, pipe_idx, perr);
- if (result == NULL) {
+ *perr = cli_rpc_pipe_open(cli, pipe_names[pipe_idx].abstr_syntax,
+ &result);
+ if (!NT_STATUS_IS_OK(*perr)) {
return NULL;
}