readx and CAP_LARGE_READX

tridge at samba.org tridge at samba.org
Thu Dec 7 04:08:18 GMT 2006


James,

You asked me about smb_raw_read() and reads close to 64k with
CAP_LARGE_READX on irc the other day.

I've added a test to smbtorture RAW-READ that looks at this, and it
seems that the behaviour you saw, even though its quite strange, is
correct. Both w2k3 and Samba4 return zero bytes for readx beyond
0xFFFF for the SMB1 protocol. In SMB2 larger reads work.

In Samba4 the code looks like this (in pvfs_read.c):

	if (maxcnt > UINT16_MAX && req->ctx->protocol < PROTOCOL_SMB2) {
		maxcnt = 0;
	}

I know this seems strange as SMB1 could in fact handle reads of up to
nearly 128k, but that's just how it is :-)

If you want cifsdd to work correctly with all servers then you'll need
to break up the reads into chunks of less than 64k each.

Cheers, Tridge


More information about the samba-technical mailing list