diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 5cdc59b..4f46189 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3263,14 +3263,20 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req, return; } - if (startpos > sbuf.st_size) { - smb_maxcnt = 0; - } else if (smb_maxcnt > (sbuf.st_size - startpos)) { - smb_maxcnt = (sbuf.st_size - startpos); - } + if (S_ISREG(sbuf.st_mode)) { + /* Only change the client values for a normal file. */ + if (startpos > sbuf.st_size) { + smb_maxcnt = 0; + } else if (smb_maxcnt > (sbuf.st_size - startpos)) { + smb_maxcnt = (sbuf.st_size - startpos); + } - if (smb_maxcnt == 0) { - goto normal_read; + if (smb_maxcnt == 0) { + goto normal_read; + } + } else { + /* Pipe or device read. */ + goto normal_nosendfile_read; } #if defined(WITH_SENDFILE) @@ -3386,6 +3392,8 @@ normal_read: return; } +normal_nosendfile_read: + reply_outbuf(req, 12, smb_maxcnt); nread = read_file(fsp, smb_buf(req->outbuf), startpos, smb_maxcnt);