summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-12-11 03:39:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:06:30 -0500
commit0470bb74e0553d9923519c1cba281d9c050af4c5 (patch)
tree745203f591515f280008c0c15b6847ff847a85c2 /source4
parenteda727b8652846c9bdf2297400e43787ed53ea49 (diff)
downloadsamba-0470bb74e0553d9923519c1cba281d9c050af4c5.tar.gz
samba-0470bb74e0553d9923519c1cba281d9c050af4c5.tar.bz2
samba-0470bb74e0553d9923519c1cba281d9c050af4c5.zip
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)
Diffstat (limited to 'source4')
-rw-r--r--source4/smb_server/request.c14
1 files changed, 9 insertions, 5 deletions
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);