From a0987247347e473e4802f9267773b0bff68f0187 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Apr 2007 21:01:46 +0000 Subject: r22145: Fix bug #4494 - reported by Kevin Jamieson . If returning a mapped UNIX error from sendfile, don't call chain_reply. Jeremy. (This used to be commit 38404c990db1436241c3a774c51196bc058d7576) --- source3/smbd/process.c | 4 ++-- source3/smbd/reply.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 59ad96d880..c5db007525 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -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; } diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index d7b3a0fab1..eb4106b0c1 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -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; -- cgit