summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcli/smb/smb2cli_write.c14
-rw-r--r--libcli/smb/smbXcli_base.h4
-rw-r--r--source3/libsmb/cli_np_tstream.c2
-rw-r--r--source3/torture/test_smb2.c14
4 files changed, 20 insertions, 14 deletions
diff --git a/libcli/smb/smb2cli_write.c b/libcli/smb/smb2cli_write.c
index 2850cea398..cd98e5e723 100644
--- a/libcli/smb/smb2cli_write.c
+++ b/libcli/smb/smb2cli_write.c
@@ -35,7 +35,7 @@ struct tevent_req *smb2cli_write_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,
uint32_t length,
uint64_t offset,
uint64_t fid_persistent,
@@ -49,6 +49,7 @@ struct tevent_req *smb2cli_write_send(TALLOC_CTX *mem_ctx,
uint8_t *fixed;
const uint8_t *dyn;
size_t dyn_len;
+ uint32_t tcon_id = 0;
req = tevent_req_create(mem_ctx, &state,
struct smb2cli_write_state);
@@ -75,6 +76,10 @@ struct tevent_req *smb2cli_write_send(TALLOC_CTX *mem_ctx,
dyn_len = sizeof(state->dyn_pad);
}
+ if (tcon) {
+ tcon_id = smb2cli_tcon_current_id(tcon);
+ }
+
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_WRITE,
0, 0, /* flags */
timeout_msec,
@@ -119,7 +124,7 @@ NTSTATUS smb2cli_write_recv(struct tevent_req *req)
NTSTATUS smb2cli_write(struct smbXcli_conn *conn,
uint32_t timeout_msec,
struct smbXcli_session *session,
- uint32_t tcon_id,
+ struct smbXcli_tcon *tcon,
uint32_t length,
uint64_t offset,
uint64_t fid_persistent,
@@ -144,8 +149,9 @@ NTSTATUS smb2cli_write(struct smbXcli_conn *conn,
if (ev == NULL) {
goto fail;
}
- req = smb2cli_write_send(frame, ev, conn, timeout_msec, session,
- tcon_id, length, offset,
+ req = smb2cli_write_send(frame, ev, conn, timeout_msec,
+ session, tcon,
+ length, offset,
fid_persistent, fid_volatile,
remaining_bytes, flags, data);
if (req == NULL) {
diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h
index 7aefffc85d..8e90cde6e6 100644
--- a/libcli/smb/smbXcli_base.h
+++ b/libcli/smb/smbXcli_base.h
@@ -402,7 +402,7 @@ struct tevent_req *smb2cli_write_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,
uint32_t length,
uint64_t offset,
uint64_t fid_persistent,
@@ -414,7 +414,7 @@ NTSTATUS smb2cli_write_recv(struct tevent_req *req);
NTSTATUS smb2cli_write(struct smbXcli_conn *conn,
uint32_t timeout_msec,
struct smbXcli_session *session,
- uint32_t tcon_id,
+ struct smbXcli_tcon *tcon,
uint32_t length,
uint64_t offset,
uint64_t fid_persistent,
diff --git a/source3/libsmb/cli_np_tstream.c b/source3/libsmb/cli_np_tstream.c
index 2ec33d5ac4..8933bc4210 100644
--- a/source3/libsmb/cli_np_tstream.c
+++ b/source3/libsmb/cli_np_tstream.c
@@ -491,7 +491,7 @@ static void tstream_cli_np_writev_write_next(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,
cli_nps->write.ofs, /* length */
0, /* offset */
cli_nps->fid_persistent,
diff --git a/source3/torture/test_smb2.c b/source3/torture/test_smb2.c
index ba5cb8ffba..506db5627e 100644
--- a/source3/torture/test_smb2.c
+++ b/source3/torture/test_smb2.c
@@ -90,7 +90,7 @@ bool run_smb2_basic(int dummy)
}
status = smb2cli_write(cli->conn, cli->timeout, cli->smb2.session,
- cli->smb2.tid, strlen(hello), 0, fid_persistent,
+ cli->smb2.tcon, strlen(hello), 0, fid_persistent,
fid_volatile, 0, 0, (const uint8_t *)hello);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_write returned %s\n", nt_errstr(status));
@@ -340,7 +340,7 @@ bool run_smb2_session_reconnect(int dummy)
}
status = smb2cli_write(cli1->conn, cli1->timeout, cli1->smb2.session,
- cli1->smb2.tid, strlen(hello), 0, fid_persistent,
+ cli1->smb2.tcon, strlen(hello), 0, fid_persistent,
fid_volatile, 0, 0, (const uint8_t *)hello);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_write returned %s\n", nt_errstr(status));
@@ -537,7 +537,7 @@ bool run_smb2_session_reconnect(int dummy)
}
status = smb2cli_write(cli2->conn, cli2->timeout, cli2->smb2.session,
- cli2->smb2.tid, strlen(hello), 0, fid_persistent,
+ cli2->smb2.tcon, strlen(hello), 0, fid_persistent,
fid_volatile, 0, 0, (const uint8_t *)hello);
if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED) &&
!NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_NAME_DELETED))
@@ -599,7 +599,7 @@ bool run_smb2_session_reconnect(int dummy)
}
status = smb2cli_write(cli2->conn, cli2->timeout, cli2->smb2.session,
- cli2->smb2.tid, strlen(hello), 0, fid_persistent,
+ cli2->smb2.tcon, strlen(hello), 0, fid_persistent,
fid_volatile, 0, 0, (const uint8_t *)hello);
if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED) &&
!NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_NAME_DELETED))
@@ -664,7 +664,7 @@ bool run_smb2_session_reconnect(int dummy)
}
status = smb2cli_write(cli2->conn, cli2->timeout, cli2->smb2.session,
- cli2->smb2.tid, strlen(hello), 0, fid_persistent,
+ cli2->smb2.tcon, strlen(hello), 0, fid_persistent,
fid_volatile, 0, 0, (const uint8_t *)hello);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_write returned %s\n", nt_errstr(status));
@@ -760,7 +760,7 @@ bool run_smb2_tcon_dependence(int dummy)
}
status = smb2cli_write(cli->conn, cli->timeout, cli->smb2.session,
- cli->smb2.tid, strlen(hello), 0, fid_persistent,
+ cli->smb2.tcon, strlen(hello), 0, fid_persistent,
fid_volatile, 0, 0, (const uint8_t *)hello);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_write returned %s\n", nt_errstr(status));
@@ -1173,7 +1173,7 @@ bool run_smb2_multi_channel(int dummy)
}
status = smb2cli_write(cli1->conn, cli1->timeout, cli1->smb2.session,
- cli1->smb2.tid, strlen(hello), 0, fid_persistent,
+ cli1->smb2.tcon, strlen(hello), 0, fid_persistent,
fid_volatile, 0, 0, (const uint8_t *)hello);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_write returned %s\n", nt_errstr(status));