are partial read responses legal

Steve French smfltc at
Fri Apr 30 16:42:58 GMT 2004

Is it legal or common for a server to return less on an SMBReadX than
the client asked when there is more data and the read falls within the
negotiated buffer size?

The SNIA spec notes that if read is larger than negotiated buffer size
the server "may arbitrarily decide" to return fewer than MaxCount bytes,
perhaps implying that I would be ok in changing my current read code
from something like

	while(bytes_to_reads && (rc == 0)) {
		decrease bytes_to_read by bytes read

to something that checks whether the bytes read was less than negotiated
size before deciding to retry again on a read that is going to return 0
bytes.  This also could be in combination with a check to ensure that
the bytes read matches what we expect is the end of file.

More information about the samba-technical mailing list