s3: Fix stream marshalling to return the correct streaminfo status
authorTim Prouty <tprouty@samba.org>
Tue, 23 Dec 2008 17:20:06 +0000 (09:20 -0800)
committerKarolin Seeger <kseeger@samba.org>
Fri, 2 Jan 2009 11:44:22 +0000 (12:44 +0100)
commit3000c845ec67577937bc620dc7afd0ddc4ae0de5
tree6ca5e807b0077f3ae6ef29732e39a82af2bc9dba
parent88806e9fcc5c721a6763db9ed41e4b8feab15cc0
s3: Fix stream marshalling to return the correct streaminfo status

When there are enough streams on a file to fill up the max_data_count
when responding to a trans2 streaminfo, samba is returning
NT_STATUS_BUFFER_TOO_SMALL.  Windows handles this by returning
NT_STATUS_BUFFER_OVERFLOW while still sending as much of the data that
it can fit into the buffer.  When the windows client sees
BUFFER_OVERFLOW, it retries the streaminfo with a larger buffer (2x).
The windows client starts at 2K and will continue increasing the
buffer size by two until it reaches 64K.  If the streams don't fit in
64K the windows client seems to give up.

This patch fixes marshall_stream_info to overfill the buffer by 1
stream so that send_trans2_replies can properly detect the overflow
and return the correct status.
(cherry picked from commit 3643a1179df42d47c2913c7d5c6a4ec8d8b8eb9d)
source/smbd/trans2.c