summaryrefslogtreecommitdiff
path: root/source3/smbd/reply.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-06-05 08:17:16 +0000
committerJeremy Allison <jra@samba.org>2001-06-05 08:17:16 +0000
commit5264e9a2a737d6498be0f346bcbc3b583609abf5 (patch)
treee8c083f14d669229b929ae110e819a3a80f3e1d6 /source3/smbd/reply.c
parent091fd5a1746080b8a988f08557ba5f9df97653a4 (diff)
downloadsamba-5264e9a2a737d6498be0f346bcbc3b583609abf5.tar.gz
samba-5264e9a2a737d6498be0f346bcbc3b583609abf5.tar.bz2
samba-5264e9a2a737d6498be0f346bcbc3b583609abf5.zip
Set correct reply word in large writeX (greater than 64k) replies.
Also added smbtorture test for this. Jeremy. (This used to be commit 6d65556ae8bea45a203defaded8436cbb56965e1)
Diffstat (limited to 'source3/smbd/reply.c')
-rw-r--r--source3/smbd/reply.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 7cb23d8629..d3f2527b35 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2674,6 +2674,7 @@ int reply_write_and_X(connection_struct *conn, char *inbuf,char *outbuf,int leng
unsigned int smb_doff = SVAL(inbuf,smb_vwv11);
unsigned int smblen = smb_len(inbuf);
char *data;
+ BOOL large_writeX = ((CVAL(inbuf,smb_wct) == 14) && (smblen > 0xFFFF));
START_PROFILE(SMBwriteX);
/* If it's an IPC, pass off the pipe handler. */
@@ -2687,7 +2688,7 @@ int reply_write_and_X(connection_struct *conn, char *inbuf,char *outbuf,int leng
CHECK_ERROR(fsp);
/* Deal with possible LARGE_WRITEX */
- if (smblen > 0xFFFF)
+ if (large_writeX)
numtowrite |= ((((size_t)SVAL(inbuf,smb_vwv9)) & 1 )<<16);
if(smb_doff > smblen || (smb_doff + numtowrite > smblen)) {
@@ -2742,7 +2743,9 @@ int reply_write_and_X(connection_struct *conn, char *inbuf,char *outbuf,int leng
set_message(outbuf,6,0,True);
SSVAL(outbuf,smb_vwv2,nwritten);
-
+ if (large_writeX)
+ SSVAL(outbuf,smb_vwv4,(nwritten>>16)&1);
+
if (nwritten < (ssize_t)numtowrite) {
CVAL(outbuf,smb_rcls) = ERRHRD;
SSVAL(outbuf,smb_err,ERRdiskfull);