diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-06-16 06:49:24 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:56:42 -0500 |
commit | b00103dac1bf9e559e132c62e768dba9408b94eb (patch) | |
tree | 34673c3c65854992a7bc16b95e9e6d1d976b2979 /source4/smb_server | |
parent | eca6982a951b7f7051d6386a58cf35caedc84f3b (diff) | |
download | samba-b00103dac1bf9e559e132c62e768dba9408b94eb.tar.gz samba-b00103dac1bf9e559e132c62e768dba9408b94eb.tar.bz2 samba-b00103dac1bf9e559e132c62e768dba9408b94eb.zip |
r1165: fixed handling of SMBtrans replies that should return STATUS_BUFFER_OVERFLOW when more data is present.
(This used to be commit 0e557fe85748558affd20a58455c4b75fee69e27)
Diffstat (limited to 'source4/smb_server')
-rw-r--r-- | source4/smb_server/request.c | 33 | ||||
-rw-r--r-- | source4/smb_server/trans2.c | 6 |
2 files changed, 25 insertions, 14 deletions
diff --git a/source4/smb_server/request.c b/source4/smb_server/request.c index b1e3b5f66e..8f545e8f59 100644 --- a/source4/smb_server/request.c +++ b/source4/smb_server/request.c @@ -297,29 +297,23 @@ void req_reply_dos_error(struct request_context *req, uint8_t eclass, uint16_t e SCVAL(req->out.hdr, HDR_RCLS, eclass); SSVAL(req->out.hdr, HDR_ERR, ecode); - - SSVAL(req->out.hdr, HDR_FLG2, SVAL(req->out.hdr, HDR_FLG2) & ~FLAGS2_32_BIT_ERROR_CODES); - + SSVAL(req->out.hdr, HDR_FLG2, SVAL(req->out.hdr, HDR_FLG2) & ~FLAGS2_32_BIT_ERROR_CODES); req_send_reply(req); } /* - construct and send an error packet, then destroy the request - auto-converts to DOS error format when appropriate + setup the header of a reply to include an NTSTATUS code */ -void req_reply_error(struct request_context *req, NTSTATUS status) +void req_setup_error(struct request_context *req, NTSTATUS status) { - req_setup_reply(req, 0, 0); - - /* error returns never have any data */ - req_grow_data(req, 0); - if (!lp_nt_status_support() || !(req->smb->negotiate.client_caps & CAP_STATUS32)) { /* convert to DOS error codes */ uint8_t eclass; uint32_t ecode; ntstatus_to_dos(status, &eclass, &ecode); - req_reply_dos_error(req, eclass, ecode); + SCVAL(req->out.hdr, HDR_RCLS, eclass); + SSVAL(req->out.hdr, HDR_ERR, ecode); + SSVAL(req->out.hdr, HDR_FLG2, SVAL(req->out.hdr, HDR_FLG2) & ~FLAGS2_32_BIT_ERROR_CODES); return; } @@ -332,7 +326,20 @@ void req_reply_error(struct request_context *req, NTSTATUS status) SIVAL(req->out.hdr, HDR_RCLS, NT_STATUS_V(status)); SSVAL(req->out.hdr, HDR_FLG2, SVAL(req->out.hdr, HDR_FLG2) | FLAGS2_32_BIT_ERROR_CODES); } - +} + +/* + construct and send an error packet, then destroy the request + auto-converts to DOS error format when appropriate +*/ +void req_reply_error(struct request_context *req, NTSTATUS status) +{ + req_setup_reply(req, 0, 0); + + /* error returns never have any data */ + req_grow_data(req, 0); + + req_setup_error(req, status); req_send_reply(req); } diff --git a/source4/smb_server/trans2.c b/source4/smb_server/trans2.c index b755c6dd7c..6985e0a4d1 100644 --- a/source4/smb_server/trans2.c +++ b/source4/smb_server/trans2.c @@ -1307,7 +1307,7 @@ void reply_trans_generic(struct request_context *req, uint8_t command) status = trans2_backend(req, &trans); } - if (!NT_STATUS_IS_OK(status)) { + if (NT_STATUS_IS_ERR(status)) { req_reply_error(req, status); return; } @@ -1326,6 +1326,10 @@ void reply_trans_generic(struct request_context *req, uint8_t command) uint_t align1 = 1, align2 = (params_left ? 2 : 0); req_setup_reply(req, 10 + trans.out.setup_count, 0); + + if (!NT_STATUS_IS_OK(status)) { + req_setup_error(req, status); + } max_bytes = req_max_data(req) - (align1 + align2); |