Introduce rpc_pipe_np_smb_conn()
authorVolker Lendecke <vl@samba.org>
Sun, 20 Apr 2008 12:05:25 +0000 (14:05 +0200)
committerVolker Lendecke <vl@samba.org>
Sun, 20 Apr 2008 12:08:16 +0000 (14:08 +0200)
This abstracts away all references to rpc_pipe_client->cli, the only reference
is now in cli_pipe.c.
(This used to be commit c56e1c08cef107ff33a34346ceeca3475a102b19)

source3/lib/netapi/cm.c
source3/rpc_client/cli_pipe.c
source3/rpc_server/srv_spoolss_nt.c
source3/rpcclient/cmd_spoolss.c
source3/rpcclient/cmd_test.c
source3/utils/net_rpc.c

index 2e16b98ffba1e1bac3f32c27fc853d2f80b2bcea..ae1091c5044d1e454db65569dd13db6de89657cb 100644 (file)
@@ -99,7 +99,7 @@ static struct rpc_pipe_client *pipe_cm_find(struct cli_state *cli,
 
        for (p = pipe_connections; p; p = p->next) {
 
-               if (!p->pipe->cli) {
+               if (!rpc_pipe_np_smb_conn(p->pipe)) {
                        *status = NT_STATUS_PIPE_EMPTY;
                        return NULL;
                }
index b0d6f8eafd6c5f6fe05bd9db264b29d1be440c39..1ea01c94f047b7a1a44357a9941d9f5e78c9f1b8 100644 (file)
@@ -2140,6 +2140,11 @@ bool rpccli_is_pipe_idx(struct rpc_pipe_client *cli, int pipe_idx)
        return (cli->abstract_syntax == pipe_names[pipe_idx].abstr_syntax);
 }
 
+struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p)
+{
+       return p->cli;
+}
+
 static int rpc_pipe_destructor(struct rpc_pipe_client *p)
 {
        bool ret;
index 722ad5495106b0f73877ecd70850717addc93d62..4c5fcf53418bf5f16e77ee14c8e2d57992fb6793 100644 (file)
@@ -164,7 +164,7 @@ static void srv_spoolss_replycloseprinter(int snum, POLICY_HND *handle)
        /* if it's the last connection, deconnect the IPC$ share */
        if (smb_connections==1) {
 
-               cli_shutdown( notify_cli_pipe->cli );
+               cli_shutdown( rpc_pipe_np_smb_conn(notify_cli_pipe) );
                notify_cli_pipe = NULL; /* The above call shuts downn the pipe also. */
 
                messaging_deregister(smbd_messaging_context(),
index eb42836b6c9f5455aac87db0f566f8284d285f44..c89f98744670c19fcd92612e2533465d9911d589 100644 (file)
@@ -2645,7 +2645,7 @@ static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli,
 {
        fstring printername, servername1, servername2;
        char *printername_path = NULL;
-       struct cli_state *cli_server1 = cli->cli;
+       struct cli_state *cli_server1 = rpc_pipe_np_smb_conn(cli);
        struct cli_state *cli_server2 = NULL;
        struct rpc_pipe_client *cli2 = NULL;
        POLICY_HND hPrinter1, hPrinter2;
index f9ea5c0fc2d6167947f3cdb84ad4ebe123a709a8..dd956604cc579c960aff50df8368f1c74ec94548 100644 (file)
@@ -30,10 +30,12 @@ static NTSTATUS cmd_testme(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
 
        d_printf("testme\n");
 
-       lsa_pipe = cli_rpc_pipe_open_noauth(cli->cli, PI_LSARPC, &status);
+       lsa_pipe = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(cli),
+                                           PI_LSARPC, &status);
        if (lsa_pipe == NULL) goto done;
 
-       samr_pipe = cli_rpc_pipe_open_noauth(cli->cli, PI_SAMR, &status);
+       samr_pipe = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(cli),
+                                            PI_SAMR, &status);
        if (samr_pipe == NULL) goto done;
 
        status = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, False,
index f6f0c4054caf63a32732802a03dbde923339e97d..924398fc33bd2f392e6568b8b1622610a82098ba 100644 (file)
@@ -1221,8 +1221,8 @@ static NTSTATUS rpc_sh_handle_user(TALLOC_CTX *mem_ctx,
        ZERO_STRUCT(domain_pol);
        ZERO_STRUCT(user_pol);
 
-       result = net_rpc_lookup_name(mem_ctx, pipe_hnd->cli, argv[0],
-                                    NULL, NULL, &sid, &type);
+       result = net_rpc_lookup_name(mem_ctx, rpc_pipe_np_smb_conn(pipe_hnd),
+                                    argv[0], NULL, NULL, &sid, &type);
        if (!NT_STATUS_IS_OK(result)) {
                d_fprintf(stderr, "Could not lookup %s: %s\n", argv[0],
                          nt_errstr(result));
@@ -2087,8 +2087,8 @@ static NTSTATUS rpc_add_aliasmem(struct rpc_pipe_client *pipe_hnd,
                return NT_STATUS_UNSUCCESSFUL;
        }
 
-       result = get_sid_from_name(pipe_hnd->cli, mem_ctx, member,
-                                  &member_sid, &member_type);
+       result = get_sid_from_name(rpc_pipe_np_smb_conn(pipe_hnd), mem_ctx,
+                                  member, &member_sid, &member_type);
 
        if (!NT_STATUS_IS_OK(result)) {
                d_fprintf(stderr, "Could not lookup up group member %s\n", member);
@@ -2282,8 +2282,8 @@ static NTSTATUS rpc_del_aliasmem(struct rpc_pipe_client *pipe_hnd,
        if (!sid_split_rid(&sid, &alias_rid))
                return NT_STATUS_UNSUCCESSFUL;
 
-       result = get_sid_from_name(pipe_hnd->cli, mem_ctx, member,
-                                  &member_sid, &member_type);
+       result = get_sid_from_name(rpc_pipe_np_smb_conn(pipe_hnd), mem_ctx,
+                                  member, &member_sid, &member_type);
 
        if (!NT_STATUS_IS_OK(result)) {
                d_fprintf(stderr, "Could not lookup up group member %s\n", member);
@@ -2736,7 +2736,8 @@ static NTSTATUS rpc_list_alias_members(struct rpc_pipe_client *pipe_hnd,
                return NT_STATUS_OK;
        }
 
-       lsa_pipe = cli_rpc_pipe_open_noauth(pipe_hnd->cli, PI_LSARPC, &result);
+       lsa_pipe = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(pipe_hnd),
+                                           PI_LSARPC, &result);
        if (!lsa_pipe) {
                d_fprintf(stderr, "Couldn't open LSA pipe. Error was %s\n",
                        nt_errstr(result) );
@@ -4480,7 +4481,7 @@ static void show_userlist(struct rpc_pipe_client *pipe_hnd,
        int fnum;
        SEC_DESC *share_sd = NULL;
        SEC_DESC *root_sd = NULL;
-       struct cli_state *cli = pipe_hnd->cli;
+       struct cli_state *cli = rpc_pipe_np_smb_conn(pipe_hnd);
        int i;
        union srvsvc_NetShareInfo info;
        WERROR result;
@@ -5945,8 +5946,8 @@ static NTSTATUS vampire_trusted_domain(struct rpc_pipe_client *pipe_hnd,
        data = data_blob(info->password.password->data,
                         info->password.password->length);
 
-       cleartextpwd = decrypt_trustdom_secret(pipe_hnd->cli->pwd.password,
-                                              &data);
+       cleartextpwd = decrypt_trustdom_secret(
+               rpc_pipe_np_smb_conn(pipe_hnd)->pwd.password, &data);
 
        if (cleartextpwd == NULL) {
                DEBUG(0,("retrieved NULL password\n"));