netapi: make libnetapi_open_ipc_connection static.
[jra/samba/.git] / source3 / lib / netapi / cm.c
index 8ea31e54f958d760a9f4aa76fbd91aaa83491a64..a5c85bfe6b1a7579365f55415a56ad2a0b77dcda 100644 (file)
@@ -25,9 +25,9 @@
 /********************************************************************
 ********************************************************************/
 
-WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx,
-                                    const char *server_name,
-                                    struct cli_state **cli)
+static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx,
+                                           const char *server_name,
+                                           struct cli_state **cli)
 {
        struct cli_state *cli_ipc = NULL;
 
@@ -161,17 +161,25 @@ static NTSTATUS pipe_cm_open(TALLOC_CTX *ctx,
 ********************************************************************/
 
 WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx,
-                          struct cli_state *cli,
+                          const char *server_name,
                           const struct ndr_syntax_id *interface,
+                          struct cli_state **pcli,
                           struct rpc_pipe_client **presult)
 {
        struct rpc_pipe_client *result = NULL;
        NTSTATUS status;
+       WERROR werr;
+       struct cli_state *cli = NULL;
 
-       if (!cli || !presult) {
+       if (!presult) {
                return WERR_INVALID_PARAM;
        }
 
+       werr = libnetapi_open_ipc_connection(ctx, server_name, &cli);
+       if (!W_ERROR_IS_OK(werr)) {
+               return werr;
+       }
+
        status = pipe_cm_open(ctx, cli, interface, &result);
        if (!NT_STATUS_IS_OK(status)) {
                libnetapi_set_error_string(ctx, "failed to open PIPE %s: %s",
@@ -182,6 +190,8 @@ WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx,
        }
 
        *presult = result;
+       *pcli = cli;
+
        return WERR_OK;
 }