diff options
-rw-r--r-- | source3/libsmb/cli_np_tstream.c | 6 | ||||
-rw-r--r-- | source3/libsmb/smb2cli.h | 10 | ||||
-rw-r--r-- | source3/libsmb/smb2cli_read.c | 26 | ||||
-rw-r--r-- | source3/torture/test_smb2.c | 56 |
4 files changed, 62 insertions, 36 deletions
diff --git a/source3/libsmb/cli_np_tstream.c b/source3/libsmb/cli_np_tstream.c index 658f30850a..d52997fbdf 100644 --- a/source3/libsmb/cli_np_tstream.c +++ b/source3/libsmb/cli_np_tstream.c @@ -742,7 +742,11 @@ static void tstream_cli_np_readv_read_next(struct tevent_req *req) 0, /* offset */ TSTREAM_CLI_NP_MAX_BUF_SIZE); } else { - subreq = smb2cli_read_send(state, state->ev, cli_nps->cli, + subreq = smb2cli_read_send(state, state->ev, + cli_nps->cli->conn, + cli_nps->cli->timeout, + cli_nps->cli->smb2.session, + cli_nps->cli->smb2.tid, TSTREAM_CLI_NP_MAX_BUF_SIZE, /* length */ 0, /* offset */ cli_nps->fid_persistent, diff --git a/source3/libsmb/smb2cli.h b/source3/libsmb/smb2cli.h index 727481a520..12f061524e 100644 --- a/source3/libsmb/smb2cli.h +++ b/source3/libsmb/smb2cli.h @@ -94,7 +94,10 @@ NTSTATUS smb2cli_flush(struct cli_state *cli, struct tevent_req *smb2cli_read_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct cli_state *cli, + struct smbXcli_conn *conn, + uint32_t timeout_msec, + struct smbXcli_session *session, + uint32_t tcon_id, uint32_t length, uint64_t offset, uint64_t fid_persistent, @@ -103,7 +106,10 @@ struct tevent_req *smb2cli_read_send(TALLOC_CTX *mem_ctx, uint64_t remaining_bytes); NTSTATUS smb2cli_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, uint8_t **data, uint32_t *data_length); -NTSTATUS smb2cli_read(struct cli_state *cli, +NTSTATUS smb2cli_read(struct smbXcli_conn *conn, + uint32_t timeout_msec, + struct smbXcli_session *session, + uint32_t tcon_id, uint32_t length, uint64_t offset, uint64_t fid_persistent, diff --git a/source3/libsmb/smb2cli_read.c b/source3/libsmb/smb2cli_read.c index d01e33f42d..8f3362a4ab 100644 --- a/source3/libsmb/smb2cli_read.c +++ b/source3/libsmb/smb2cli_read.c @@ -37,7 +37,10 @@ static void smb2cli_read_done(struct tevent_req *subreq); struct tevent_req *smb2cli_read_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct cli_state *cli, + struct smbXcli_conn *conn, + uint32_t timeout_msec, + struct smbXcli_session *session, + uint32_t tcon_id, uint32_t length, uint64_t offset, uint64_t fid_persistent, @@ -65,12 +68,12 @@ struct tevent_req *smb2cli_read_send(TALLOC_CTX *mem_ctx, SBVAL(fixed, 32, minimum_count); SBVAL(fixed, 40, remaining_bytes); - subreq = smb2cli_req_send(state, ev, cli->conn, SMB2_OP_READ, + subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_READ, 0, 0, /* flags */ - cli->timeout, - cli->smb2.pid, - cli->smb2.tid, - cli->smb2.session, + timeout_msec, + 0xFEFF, /* pid */ + tcon_id, + session, state->fixed, sizeof(state->fixed), state->dyn_pad, sizeof(state->dyn_pad)); if (tevent_req_nomem(subreq, req)) { @@ -138,7 +141,10 @@ NTSTATUS smb2cli_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -NTSTATUS smb2cli_read(struct cli_state *cli, +NTSTATUS smb2cli_read(struct smbXcli_conn *conn, + uint32_t timeout_msec, + struct smbXcli_session *session, + uint32_t tcon_id, uint32_t length, uint64_t offset, uint64_t fid_persistent, @@ -154,7 +160,7 @@ NTSTATUS smb2cli_read(struct cli_state *cli, struct tevent_req *req; NTSTATUS status = NT_STATUS_NO_MEMORY; - if (cli_has_async_calls(cli)) { + if (smbXcli_conn_has_async_calls(conn)) { /* * Can't use sync call while an async call is in flight */ @@ -165,7 +171,9 @@ NTSTATUS smb2cli_read(struct cli_state *cli, if (ev == NULL) { goto fail; } - req = smb2cli_read_send(frame, ev, cli, length, offset, + req = smb2cli_read_send(frame, ev, + conn, timeout_msec, session, tcon_id, + length, offset, fid_persistent, fid_volatile, minimum_count, remaining_bytes); if (req == NULL) { diff --git a/source3/torture/test_smb2.c b/source3/torture/test_smb2.c index 69776f4496..1a4eed95cc 100644 --- a/source3/torture/test_smb2.c +++ b/source3/torture/test_smb2.c @@ -101,9 +101,10 @@ bool run_smb2_basic(int dummy) return false; } - status = smb2cli_read(cli, 0x10000, 0, fid_persistent, - fid_volatile, 2, 0, - talloc_tos(), &result, &nread); + status = smb2cli_read(cli->conn, cli->timeout, cli->smb2.session, + cli->smb2.tid, 0x10000, 0, fid_persistent, + fid_volatile, 2, 0, + talloc_tos(), &result, &nread); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_read returned %s\n", nt_errstr(status)); return false; @@ -343,9 +344,10 @@ bool run_smb2_session_reconnect(int dummy) return false; } - status = smb2cli_read(cli1, 0x10000, 0, fid_persistent, - fid_volatile, 2, 0, - talloc_tos(), &result, &nread); + status = smb2cli_read(cli1->conn, cli1->timeout, cli1->smb2.session, + cli1->smb2.tid, 0x10000, 0, fid_persistent, + fid_volatile, 2, 0, + talloc_tos(), &result, &nread); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_read returned %s\n", nt_errstr(status)); return false; @@ -527,9 +529,10 @@ bool run_smb2_session_reconnect(int dummy) return false; } - status = smb2cli_read(cli2, 0x10000, 0, fid_persistent, - fid_volatile, 2, 0, - talloc_tos(), &result, &nread); + status = smb2cli_read(cli2->conn, cli2->timeout, cli2->smb2.session, + cli2->smb2.tid, 0x10000, 0, fid_persistent, + fid_volatile, 2, 0, + talloc_tos(), &result, &nread); if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED)) { printf("smb2cli_read returned %s\n", nt_errstr(status)); return false; @@ -579,9 +582,10 @@ bool run_smb2_session_reconnect(int dummy) return false; } - status = smb2cli_read(cli2, 0x10000, 0, fid_persistent, - fid_volatile, 2, 0, - talloc_tos(), &result, &nread); + status = smb2cli_read(cli2->conn, cli2->timeout, cli2->smb2.session, + cli2->smb2.tid, 0x10000, 0, fid_persistent, + fid_volatile, 2, 0, + talloc_tos(), &result, &nread); if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED)) { printf("smb2cli_read returned %s\n", nt_errstr(status)); return false; @@ -640,9 +644,10 @@ bool run_smb2_session_reconnect(int dummy) return false; } - status = smb2cli_read(cli2, 0x10000, 0, fid_persistent, - fid_volatile, 2, 0, - talloc_tos(), &result, &nread); + status = smb2cli_read(cli2->conn, cli2->timeout, cli2->smb2.session, + cli2->smb2.tid, 0x10000, 0, fid_persistent, + fid_volatile, 2, 0, + talloc_tos(), &result, &nread); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_read returned %s\n", nt_errstr(status)); return false; @@ -730,9 +735,10 @@ bool run_smb2_tcon_dependence(int dummy) return false; } - status = smb2cli_read(cli, 0x10000, 0, fid_persistent, - fid_volatile, 2, 0, - talloc_tos(), &result, &nread); + status = smb2cli_read(cli->conn, cli->timeout, cli->smb2.session, + cli->smb2.tid, 0x10000, 0, fid_persistent, + fid_volatile, 2, 0, + talloc_tos(), &result, &nread); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_read returned %s\n", nt_errstr(status)); return false; @@ -754,9 +760,10 @@ bool run_smb2_tcon_dependence(int dummy) cli->smb2.tid++; - status = smb2cli_read(cli, 0x10000, 0, fid_persistent, - fid_volatile, 2, 0, - talloc_tos(), &result, &nread); + status = smb2cli_read(cli->conn, cli->timeout, cli->smb2.session, + cli->smb2.tid, 0x10000, 0, fid_persistent, + fid_volatile, 2, 0, + talloc_tos(), &result, &nread); if (!NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_NAME_DELETED)) { printf("smb2cli_read returned %s\n", nt_errstr(status)); return false; @@ -1142,9 +1149,10 @@ bool run_smb2_multi_channel(int dummy) return false; } - status = smb2cli_read(cli2, 0x10000, 0, fid_persistent, - fid_volatile, 2, 0, - talloc_tos(), &result, &nread); + status = smb2cli_read(cli2->conn, cli2->timeout, cli2->smb2.session, + cli2->smb2.tid, 0x10000, 0, fid_persistent, + fid_volatile, 2, 0, + talloc_tos(), &result, &nread); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_read returned %s\n", nt_errstr(status)); return false; |