ensure that we honor SMB2 read min_count properly
[kai/samba.git] / source4 / ntvfs / posix / pvfs_read.c
index 418b7e09fb073bcf038a8e8d03da5d7c336f298a..a01a8a57e3b800595ebe434d9aed4a54ba76cab4 100644 (file)
@@ -93,6 +93,14 @@ NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs,
                return pvfs_map_errno(pvfs, errno);
        }
 
+       /* only SMB2 honors mincnt */
+       if (req->ctx->protocol == PROTOCOL_SMB2) {
+               if (rd->readx.in.mincnt > ret ||
+                   (ret == 0 && maxcnt > 0)) {
+                       return NT_STATUS_END_OF_FILE;
+               }
+       }
+
        f->handle->position = f->handle->seek_offset = rd->readx.in.offset + ret;
 
        rd->readx.out.nread = ret;