Socket draining for sys_recvfile() (patch for 'reverse sendfile')

Jeremy Allison jra at
Fri Dec 30 22:29:02 MST 2011

On Fri, Dec 30, 2011 at 08:17:22PM -0800, Jeremy Allison wrote:
> 3). Fix the pre-historic code in smbd/reply.c
> that explicitly sets a DOS error code if a writeX
> returns a short write - the modern libsmbclient
> code simply doesn't cope with this (that's where
> from - the detection code in libsmbclient). As
> libsmbclient doesn't cope with this it's almost
> certain a Windows server never does this (although
> it'd be worthwhile testing this out).

Actually narrowed this down further. Turns out that
when a short write sets smb_rcls != 0 (the DOS error
code) then the fixup_chain_error_packet() hard codes
the wct reply to 2 - as it's expecting to be returning
an error packet, not a valid writeX reply with a DOS
error stuffed into the header.

So it is *possible* that a Windows server might do
this, as modern Windows clients never expect short write
returns (they always do allocation-at-open-time
opens). The only clients that might require this are
OS/2, DOS and Win9x although I'd be very suprised
if they did.

Right now I'm removing this behavior, but the best
thing to do is to test it against a real Windows box
on a disk full situation (I'll be able to do this
next week).


More information about the samba-technical mailing list