netapi: make libnetapi_open_ipc_connection static.
authorGünther Deschner <gd@samba.org>
Tue, 12 Aug 2008 15:59:23 +0000 (17:59 +0200)
committerGünther Deschner <gd@samba.org>
Thu, 14 Aug 2008 10:22:11 +0000 (12:22 +0200)
Guenther
(cherry picked from commit 0259914f8ff04514a8395d8e1af61aadd50c5efb)
(This used to be commit 7edc671cc1007ae216e7efdbcdb9cfa1e547dca5)

source3/lib/netapi/cm.c
source3/lib/netapi/getdc.c
source3/lib/netapi/group.c
source3/lib/netapi/joindomain.c
source3/lib/netapi/localgroup.c
source3/lib/netapi/netapi_private.h
source3/lib/netapi/serverinfo.c
source3/lib/netapi/user.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;
 }
 
index 82fa35d4a1b5a3a7cc81a9c171871977a17ab47c..07a6544af16fb95849846bc3f79066451a458ae9 100644 (file)
@@ -45,12 +45,9 @@ WERROR NetGetDCName_r(struct libnetapi_ctx *ctx,
        NTSTATUS status;
        WERROR werr;
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_netlogon.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_netlogon.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -86,12 +83,9 @@ WERROR NetGetAnyDCName_r(struct libnetapi_ctx *ctx,
        NTSTATUS status;
        WERROR werr;
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_netlogon.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_netlogon.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -146,12 +140,9 @@ WERROR DsGetDcName_r(struct libnetapi_ctx *ctx,
        struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_netlogon.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_netlogon.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
index e057e6de0235fe8e16b5ed0f9f707c2f8ca1629f..f7c93668208d5a6591ea5ab22115f65f29f32ee1 100644 (file)
@@ -71,12 +71,9 @@ WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx,
                        goto done;
        }
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -251,12 +248,9 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx,
                return WERR_INVALID_PARAM;
        }
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -425,12 +419,9 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx,
                return WERR_INVALID_PARAM;
        }
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -669,12 +660,9 @@ WERROR NetGroupGetInfo_r(struct libnetapi_ctx *ctx,
                return WERR_INVALID_PARAM;
        }
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -794,12 +782,9 @@ WERROR NetGroupAddUser_r(struct libnetapi_ctx *ctx,
                return WERR_INVALID_PARAM;
        }
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -924,12 +909,9 @@ WERROR NetGroupDelUser_r(struct libnetapi_ctx *ctx,
                return WERR_INVALID_PARAM;
        }
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -1211,12 +1193,9 @@ WERROR NetGroupEnum_r(struct libnetapi_ctx *ctx,
                        return WERR_UNKNOWN_LEVEL;
        }
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
index 8d5202f07e3bef113096530004086e0ba6d301dd..2a6fc80ca372b30982c076c39e78e20a8ca1efc1 100644 (file)
@@ -105,12 +105,9 @@ WERROR NetJoinDomain_r(struct libnetapi_ctx *ctx,
        WERROR werr;
        unsigned int old_timeout = 0;
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_wkssvc.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server,
+                                  &ndr_table_wkssvc.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -237,12 +234,9 @@ WERROR NetUnjoinDomain_r(struct libnetapi_ctx *ctx,
        WERROR werr;
        unsigned int old_timeout = 0;
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_wkssvc.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_wkssvc.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -290,12 +284,9 @@ WERROR NetGetJoinInformation_r(struct libnetapi_ctx *ctx,
        WERROR werr;
        const char *buffer = NULL;
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_wkssvc.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_wkssvc.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -425,12 +416,9 @@ WERROR NetGetJoinableOUs_r(struct libnetapi_ctx *ctx,
        NTSTATUS status;
        WERROR werr;
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_wkssvc.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_wkssvc.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
index 811e7e8ab6ea99875b6e23a2b1055bba414a135a..25a3427bc1785c88d656d950f065deee7a1ff258 100644 (file)
@@ -150,12 +150,9 @@ WERROR NetLocalGroupAdd_r(struct libnetapi_ctx *ctx,
        ZERO_STRUCT(domain_handle);
        ZERO_STRUCT(alias_handle);
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -279,12 +276,9 @@ WERROR NetLocalGroupDel_r(struct libnetapi_ctx *ctx,
        ZERO_STRUCT(domain_handle);
        ZERO_STRUCT(alias_handle);
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -460,12 +454,9 @@ WERROR NetLocalGroupGetInfo_r(struct libnetapi_ctx *ctx,
        ZERO_STRUCT(domain_handle);
        ZERO_STRUCT(alias_handle);
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -640,12 +631,9 @@ WERROR NetLocalGroupSetInfo_r(struct libnetapi_ctx *ctx,
        ZERO_STRUCT(domain_handle);
        ZERO_STRUCT(alias_handle);
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -791,12 +779,9 @@ WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx,
        ZERO_STRUCT(domain_handle);
        ZERO_STRUCT(alias_handle);
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -1086,13 +1071,10 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx,
                        break;
        }
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
        if (r->in.level == 3) {
-               werr = libnetapi_open_pipe(ctx, cli, &ndr_table_lsarpc.syntax_id,
+               werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                          &ndr_table_lsarpc.syntax_id,
+                                          &cli,
                                           &lsa_pipe);
                if (!W_ERROR_IS_OK(werr)) {
                        goto done;
@@ -1110,7 +1092,9 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx,
                TALLOC_FREE(lsa_pipe);
        }
 
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
index 5c60e994b13375b61883fc543aee04e1565db2d5..4d4c12ae8594fbb7603c9e234a423bfddcfb9180 100644 (file)
@@ -50,13 +50,11 @@ NET_API_STATUS libnetapi_get_username(struct libnetapi_ctx *ctx, char **username
 NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *format, ...);
 NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, char **debuglevel);
 
-WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx,
-                                    const char *server_name,
-                                    struct cli_state **cli);
 WERROR libnetapi_shutdown_cm(struct libnetapi_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);
 WERROR libnetapi_samr_open_domain(struct libnetapi_ctx *mem_ctx,
                                  struct rpc_pipe_client *pipe_cli,
index bd063332bf5fc3dfe14ceb05f9fc27bcfe614cba..5f744bea26021b02b5741aefc999caf0cd132210 100644 (file)
@@ -70,12 +70,9 @@ WERROR NetServerGetInfo_r(struct libnetapi_ctx *ctx,
        WERROR werr;
        union srvsvc_NetSrvInfo info;
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_srvsvc.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_srvsvc.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -171,12 +168,9 @@ WERROR NetServerSetInfo_r(struct libnetapi_ctx *ctx,
        WERROR werr;
        union srvsvc_NetSrvInfo info;
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_srvsvc.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_srvsvc.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -218,12 +212,9 @@ WERROR NetRemoteTOD_r(struct libnetapi_ctx *ctx,
        WERROR werr;
        struct srvsvc_NetRemoteTODInfo *info = NULL;
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_srvsvc.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_srvsvc.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
index c02dfb9dc927eebc1a7fe904b7958d4f79c62dd6..7b530f43083a1a807724917c92fdc811a525658d 100644 (file)
@@ -214,12 +214,9 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx,
                        goto done;
        }
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -385,13 +382,11 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx,
        ZERO_STRUCT(domain_handle);
        ZERO_STRUCT(user_handle);
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
+
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
        }
@@ -751,12 +746,9 @@ WERROR NetUserEnum_r(struct libnetapi_ctx *ctx,
                        return WERR_NOT_SUPPORTED;
        }
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -1044,12 +1036,9 @@ WERROR NetQueryDisplayInformation_r(struct libnetapi_ctx *ctx,
                        return WERR_UNKNOWN_LEVEL;
        }
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -1172,12 +1161,9 @@ WERROR NetUserGetInfo_r(struct libnetapi_ctx *ctx,
                        goto done;
        }
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -1295,12 +1281,9 @@ WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx,
                        goto done;
        }
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -1726,12 +1709,9 @@ WERROR NetUserModalsGet_r(struct libnetapi_ctx *ctx,
                        goto done;
        }
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -2213,12 +2193,9 @@ WERROR NetUserModalsSet_r(struct libnetapi_ctx *ctx,
                        goto done;
        }
 
-       werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = libnetapi_open_pipe(ctx, cli, &ndr_table_samr.syntax_id,
+       werr = libnetapi_open_pipe(ctx, r->in.server_name,
+                                  &ndr_table_samr.syntax_id,
+                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;