libnetapi_open_pipe does not need to return cli_state
authorVolker Lendecke <vl@samba.org>
Sun, 18 Jan 2009 17:15:49 +0000 (18:15 +0100)
committerVolker Lendecke <vl@samba.org>
Sun, 18 Jan 2009 19:10:06 +0000 (20:10 +0100)
The user session key is also available in rpccli->auth->user_session_key

Guenther, please check!

Thanks,

Volker

source3/lib/netapi/cm.c
source3/lib/netapi/file.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/share.c
source3/lib/netapi/user.c

index 0e059edb29e0ebec6ef88cd8cb101ed17f1114c3..e616a2509f223b44d8470bba6873f0fc9fe91561 100644 (file)
@@ -165,7 +165,6 @@ static NTSTATUS pipe_cm_open(TALLOC_CTX *ctx,
 WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx,
                           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;
@@ -192,7 +191,6 @@ WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx,
        }
 
        *presult = result;
-       *pcli = cli;
 
        return WERR_OK;
 }
index 0d66be0eb171a9890da73703db10b970a896cc79..0d1bc08ad30215a61cc41992f431ba02650cd123 100644 (file)
@@ -32,12 +32,10 @@ WERROR NetFileClose_r(struct libnetapi_ctx *ctx,
 {
        WERROR werr;
        NTSTATUS status;
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
 
        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;
@@ -53,10 +51,6 @@ WERROR NetFileClose_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        return werr;
 }
 
@@ -118,7 +112,6 @@ WERROR NetFileGetInfo_r(struct libnetapi_ctx *ctx,
 {
        WERROR werr;
        NTSTATUS status;
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        union srvsvc_NetFileInfo info;
        uint32_t num_entries = 0;
@@ -137,7 +130,6 @@ WERROR NetFileGetInfo_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -163,10 +155,6 @@ WERROR NetFileGetInfo_r(struct libnetapi_ctx *ctx,
                goto done;
        }
  done:
-       if (!cli) {
-               return werr;
-       }
-
        return werr;
 }
 
@@ -187,7 +175,6 @@ WERROR NetFileEnum_r(struct libnetapi_ctx *ctx,
 {
        WERROR werr;
        NTSTATUS status;
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        struct srvsvc_NetFileInfoCtr info_ctr;
        struct srvsvc_NetFileCtr2 ctr2;
@@ -209,7 +196,6 @@ WERROR NetFileEnum_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -273,10 +259,6 @@ WERROR NetFileEnum_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        return werr;
 }
 
index 76c0d0be2af7b598763ae5a69e036a072a2f24a1..d3f58f6684967f311b5f2a764627cff2ec393fde 100644 (file)
@@ -40,14 +40,12 @@ WERROR NetGetDCName_l(struct libnetapi_ctx *ctx,
 WERROR NetGetDCName_r(struct libnetapi_ctx *ctx,
                      struct NetGetDCName *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
 
        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;
@@ -82,14 +80,12 @@ WERROR NetGetAnyDCName_l(struct libnetapi_ctx *ctx,
 WERROR NetGetAnyDCName_r(struct libnetapi_ctx *ctx,
                         struct NetGetAnyDCName *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
 
        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;
@@ -141,12 +137,10 @@ WERROR DsGetDcName_r(struct libnetapi_ctx *ctx,
 {
        WERROR werr;
        NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
 
        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 95c012a7f6d09306f6a0e64e0776460300b618f6..617bde2c9ae4b078afbb7ca47d834872b3f9ed19 100644 (file)
@@ -30,7 +30,6 @@
 WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx,
                     struct NetGroupAdd *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -73,7 +72,6 @@ WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -195,10 +193,6 @@ WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx,
                                      &group_handle);
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&group_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &group_handle);
        }
@@ -226,7 +220,6 @@ WERROR NetGroupAdd_l(struct libnetapi_ctx *ctx,
 WERROR NetGroupDel_r(struct libnetapi_ctx *ctx,
                     struct NetGroupDel *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -250,7 +243,6 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -362,10 +354,6 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx,
        werr = WERR_OK;
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&group_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &group_handle);
        }
@@ -393,7 +381,6 @@ WERROR NetGroupDel_l(struct libnetapi_ctx *ctx,
 WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx,
                         struct NetGroupSetInfo *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -421,7 +408,6 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -547,10 +533,6 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx,
        werr = WERR_OK;
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&group_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &group_handle);
        }
@@ -639,7 +621,6 @@ static WERROR map_group_info_to_buffer(TALLOC_CTX *mem_ctx,
 WERROR NetGroupGetInfo_r(struct libnetapi_ctx *ctx,
                         struct NetGroupGetInfo *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -662,7 +643,6 @@ WERROR NetGroupGetInfo_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -732,10 +712,6 @@ WERROR NetGroupGetInfo_r(struct libnetapi_ctx *ctx,
                goto done;
        }
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&group_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &group_handle);
        }
@@ -763,7 +739,6 @@ WERROR NetGroupGetInfo_l(struct libnetapi_ctx *ctx,
 WERROR NetGroupAddUser_r(struct libnetapi_ctx *ctx,
                         struct NetGroupAddUser *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -784,7 +759,6 @@ WERROR NetGroupAddUser_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -859,10 +833,6 @@ WERROR NetGroupAddUser_r(struct libnetapi_ctx *ctx,
        werr = WERR_OK;
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&group_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &group_handle);
        }
@@ -890,7 +860,6 @@ WERROR NetGroupAddUser_l(struct libnetapi_ctx *ctx,
 WERROR NetGroupDelUser_r(struct libnetapi_ctx *ctx,
                         struct NetGroupDelUser *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -911,7 +880,6 @@ WERROR NetGroupDelUser_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -985,10 +953,6 @@ WERROR NetGroupDelUser_r(struct libnetapi_ctx *ctx,
        werr = WERR_OK;
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&group_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &group_handle);
        }
@@ -1166,7 +1130,6 @@ static WERROR convert_samr_disp_groups_to_GROUP_INFO_buffer(TALLOC_CTX *mem_ctx,
 WERROR NetGroupEnum_r(struct libnetapi_ctx *ctx,
                      struct NetGroupEnum *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        struct policy_handle connect_handle;
        struct dom_sid2 *domain_sid = NULL;
@@ -1195,7 +1158,6 @@ WERROR NetGroupEnum_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -1260,10 +1222,6 @@ WERROR NetGroupEnum_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        /* if last query */
        if (NT_STATUS_IS_OK(status) ||
            NT_STATUS_IS_ERR(status)) {
@@ -1294,7 +1252,6 @@ WERROR NetGroupGetUsers_r(struct libnetapi_ctx *ctx,
 {
        /* FIXME: this call needs to cope with large replies */
 
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        struct policy_handle connect_handle, domain_handle, group_handle;
        struct lsa_String lsa_account_name;
@@ -1331,7 +1288,6 @@ WERROR NetGroupGetUsers_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -1419,10 +1375,6 @@ WERROR NetGroupGetUsers_r(struct libnetapi_ctx *ctx,
        werr = WERR_OK;
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&group_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &group_handle);
        }
@@ -1450,7 +1402,6 @@ WERROR NetGroupGetUsers_l(struct libnetapi_ctx *ctx,
 WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx,
                          struct NetGroupSetUsers *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        struct policy_handle connect_handle, domain_handle, group_handle;
        struct lsa_String lsa_account_name;
@@ -1494,7 +1445,6 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -1665,10 +1615,6 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx,
        werr = WERR_OK;
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&group_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &group_handle);
        }
index d15e2e733c25f901d55205ae1ea18e5c56b62a3f..9eedc5de03ef62198391251397ae415f1d7bf578 100644 (file)
@@ -98,7 +98,6 @@ WERROR NetJoinDomain_l(struct libnetapi_ctx *mem_ctx,
 WERROR NetJoinDomain_r(struct libnetapi_ctx *ctx,
                       struct NetJoinDomain *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        struct wkssvc_PasswordBuffer *encrypted_password = NULL;
        NTSTATUS status;
@@ -107,7 +106,6 @@ WERROR NetJoinDomain_r(struct libnetapi_ctx *ctx,
 
        werr = libnetapi_open_pipe(ctx, r->in.server,
                                   &ndr_table_wkssvc.syntax_id,
-                                  &cli,
                                   &pipe_cli);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -116,11 +114,11 @@ WERROR NetJoinDomain_r(struct libnetapi_ctx *ctx,
        if (r->in.password) {
                encode_wkssvc_join_password_buffer(ctx,
                                                   r->in.password,
-                                                  &cli->user_session_key,
+                                                  &pipe_cli->auth->user_session_key,
                                                   &encrypted_password);
        }
 
-       old_timeout = cli_set_timeout(cli, 600000);
+       old_timeout = rpccli_set_timeout(pipe_cli, 600000);
 
        status = rpccli_wkssvc_NetrJoinDomain2(pipe_cli, ctx,
                                               r->in.server,
@@ -136,10 +134,8 @@ WERROR NetJoinDomain_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (cli) {
-               if (old_timeout) {
-                       cli_set_timeout(cli, old_timeout);
-               }
+       if (pipe_cli && old_timeout) {
+               rpccli_set_timeout(pipe_cli, old_timeout);
        }
 
        return werr;
@@ -227,7 +223,6 @@ WERROR NetUnjoinDomain_l(struct libnetapi_ctx *mem_ctx,
 WERROR NetUnjoinDomain_r(struct libnetapi_ctx *ctx,
                         struct NetUnjoinDomain *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        struct wkssvc_PasswordBuffer *encrypted_password = NULL;
        NTSTATUS status;
@@ -236,7 +231,6 @@ WERROR NetUnjoinDomain_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -245,11 +239,11 @@ WERROR NetUnjoinDomain_r(struct libnetapi_ctx *ctx,
        if (r->in.password) {
                encode_wkssvc_join_password_buffer(ctx,
                                                   r->in.password,
-                                                  &cli->user_session_key,
+                                                  &pipe_cli->auth->user_session_key,
                                                   &encrypted_password);
        }
 
-       old_timeout = cli_set_timeout(cli, 60000);
+       old_timeout = rpccli_set_timeout(pipe_cli, 60000);
 
        status = rpccli_wkssvc_NetrUnjoinDomain2(pipe_cli, ctx,
                                                 r->in.server_name,
@@ -263,10 +257,8 @@ WERROR NetUnjoinDomain_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (cli) {
-               if (old_timeout) {
-                       cli_set_timeout(cli, old_timeout);
-               }
+       if (pipe_cli && old_timeout) {
+               rpccli_set_timeout(pipe_cli, old_timeout);
        }
 
        return werr;
@@ -278,7 +270,6 @@ WERROR NetUnjoinDomain_r(struct libnetapi_ctx *ctx,
 WERROR NetGetJoinInformation_r(struct libnetapi_ctx *ctx,
                               struct NetGetJoinInformation *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -286,7 +277,6 @@ WERROR NetGetJoinInformation_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -410,7 +400,6 @@ WERROR NetGetJoinableOUs_l(struct libnetapi_ctx *ctx,
 WERROR NetGetJoinableOUs_r(struct libnetapi_ctx *ctx,
                           struct NetGetJoinableOUs *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        struct wkssvc_PasswordBuffer *encrypted_password = NULL;
        NTSTATUS status;
@@ -418,7 +407,6 @@ WERROR NetGetJoinableOUs_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -427,7 +415,7 @@ WERROR NetGetJoinableOUs_r(struct libnetapi_ctx *ctx,
        if (r->in.password) {
                encode_wkssvc_join_password_buffer(ctx,
                                                   r->in.password,
-                                                  &cli->user_session_key,
+                                                  &pipe_cli->auth->user_session_key,
                                                   &encrypted_password);
        }
 
@@ -454,7 +442,6 @@ WERROR NetGetJoinableOUs_r(struct libnetapi_ctx *ctx,
 WERROR NetRenameMachineInDomain_r(struct libnetapi_ctx *ctx,
                                  struct NetRenameMachineInDomain *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        struct wkssvc_PasswordBuffer *encrypted_password = NULL;
        NTSTATUS status;
@@ -462,7 +449,6 @@ WERROR NetRenameMachineInDomain_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -471,7 +457,7 @@ WERROR NetRenameMachineInDomain_r(struct libnetapi_ctx *ctx,
        if (r->in.password) {
                encode_wkssvc_join_password_buffer(ctx,
                                                   r->in.password,
-                                                  &cli->user_session_key,
+                                                  &pipe_cli->auth->user_session_key,
                                                   &encrypted_password);
        }
 
index 5e738e1262cf954fbf48ac2072a111bd05ba126c..13405b553e17968faf3bd89d4d45c54fd646e128 100644 (file)
@@ -113,7 +113,6 @@ static NTSTATUS libnetapi_samr_open_alias_queryinfo(TALLOC_CTX *mem_ctx,
 WERROR NetLocalGroupAdd_r(struct libnetapi_ctx *ctx,
                          struct NetLocalGroupAdd *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -152,7 +151,6 @@ WERROR NetLocalGroupAdd_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -227,10 +225,6 @@ WERROR NetLocalGroupAdd_r(struct libnetapi_ctx *ctx,
        werr = WERR_OK;
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&alias_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &alias_handle);
        }
@@ -260,7 +254,6 @@ WERROR NetLocalGroupAdd_l(struct libnetapi_ctx *ctx,
 WERROR NetLocalGroupDel_r(struct libnetapi_ctx *ctx,
                          struct NetLocalGroupDel *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -278,7 +271,6 @@ WERROR NetLocalGroupDel_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -349,10 +341,6 @@ WERROR NetLocalGroupDel_r(struct libnetapi_ctx *ctx,
        werr = WERR_OK;
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&alias_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &alias_handle);
        }
@@ -427,7 +415,6 @@ static WERROR map_alias_info_to_buffer(TALLOC_CTX *mem_ctx,
 WERROR NetLocalGroupGetInfo_r(struct libnetapi_ctx *ctx,
                              struct NetLocalGroupGetInfo *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -456,7 +443,6 @@ WERROR NetLocalGroupGetInfo_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -530,10 +516,6 @@ WERROR NetLocalGroupGetInfo_r(struct libnetapi_ctx *ctx,
                                        r->out.buffer);
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&alias_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &alias_handle);
        }
@@ -603,7 +585,6 @@ static WERROR map_buffer_to_alias_info(TALLOC_CTX *mem_ctx,
 WERROR NetLocalGroupSetInfo_r(struct libnetapi_ctx *ctx,
                              struct NetLocalGroupSetInfo *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -633,7 +614,6 @@ WERROR NetLocalGroupSetInfo_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -710,10 +690,6 @@ WERROR NetLocalGroupSetInfo_r(struct libnetapi_ctx *ctx,
        werr = WERR_OK;
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&alias_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &alias_handle);
        }
@@ -742,7 +718,6 @@ WERROR NetLocalGroupSetInfo_l(struct libnetapi_ctx *ctx,
 WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx,
                           struct NetLocalGroupEnum *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -781,7 +756,6 @@ WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -911,10 +885,6 @@ WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (ctx->disable_policy_handle_cache) {
                libnetapi_samr_close_domain_handle(ctx, &domain_handle);
                libnetapi_samr_close_builtin_handle(ctx, &builtin_handle);
@@ -997,7 +967,6 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx,
 {
        struct NetLocalGroupAddMembers *r = NULL;
 
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        struct rpc_pipe_client *lsa_pipe = NULL;
        NTSTATUS status;
@@ -1074,7 +1043,6 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx,
        if (r->in.level == 3) {
                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;
@@ -1094,7 +1062,6 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -1267,10 +1234,6 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx,
        werr = WERR_OK;
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&alias_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &alias_handle);
        }
index e6a2eb8e99fd208631d9dc925a017ae1efcd64b9..effe2eb9a076715caf1eb24529243bb2b34873ad 100644 (file)
@@ -54,7 +54,6 @@ WERROR libnetapi_shutdown_cm(struct libnetapi_ctx *ctx);
 WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx,
                           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 b2a134b0afc4e47a5c1ca096ac7217eaa240ea32..d77145eef3cc0b67a7168e0e12fa186651badded 100644 (file)
@@ -161,7 +161,6 @@ static NTSTATUS map_server_info_to_SERVER_INFO_buffer(TALLOC_CTX *mem_ctx,
 WERROR NetServerGetInfo_r(struct libnetapi_ctx *ctx,
                          struct NetServerGetInfo *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -183,7 +182,6 @@ WERROR NetServerGetInfo_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -274,7 +272,6 @@ WERROR NetServerSetInfo_l(struct libnetapi_ctx *ctx,
 WERROR NetServerSetInfo_r(struct libnetapi_ctx *ctx,
                          struct NetServerSetInfo *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -282,7 +279,6 @@ WERROR NetServerSetInfo_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -318,7 +314,6 @@ WERROR NetServerSetInfo_r(struct libnetapi_ctx *ctx,
 WERROR NetRemoteTOD_r(struct libnetapi_ctx *ctx,
                      struct NetRemoteTOD *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -326,7 +321,6 @@ WERROR NetRemoteTOD_r(struct libnetapi_ctx *ctx,
 
        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 e6aed360647311ea5a1fd61dd9d2615d1dbac25b..84c275248da6424dfb2cb0a2fcd1bc70aa348192 100644 (file)
@@ -181,7 +181,6 @@ WERROR NetShareAdd_r(struct libnetapi_ctx *ctx,
 {
        WERROR werr;
        NTSTATUS status;
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        union srvsvc_NetShareInfo info;
 
@@ -201,7 +200,6 @@ WERROR NetShareAdd_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -227,10 +225,6 @@ WERROR NetShareAdd_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        return werr;
 }
 
@@ -251,7 +245,6 @@ WERROR NetShareDel_r(struct libnetapi_ctx *ctx,
 {
        WERROR werr;
        NTSTATUS status;
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
 
        if (!r->in.net_name) {
@@ -260,7 +253,6 @@ WERROR NetShareDel_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -277,10 +269,6 @@ WERROR NetShareDel_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        return werr;
 }
 
@@ -301,7 +289,6 @@ WERROR NetShareEnum_r(struct libnetapi_ctx *ctx,
 {
        WERROR werr;
        NTSTATUS status;
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        struct srvsvc_NetShareInfoCtr info_ctr;
        struct srvsvc_NetShareCtr0 ctr0;
@@ -329,7 +316,6 @@ WERROR NetShareEnum_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -387,10 +373,6 @@ WERROR NetShareEnum_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        return werr;
 }
 
@@ -411,7 +393,6 @@ WERROR NetShareGetInfo_r(struct libnetapi_ctx *ctx,
 {
        WERROR werr;
        NTSTATUS status;
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        union srvsvc_NetShareInfo info;
        uint32_t num_entries = 0;
@@ -436,7 +417,6 @@ WERROR NetShareGetInfo_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -463,10 +443,6 @@ WERROR NetShareGetInfo_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        return werr;
 }
 
@@ -487,7 +463,6 @@ WERROR NetShareSetInfo_r(struct libnetapi_ctx *ctx,
 {
        WERROR werr;
        NTSTATUS status;
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        union srvsvc_NetShareInfo info;
 
@@ -512,7 +487,6 @@ WERROR NetShareSetInfo_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -539,10 +513,6 @@ WERROR NetShareSetInfo_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        return werr;
 }
 
index 770ffe326360ca9a2fc8c6f8311aff041a7d3fd9..9d7f299f59bae03b0ae66b19355dad8b43da8112 100644 (file)
@@ -349,7 +349,6 @@ static NTSTATUS set_user_info_USER_INFO_X(TALLOC_CTX *ctx,
 WERROR NetUserAdd_r(struct libnetapi_ctx *ctx,
                    struct NetUserAdd *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -383,7 +382,6 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -452,7 +450,7 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx,
        uX.usriX_flags |= ACB_NORMAL;
 
        status = set_user_info_USER_INFO_X(ctx, pipe_cli,
-                                          &cli->user_session_key,
+                                          &pipe_cli->auth->user_session_key,
                                           &user_handle,
                                           &uX);
        if (!NT_STATUS_IS_OK(status)) {
@@ -468,10 +466,6 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx,
                               &user_handle);
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&user_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &user_handle);
        }
@@ -499,7 +493,6 @@ WERROR NetUserAdd_l(struct libnetapi_ctx *ctx,
 WERROR NetUserDel_r(struct libnetapi_ctx *ctx,
                    struct NetUserDel *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -516,7 +509,6 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx,
 
        werr = libnetapi_open_pipe(ctx, r->in.server_name,
                                   &ndr_table_samr.syntax_id,
-                                  &cli,
                                   &pipe_cli);
 
        if (!W_ERROR_IS_OK(werr)) {
@@ -587,10 +579,6 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx,
        werr = WERR_OK;
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&user_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &user_handle);
        }
@@ -1188,7 +1176,6 @@ static NTSTATUS libnetapi_samr_lookup_user_map_USER_INFO(TALLOC_CTX *mem_ctx,
 WERROR NetUserEnum_r(struct libnetapi_ctx *ctx,
                     struct NetUserEnum *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        struct policy_handle connect_handle;
        struct dom_sid2 *domain_sid = NULL;
@@ -1229,7 +1216,6 @@ WERROR NetUserEnum_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -1310,10 +1296,6 @@ WERROR NetUserEnum_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        /* if last query */
        if (NT_STATUS_IS_OK(status) ||
            NT_STATUS_IS_ERR(status)) {
@@ -1504,7 +1486,6 @@ static WERROR convert_samr_dispinfo_to_NET_DISPLAY(TALLOC_CTX *mem_ctx,
 WERROR NetQueryDisplayInformation_r(struct libnetapi_ctx *ctx,
                                    struct NetQueryDisplayInformation *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        struct policy_handle connect_handle;
        struct dom_sid2 *domain_sid = NULL;
@@ -1531,7 +1512,6 @@ WERROR NetQueryDisplayInformation_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -1570,10 +1550,6 @@ WERROR NetQueryDisplayInformation_r(struct libnetapi_ctx *ctx,
                                                    r->out.entries_read,
                                                    r->out.buffer);
  done:
-       if (!cli) {
-               return werr;
-       }
-
        /* if last query */
        if (NT_STATUS_IS_OK(status) ||
            NT_STATUS_IS_ERR(status)) {
@@ -1622,7 +1598,6 @@ WERROR NetUserChangePassword_l(struct libnetapi_ctx *ctx,
 WERROR NetUserGetInfo_r(struct libnetapi_ctx *ctx,
                        struct NetUserGetInfo *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -1660,7 +1635,6 @@ WERROR NetUserGetInfo_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -1716,10 +1690,6 @@ WERROR NetUserGetInfo_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&user_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &user_handle);
        }
@@ -1747,7 +1717,6 @@ WERROR NetUserGetInfo_l(struct libnetapi_ctx *ctx,
 WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx,
                        struct NetUserSetInfo *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -1818,7 +1787,6 @@ WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -1877,7 +1845,7 @@ WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx,
        }
 
        status = set_user_info_USER_INFO_X(ctx, pipe_cli,
-                                          &cli->user_session_key,
+                                          &pipe_cli->auth->user_session_key,
                                           &user_handle,
                                           &uX);
        if (!NT_STATUS_IS_OK(status)) {
@@ -1888,10 +1856,6 @@ WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx,
        werr = WERR_OK;
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&user_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &user_handle);
        }
@@ -2209,7 +2173,6 @@ static NTSTATUS query_USER_MODALS_INFO_to_buffer(TALLOC_CTX *mem_ctx,
 WERROR NetUserModalsGet_r(struct libnetapi_ctx *ctx,
                          struct NetUserModalsGet *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -2244,7 +2207,6 @@ WERROR NetUserModalsGet_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -2278,10 +2240,6 @@ WERROR NetUserModalsGet_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (ctx->disable_policy_handle_cache) {
                libnetapi_samr_close_domain_handle(ctx, &domain_handle);
                libnetapi_samr_close_connect_handle(ctx, &connect_handle);
@@ -2680,7 +2638,6 @@ static NTSTATUS set_USER_MODALS_INFO_buffer(TALLOC_CTX *mem_ctx,
 WERROR NetUserModalsSet_r(struct libnetapi_ctx *ctx,
                          struct NetUserModalsSet *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
@@ -2728,7 +2685,6 @@ WERROR NetUserModalsSet_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -2757,10 +2713,6 @@ WERROR NetUserModalsSet_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (ctx->disable_policy_handle_cache) {
                libnetapi_samr_close_domain_handle(ctx, &domain_handle);
                libnetapi_samr_close_connect_handle(ctx, &connect_handle);
@@ -2829,7 +2781,6 @@ NTSTATUS add_GROUP_USERS_INFO_X_buffer(TALLOC_CTX *mem_ctx,
 WERROR NetUserGetGroups_r(struct libnetapi_ctx *ctx,
                          struct NetUserGetGroups *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        struct policy_handle connect_handle, domain_handle, user_handle;
        struct lsa_String lsa_account_name;
@@ -2866,7 +2817,6 @@ WERROR NetUserGetGroups_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -2957,10 +2907,6 @@ WERROR NetUserGetGroups_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (ctx->disable_policy_handle_cache) {
                libnetapi_samr_close_domain_handle(ctx, &domain_handle);
                libnetapi_samr_close_connect_handle(ctx, &connect_handle);
@@ -2984,7 +2930,6 @@ WERROR NetUserGetGroups_l(struct libnetapi_ctx *ctx,
 WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx,
                          struct NetUserSetGroups *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        struct policy_handle connect_handle, domain_handle, user_handle, group_handle;
        struct lsa_String lsa_account_name;
@@ -3027,7 +2972,6 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -3214,10 +3158,6 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx,
        werr = WERR_OK;
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (is_valid_policy_hnd(&group_handle)) {
                rpccli_samr_Close(pipe_cli, ctx, &group_handle);
        }
@@ -3271,7 +3211,6 @@ static NTSTATUS add_LOCALGROUP_USERS_INFO_X_buffer(TALLOC_CTX *mem_ctx,
 WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx,
                               struct NetUserGetLocalGroups *r)
 {
-       struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
        struct policy_handle connect_handle, domain_handle, user_handle,
        builtin_handle;
@@ -3314,7 +3253,6 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx,
 
        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;
@@ -3472,10 +3410,6 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx,
        }
 
  done:
-       if (!cli) {
-               return werr;
-       }
-
        if (ctx->disable_policy_handle_cache) {
                libnetapi_samr_close_domain_handle(ctx, &domain_handle);
                libnetapi_samr_close_connect_handle(ctx, &connect_handle);