libcli/smb: pass smbXcli_tcon to smb2cli_close*()
authorStefan Metzmacher <metze@samba.org>
Mon, 23 Jul 2012 20:32:49 +0000 (22:32 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 24 Jul 2012 20:20:06 +0000 (22:20 +0200)
metze

libcli/smb/smb2cli_close.c
libcli/smb/smbXcli_base.h
source3/libsmb/cli_np_tstream.c
source3/torture/test_smb2.c

index d4cba414161e32d09f68024b05dd117c8da2ead3..42ed65a5de29c1edd6e1d6554096d767d9962df8 100644 (file)
@@ -34,7 +34,7 @@ struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
                                      struct smbXcli_conn *conn,
                                      uint32_t timeout_msec,
                                      struct smbXcli_session *session,
-                                     uint32_t tcon_id,
+                                     struct smbXcli_tcon *tcon,
                                      uint16_t flags,
                                      uint64_t fid_persistent,
                                      uint64_t fid_volatile)
@@ -42,6 +42,7 @@ struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
        struct tevent_req *req, *subreq;
        struct smb2cli_close_state *state;
        uint8_t *fixed;
+       uint32_t tcon_id = 0;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct smb2cli_close_state);
@@ -54,6 +55,10 @@ struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
        SBVAL(fixed, 8, fid_persistent);
        SBVAL(fixed, 16, fid_volatile);
 
+       if (tcon) {
+               tcon_id = smb2cli_tcon_current_id(tcon);
+       }
+
        subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_CLOSE,
                                  0, 0, /* flags */
                                  timeout_msec,
@@ -98,7 +103,7 @@ NTSTATUS smb2cli_close_recv(struct tevent_req *req)
 NTSTATUS smb2cli_close(struct smbXcli_conn *conn,
                       uint32_t timeout_msec,
                       struct smbXcli_session *session,
-                      uint32_t tcon_id,
+                      struct smbXcli_tcon *tcon,
                       uint16_t flags,
                       uint64_t fid_persistent,
                       uint64_t fid_volatile)
@@ -120,7 +125,7 @@ NTSTATUS smb2cli_close(struct smbXcli_conn *conn,
                goto fail;
        }
        req = smb2cli_close_send(frame, ev, conn, timeout_msec,
-                                session, tcon_id,  flags,
+                                session, tcon, flags,
                                 fid_persistent, fid_volatile);
        if (req == NULL) {
                goto fail;
index e65ff144aa810714a0df0bc8ebc0acdb6f5d8ce4..b433c4e769bdb616c637cc0d3fcede539ada72da 100644 (file)
@@ -356,7 +356,7 @@ struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
                                      struct smbXcli_conn *conn,
                                      uint32_t timeout_msec,
                                      struct smbXcli_session *session,
-                                     uint32_t tcon_id,
+                                     struct smbXcli_tcon *tcon,
                                      uint16_t flags,
                                      uint64_t fid_persistent,
                                      uint64_t fid_volatile);
@@ -364,7 +364,7 @@ NTSTATUS smb2cli_close_recv(struct tevent_req *req);
 NTSTATUS smb2cli_close(struct smbXcli_conn *conn,
                       uint32_t timeout_msec,
                       struct smbXcli_session *session,
-                      uint32_t tcon_id,
+                      struct smbXcli_tcon *tcon,
                       uint16_t flags,
                       uint64_t fid_persistent,
                       uint64_t fid_volatile);
index 7482f9da6236f377a2f7881d6a6017b1e443511e..47333868dc32f3a2b6983639580df80515e0876d 100644 (file)
@@ -99,7 +99,8 @@ static int tstream_cli_np_destructor(struct tstream_cli_np *cli_nps)
                status = smb2cli_close(cli_nps->cli->conn,
                                       cli_nps->cli->timeout,
                                       cli_nps->cli->smb2.session,
-                                      cli_nps->cli->smb2.tid, 0,
+                                      cli_nps->cli->smb2.tcon,
+                                      0, /* flags */
                                       cli_nps->fid_persistent,
                                       cli_nps->fid_volatile);
        }
