From 0470bb74e0553d9923519c1cba281d9c050af4c5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 11 Dec 2004 03:39:09 +0000 Subject: r4145: make sure we don't set the 32-bit error codes flag unless the client can handle it, even for success packets (this bug was harmless, but can be confusing in ethereal with old clients) (This used to be commit 71e0c7b2ebbb01d64453c59e20911dc5008b9798) --- source4/smb_server/request.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'source4/smb_server/request.c') diff --git a/source4/smb_server/request.c b/source4/smb_server/request.c index 7f13998605..ccbedc7577 100644 --- a/source4/smb_server/request.c +++ b/source4/smb_server/request.c @@ -108,6 +108,8 @@ static void req_setup_chain_reply(struct smbsrv_request *req, uint_t wct, uint_t */ void req_setup_reply(struct smbsrv_request *req, uint_t wct, uint_t buflen) { + uint16_t flags2; + if (req->chain_count != 0) { req_setup_chain_reply(req, wct, buflen); return; @@ -124,6 +126,12 @@ void req_setup_reply(struct smbsrv_request *req, uint_t wct, uint_t buflen) return; } + flags2 = FLAGS2_LONG_PATH_COMPONENTS | FLAGS2_EXTENDED_SECURITY; + flags2 |= (req->flags2 & FLAGS2_UNICODE_STRINGS); + if (req->smb_conn->negotiate.client_caps & CAP_STATUS32) { + flags2 |= FLAGS2_32_BIT_ERROR_CODES; + } + req->out.hdr = req->out.buffer + NBT_HDR_SIZE; req->out.vwv = req->out.hdr + HDR_VWV; req->out.wct = wct; @@ -136,13 +144,9 @@ void req_setup_reply(struct smbsrv_request *req, uint_t wct, uint_t buflen) SCVAL(req->out.hdr, HDR_WCT, wct); SSVAL(req->out.vwv, VWV(wct), buflen); - memcpy(req->out.hdr, "\377SMB", 4); SCVAL(req->out.hdr,HDR_FLG, FLAG_REPLY | FLAG_CASELESS_PATHNAMES); - SSVAL(req->out.hdr,HDR_FLG2, - (req->flags2 & FLAGS2_UNICODE_STRINGS) | - FLAGS2_LONG_PATH_COMPONENTS | FLAGS2_32_BIT_ERROR_CODES | FLAGS2_EXTENDED_SECURITY); - + SSVAL(req->out.hdr,HDR_FLG2, flags2); SSVAL(req->out.hdr,HDR_PIDHIGH,0); memset(req->out.hdr + HDR_SS_FIELD, 0, 10); -- cgit