]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
drsuapi: always use tcp for drsuapi.
authorGünther Deschner <gd@samba.org>
Fri, 23 May 2008 23:29:13 +0000 (01:29 +0200)
committerGünther Deschner <gd@samba.org>
Fri, 23 May 2008 23:29:13 +0000 (01:29 +0200)
cli_rpc_pipe_open() now uses tcp transport for drsuapi and named pipe
transport for all other pipes.

This finally allows rpcclient to call dscracknames on windows
(don't forget to call "seal" in advance).

Guenther

source/rpc_client/cli_pipe.c

index 8f410379ab4d72f9d6d34a1323a129ab61de407c..cec2797a732e248ff56ba334b3e5db6598713e5b 100644 (file)
@@ -2796,7 +2796,7 @@ NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
  * 
  ****************************************************************************/
 
-static struct rpc_pipe_client *cli_rpc_pipe_open(struct cli_state *cli, int pipe_idx, NTSTATUS *perr)
+static struct rpc_pipe_client *rpc_pipe_open_np(struct cli_state *cli, int pipe_idx, NTSTATUS *perr)
 {
        struct rpc_pipe_client *result;
        int fnum;
@@ -2849,7 +2849,7 @@ static struct rpc_pipe_client *cli_rpc_pipe_open(struct cli_state *cli, int pipe
        fnum = cli_nt_create(cli, result->trans.np.pipe_name,
                             DESIRED_ACCESS_PIPE);
        if (fnum == -1) {
-               DEBUG(1,("cli_rpc_pipe_open: cli_nt_create failed on pipe %s "
+               DEBUG(1,("rpc_pipe_open_np: cli_nt_create failed on pipe %s "
                         "to machine %s.  Error was %s\n",
                         result->trans.np.pipe_name, cli->desthost,
                         cli_errstr(cli)));
@@ -2868,6 +2868,40 @@ static struct rpc_pipe_client *cli_rpc_pipe_open(struct cli_state *cli, int pipe
        return result;
 }
 
+/****************************************************************************
+ 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)
+{
+       struct rpc_pipe_client *result;
+
+       *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:
+                       result = rpc_pipe_open_np(cli, pipe_idx, perr);
+                       if (result == NULL) {
+                               return NULL;
+                       }
+                       break;
+       }
+
+       *perr = NT_STATUS_OK;
+
+       return result;
+}
+
 /****************************************************************************
  Open a named pipe to an SMB server and bind anonymously.
  ****************************************************************************/