@@ -574,7 +575,7 @@ static void tstream_cli_np_writev_disconnect_now(struct tevent_req *req,
                                            cli_nps->cli->conn,
                                            cli_nps->cli->timeout,
                                            cli_nps->cli->smb2.session,
-                                           cli_nps->cli->smb2.tid,
+                                           cli_nps->cli->smb2.tcon,
                                            0, /* flags */
                                            cli_nps->fid_persistent,
                                            cli_nps->fid_volatile);
@@ -1036,7 +1037,7 @@ static void tstream_cli_np_readv_disconnect_now(struct tevent_req *req,
                                            cli_nps->cli->conn,
                                            cli_nps->cli->timeout,
                                            cli_nps->cli->smb2.session,
-                                           cli_nps->cli->smb2.tid,
+                                           cli_nps->cli->smb2.tcon,
                                            0, /* flags */
                                            cli_nps->fid_persistent,
                                            cli_nps->fid_volatile);
@@ -1172,7 +1173,7 @@ static struct tevent_req *tstream_cli_np_disconnect_send(TALLOC_CTX *mem_ctx,
                subreq = smb2cli_close_send(state, ev, cli_nps->cli->conn,
                                            cli_nps->cli->timeout,
                                            cli_nps->cli->smb2.session,
-                                           cli_nps->cli->smb2.tid,
+                                           cli_nps->cli->smb2.tcon,
                                            0, /* flags */
                                            cli_nps->fid_persistent,
                                            cli_nps->fid_volatile);
index 6177817dae70cd23f83cbf3e775b1f8bf75f8ed6..a4655dc05d8605df4a53071305e4cd36b35f440c 100644 (file)
@@ -126,7 +126,7 @@ bool run_smb2_basic(int dummy)
        }
 
        status = smb2cli_close(cli->conn, cli->timeout, cli->smb2.session,
-                              cli->smb2.tid, 0, fid_persistent, fid_volatile);
+                              cli->smb2.tcon, 0, fid_persistent, fid_volatile);
        if (!NT_STATUS_IS_OK(status)) {
                printf("smb2cli_close returned %s\n", nt_errstr(status));
                return false;
@@ -162,7 +162,7 @@ bool run_smb2_basic(int dummy)
        }
 
        status = smb2cli_close(cli->conn, cli->timeout, cli->smb2.session,
-                              cli->smb2.tid, 0, fid_persistent, fid_volatile);
+                              cli->smb2.tcon, 0, fid_persistent, fid_volatile);
        if (!NT_STATUS_IS_OK(status)) {
                printf("smb2cli_close returned %s\n", nt_errstr(status));
                return false;
@@ -1385,7 +1385,7 @@ bool run_smb2_multi_channel(int dummy)
        }
 
        status = smb2cli_close(cli3->conn, cli3->timeout, cli3->smb2.session,
-                              cli3->smb2.tid, 0, fid_persistent, fid_volatile);
+                              cli3->smb2.tcon, 0, fid_persistent, fid_volatile);
        if (!NT_STATUS_IS_OK(status)) {
                printf("smb2cli_close returned %s\n", nt_errstr(status));
                return false;
@@ -1830,7 +1830,7 @@ bool run_smb2_session_reauth(int dummy)
        }
 
        status = smb2cli_close(cli->conn, cli->timeout, cli->smb2.session,
-                              cli->smb2.tid, 0, fid_persistent, fid_volatile);
+                              cli->smb2.tcon, 0, fid_persistent, fid_volatile);
        if (!NT_STATUS_IS_OK(status)) {
                printf("smb2cli_close returned %s\n", nt_errstr(status));
                return false;
@@ -1864,14 +1864,14 @@ bool run_smb2_session_reauth(int dummy)
        }
 
        status = smb2cli_close(cli->conn, cli->timeout, cli->smb2.session,
-                              cli->smb2.tid, 0, dir_persistent, dir_volatile);
+                              cli->smb2.tcon, 0, dir_persistent, dir_volatile);
        if (!NT_STATUS_IS_OK(status)) {
                printf("smb2cli_close returned %s\n", nt_errstr(status));
                return false;
        }
 
        status = smb2cli_close(cli->conn, cli->timeout, cli->smb2.session,
-                              cli->smb2.tid, 0, fid_persistent, fid_volatile);
+                              cli->smb2.tcon, 0, fid_persistent, fid_volatile);
        if (!NT_STATUS_IS_OK(status)) {
                printf("smb2cli_close returned %s\n", nt_errstr(status));
                return false;