summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-08-07 14:41:24 -0700
committerStefan Metzmacher <metze@samba.org>2013-08-15 09:07:05 +0200
commit00f784ec91d2cfa95b20327ac20f5bc3fa1f400e (patch)
treef0dfed5bd884049cccd80468295c367e72e7eee6 /source3
parent97288b7f1048c1bf712463293a1e62737738292c (diff)
downloadsamba-00f784ec91d2cfa95b20327ac20f5bc3fa1f400e.tar.gz
samba-00f784ec91d2cfa95b20327ac20f5bc3fa1f400e.tar.bz2
samba-00f784ec91d2cfa95b20327ac20f5bc3fa1f400e.zip
libcli/smb: Fix smb2cli_write_recv() and smb2cli_write() to return the bytes written.
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/cli_np_tstream.c7
-rw-r--r--source3/torture/test_smb2.c14
2 files changed, 12 insertions, 9 deletions
diff --git a/source3/libsmb/cli_np_tstream.c b/source3/libsmb/cli_np_tstream.c
index c7ec664c51..07835a5bc2 100644
--- a/source3/libsmb/cli_np_tstream.c
+++ b/source3/libsmb/cli_np_tstream.c
@@ -527,8 +527,11 @@ static void tstream_cli_np_writev_write_done(struct tevent_req *subreq)
if (cli_nps->is_smb1) {
status = cli_write_andx_recv(subreq, &written);
} else {
- status = smb2cli_write_recv(subreq);
- written = cli_nps->write.ofs; // TODO: get the value from the server
+ uint32_t smb2_written;
+ status = smb2cli_write_recv(subreq, &smb2_written);
+ if (NT_STATUS_IS_OK(status)) {
+ written = smb2_written;
+ }
}
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/torture/test_smb2.c b/source3/torture/test_smb2.c
index ec695da8f6..7ca9f49d1a 100644
--- a/source3/torture/test_smb2.c
+++ b/source3/torture/test_smb2.c
@@ -91,7 +91,7 @@ bool run_smb2_basic(int dummy)
status = smb2cli_write(cli->conn, cli->timeout, cli->smb2.session,
cli->smb2.tcon, strlen(hello), 0, fid_persistent,
- fid_volatile, 0, 0, (const uint8_t *)hello);
+ fid_volatile, 0, 0, (const uint8_t *)hello, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_write returned %s\n", nt_errstr(status));
return false;
@@ -349,7 +349,7 @@ bool run_smb2_session_reconnect(int dummy)
status = smb2cli_write(cli1->conn, cli1->timeout, cli1->smb2.session,
cli1->smb2.tcon, strlen(hello), 0, fid_persistent,
- fid_volatile, 0, 0, (const uint8_t *)hello);
+ fid_volatile, 0, 0, (const uint8_t *)hello, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_write returned %s\n", nt_errstr(status));
return false;
@@ -545,7 +545,7 @@ bool run_smb2_session_reconnect(int dummy)
status = smb2cli_write(cli2->conn, cli2->timeout, cli2->smb2.session,
cli2->smb2.tcon, strlen(hello), 0, fid_persistent,
- fid_volatile, 0, 0, (const uint8_t *)hello);
+ fid_volatile, 0, 0, (const uint8_t *)hello, NULL);
if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED) &&
!NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_NAME_DELETED))
{
@@ -605,7 +605,7 @@ bool run_smb2_session_reconnect(int dummy)
status = smb2cli_write(cli2->conn, cli2->timeout, cli2->smb2.session,
cli1->smb2.tcon, strlen(hello), 0, fid_persistent,
- fid_volatile, 0, 0, (const uint8_t *)hello);
+ fid_volatile, 0, 0, (const uint8_t *)hello, NULL);
if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED) &&
!NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_NAME_DELETED))
{
@@ -670,7 +670,7 @@ bool run_smb2_session_reconnect(int dummy)
status = smb2cli_write(cli2->conn, cli2->timeout, cli2->smb2.session,
cli2->smb2.tcon, strlen(hello), 0, fid_persistent,
- fid_volatile, 0, 0, (const uint8_t *)hello);
+ fid_volatile, 0, 0, (const uint8_t *)hello, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_write returned %s\n", nt_errstr(status));
return false;
@@ -765,7 +765,7 @@ bool run_smb2_tcon_dependence(int dummy)
status = smb2cli_write(cli->conn, cli->timeout, cli->smb2.session,
cli->smb2.tcon, strlen(hello), 0, fid_persistent,
- fid_volatile, 0, 0, (const uint8_t *)hello);
+ fid_volatile, 0, 0, (const uint8_t *)hello, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_write returned %s\n", nt_errstr(status));
return false;
@@ -1172,7 +1172,7 @@ bool run_smb2_multi_channel(int dummy)
status = smb2cli_write(cli1->conn, cli1->timeout, cli1->smb2.session,
cli1->smb2.tcon, strlen(hello), 0, fid_persistent,
- fid_volatile, 0, 0, (const uint8_t *)hello);
+ fid_volatile, 0, 0, (const uint8_t *)hello, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_write returned %s\n", nt_errstr(status));
return false;