From 6612c831a3eb62da7766152e597168b9cec9b8fc Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 23 Jul 2012 22:32:49 +0200 Subject: libcli/smb: pass smbXcli_tcon to smb2cli_flush*() metze --- libcli/smb/smb2cli_flush.c | 14 ++++++++++---- libcli/smb/smbXcli_base.h | 4 ++-- source3/torture/test_smb2.c | 36 ++++++++++++++++++------------------ 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/libcli/smb/smb2cli_flush.c b/libcli/smb/smb2cli_flush.c index 64d47c29c7..ca7a0fe8ba 100644 --- a/libcli/smb/smb2cli_flush.c +++ b/libcli/smb/smb2cli_flush.c @@ -34,13 +34,14 @@ struct tevent_req *smb2cli_flush_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, uint64_t fid_persistent, uint64_t fid_volatile) { struct tevent_req *req, *subreq; struct smb2cli_flush_state *state; uint8_t *fixed; + uint32_t tcon_id = 0; req = tevent_req_create(mem_ctx, &state, struct smb2cli_flush_state); @@ -52,6 +53,10 @@ struct tevent_req *smb2cli_flush_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_FLUSH, 0, 0, /* flags */ timeout_msec, @@ -96,7 +101,7 @@ NTSTATUS smb2cli_flush_recv(struct tevent_req *req) NTSTATUS smb2cli_flush(struct smbXcli_conn *conn, uint32_t timeout_msec, struct smbXcli_session *session, - uint32_t tcon_id, + struct smbXcli_tcon *tcon, uint64_t fid_persistent, uint64_t fid_volatile) { @@ -116,8 +121,9 @@ NTSTATUS smb2cli_flush(struct smbXcli_conn *conn, if (ev == NULL) { goto fail; } - req = smb2cli_flush_send(frame, ev, conn, timeout_msec, session, - tcon_id, fid_persistent, fid_volatile); + req = smb2cli_flush_send(frame, ev, conn, timeout_msec, + session, tcon, + fid_persistent, fid_volatile); if (req == NULL) { goto fail; } diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h index 8e90cde6e6..3092b732aa 100644 --- a/libcli/smb/smbXcli_base.h +++ b/libcli/smb/smbXcli_base.h @@ -428,14 +428,14 @@ struct tevent_req *smb2cli_flush_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, uint64_t fid_persistent, uint64_t fid_volatile); NTSTATUS smb2cli_flush_recv(struct tevent_req *req); NTSTATUS smb2cli_flush(struct smbXcli_conn *conn, uint32_t timeout_msec, struct smbXcli_session *session, - uint32_t tcon_id, + struct smbXcli_tcon *tcon, uint64_t fid_persistent, uint64_t fid_volatile); diff --git a/source3/torture/test_smb2.c b/source3/torture/test_smb2.c index 506db5627e..a511f18647 100644 --- a/source3/torture/test_smb2.c +++ b/source3/torture/test_smb2.c @@ -98,7 +98,7 @@ bool run_smb2_basic(int dummy) } status = smb2cli_flush(cli->conn, cli->timeout, cli->smb2.session, - cli->smb2.tid, fid_persistent, fid_volatile); + cli->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -348,7 +348,7 @@ bool run_smb2_session_reconnect(int dummy) } status = smb2cli_flush(cli1->conn, cli1->timeout, cli1->smb2.session, - cli1->smb2.tid, fid_persistent, fid_volatile); + cli1->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -510,7 +510,7 @@ bool run_smb2_session_reconnect(int dummy) /* check file operation on the old client */ status = smb2cli_flush(cli1->conn, cli1->timeout, cli1->smb2.session, - cli1->smb2.tid, fid_persistent, fid_volatile); + cli1->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_EQUAL(status, NT_STATUS_USER_SESSION_DELETED)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -528,7 +528,7 @@ bool run_smb2_session_reconnect(int dummy) * while create gives ACCESS_DENIED without signing */ status = smb2cli_flush(cli2->conn, cli2->timeout, cli2->smb2.session, - cli2->smb2.tid, fid_persistent, fid_volatile); + cli2->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED) && !NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_NAME_DELETED)) { @@ -590,7 +590,7 @@ bool run_smb2_session_reconnect(int dummy) cli2->smb2.tid = cli1->smb2.tid; status = smb2cli_flush(cli2->conn, cli2->timeout, cli2->smb2.session, - cli2->smb2.tid, fid_persistent, fid_volatile); + cli2->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED) && !NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_NAME_DELETED)) { @@ -672,7 +672,7 @@ bool run_smb2_session_reconnect(int dummy) } status = smb2cli_flush(cli2->conn, cli2->timeout, cli2->smb2.session, - cli2->smb2.tid, fid_persistent, fid_volatile); + cli2->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -768,7 +768,7 @@ bool run_smb2_tcon_dependence(int dummy) } status = smb2cli_flush(cli->conn, cli->timeout, cli->smb2.session, - cli->smb2.tid, fid_persistent, fid_volatile); + cli->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -1181,21 +1181,21 @@ bool run_smb2_multi_channel(int dummy) } status = smb2cli_flush(cli2->conn, cli2->timeout, cli2->smb2.session, - cli2->smb2.tid, fid_persistent, fid_volatile); + cli2->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; } status = smb2cli_flush(cli1->conn, cli1->timeout, cli1->smb2.session, - cli1->smb2.tid, fid_persistent, fid_volatile); + cli1->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; } status = smb2cli_flush(cli3->conn, cli3->timeout, cli3->smb2.session, - cli3->smb2.tid, fid_persistent, fid_volatile); + cli3->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -1295,21 +1295,21 @@ bool run_smb2_multi_channel(int dummy) } status = smb2cli_flush(cli1->conn, cli1->timeout, cli1->smb2.session, - cli1->smb2.tid, fid_persistent, fid_volatile); + cli1->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; } status = smb2cli_flush(cli2->conn, cli2->timeout, cli2->smb2.session, - cli2->smb2.tid, fid_persistent, fid_volatile); + cli2->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; } status = smb2cli_flush(cli3->conn, cli3->timeout, cli3->smb2.session, - cli3->smb2.tid, fid_persistent, fid_volatile); + cli3->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -1402,21 +1402,21 @@ bool run_smb2_multi_channel(int dummy) } status = smb2cli_flush(cli3->conn, cli3->timeout, cli3->smb2.session, - cli3->smb2.tid, fid_persistent, fid_volatile); + cli3->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; } status = smb2cli_flush(cli2->conn, cli2->timeout, cli2->smb2.session, - cli2->smb2.tid, fid_persistent, fid_volatile); + cli2->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; } status = smb2cli_flush(cli1->conn, cli1->timeout, cli1->smb2.session, - cli1->smb2.tid, fid_persistent, fid_volatile); + cli1->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -1605,7 +1605,7 @@ bool run_smb2_session_reauth(int dummy) } status = smb2cli_flush(cli->conn, cli->timeout, cli->smb2.session, - cli->smb2.tid, fid_persistent, fid_volatile); + cli->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -1755,7 +1755,7 @@ bool run_smb2_session_reauth(int dummy) } status = smb2cli_flush(cli->conn, cli->timeout, cli->smb2.session, - cli->smb2.tid, fid_persistent, fid_volatile); + cli->smb2.tcon, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; -- cgit