summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorRobin McCorkell <robin@mccorkell.me.uk>2016-05-02 21:48:14 +0100
committerJeremy Allison <jra@samba.org>2016-05-04 20:35:07 +0200
commit2a872e2b66f373b3c96b315b13c9f06a15522e13 (patch)
treebe3356769a0369bd9d3e850efbc62f1eee8703c2 /source3/libsmb
parent0f6d51f34baa816b6ec422c8bc28687f0a3073de (diff)
downloadsamba-2a872e2b66f373b3c96b315b13c9f06a15522e13.tar.gz
Correctly set cli->raw_status for libsmbclient in SMB2 code
The SMB2 file handling code wasn't correctly setting raw_status, which is used by libsmbclient to report file open errors etc. https://bugzilla.samba.org/show_bug.cgi?id=11276 Signed-off-by: Robin McCorkell <robin@mccorkell.me.uk> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/cli_smb2_fnum.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
index c9f40605e88..a17d918c788 100644
--- a/source3/libsmb/cli_smb2_fnum.c
+++ b/source3/libsmb/cli_smb2_fnum.c
@@ -262,6 +262,7 @@ NTSTATUS cli_smb2_create_fnum_recv(struct tevent_req *req, uint16_t *pfnum,
NTSTATUS status;
if (tevent_req_is_nterror(req, &status)) {
+ state->cli->raw_status = status;
return status;
}
if (pfnum != NULL) {
@@ -270,6 +271,7 @@ NTSTATUS cli_smb2_create_fnum_recv(struct tevent_req *req, uint16_t *pfnum,
if (cr != NULL) {
*cr = state->cr;
}
+ state->cli->raw_status = NT_STATUS_OK;
return NT_STATUS_OK;
}
@@ -390,7 +392,11 @@ static void cli_smb2_close_fnum_done(struct tevent_req *subreq)
NTSTATUS cli_smb2_close_fnum_recv(struct tevent_req *req)
{
- return tevent_req_simple_recv_ntstatus(req);
+ struct cli_smb2_close_fnum_state *state = tevent_req_data(
+ req, struct cli_smb2_close_fnum_state);
+ NTSTATUS status = tevent_req_simple_recv_ntstatus(req);
+ state->cli->raw_status = status;
+ return status;
}
NTSTATUS cli_smb2_close_fnum(struct cli_state *cli, uint16_t fnum)
@@ -2302,6 +2308,7 @@ NTSTATUS cli_smb2_read_recv(struct tevent_req *req,
req, struct cli_smb2_read_state);
if (tevent_req_is_nterror(req, &status)) {
+ state->cli->raw_status = status;
return status;
}
/*
@@ -2311,6 +2318,7 @@ NTSTATUS cli_smb2_read_recv(struct tevent_req *req,
*/
*received = (ssize_t)state->received;
*rcvbuf = state->buf;
+ state->cli->raw_status = NT_STATUS_OK;
return NT_STATUS_OK;
}
@@ -2409,6 +2417,7 @@ NTSTATUS cli_smb2_write_recv(struct tevent_req *req,
NTSTATUS status;
if (tevent_req_is_nterror(req, &status)) {
+ state->cli->raw_status = status;
tevent_req_received(req);
return status;
}
@@ -2416,6 +2425,7 @@ NTSTATUS cli_smb2_write_recv(struct tevent_req *req,
if (pwritten != NULL) {
*pwritten = (size_t)state->written;
}
+ state->cli->raw_status = NT_STATUS_OK;
tevent_req_received(req);
return NT_STATUS_OK;
}
@@ -2573,11 +2583,13 @@ NTSTATUS cli_smb2_writeall_recv(struct tevent_req *req,
NTSTATUS status;
if (tevent_req_is_nterror(req, &status)) {
+ state->cli->raw_status = status;
return status;
}
if (pwritten != NULL) {
*pwritten = (size_t)state->written;
}
+ state->cli->raw_status = NT_STATUS_OK;
return NT_STATUS_OK;
}
@@ -2838,12 +2850,14 @@ NTSTATUS cli_smb2_splice_recv(struct tevent_req *req, off_t *written)
NTSTATUS status;
if (tevent_req_is_nterror(req, &status)) {
+ state->cli->raw_status = status;
tevent_req_received(req);
return status;
}
if (written != NULL) {
*written = state->written;
}
+ state->cli->raw_status = NT_STATUS_OK;
tevent_req_received(req);
return NT_STATUS_OK;
}