]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
r22145: Fix bug #4494 - reported by Kevin Jamieson <bugzilla@kevinjamieson.com>.
authorJeremy Allison <jra@samba.org>
Mon, 9 Apr 2007 21:01:46 +0000 (21:01 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:19:16 +0000 (12:19 -0500)
If returning a mapped UNIX error from sendfile, don't call chain_reply.
Jeremy.

source/smbd/process.c
source/smbd/reply.c

index 59ad96d880d23be14ed5085c63c665c527b3d8f6..c5db00752577a5aff609acec38adcdba28b5d2a5 100644 (file)
@@ -1161,8 +1161,8 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize)
        char outbuf_saved[smb_wct];
        int outsize = smb_len(outbuf) + 4;
 
-       /* maybe its not chained */
-       if (smb_com2 == 0xFF) {
+       /* Maybe its not chained, or it's an error packet. */
+       if (smb_com2 == 0xFF || SVAL(outbuf,smb_rcls) != 0) {
                SCVAL(outbuf,smb_vwv0,0xFF);
                return outsize;
        }
index d7b3a0fab1e8ecdf4e6bb7cbe497706505e28ac1..eb4106b0c1815ae66fc1b6bca7cc7e00e0da5bda 100644 (file)
@@ -2706,8 +2706,10 @@ int reply_read_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
        }
 
        nread = send_file_readX(conn, inbuf, outbuf, length, bufsize, fsp, startpos, smb_maxcnt);
-       if (nread != -1)
+       /* Only call chain_reply if not an error. */
+       if (nread != -1 && SVAL(outbuf,smb_rcls) == 0) {
                nread = chain_reply(inbuf,outbuf,length,bufsize);
+       }
 
        END_PROFILE(SMBreadX);
        return nread;