[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3299-g7adf696

Jeremy Allison jra at samba.org
Tue Dec 23 17:19:28 GMT 2008


The branch, v3-2-test has been updated
       via  7adf6961bfbbb3de07d40f397db5b5520d5f9d9f (commit)
      from  ccd63a202b7978af3d6fdb46d1c17f0e9ac0fef6 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 7adf6961bfbbb3de07d40f397db5b5520d5f9d9f
Author: Tim Prouty <tprouty at samba.org>
Date:   Tue Dec 23 09:19:25 2008 -0800

    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.

-----------------------------------------------------------------------

Summary of changes:
 source/smbd/trans2.c |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c
index b6f4c34..a196802 100644
--- a/source/smbd/trans2.c
+++ b/source/smbd/trans2.c
@@ -3663,7 +3663,7 @@ static NTSTATUS marshall_stream_info(unsigned int num_streams,
 	unsigned int i;
 	unsigned int ofs = 0;
 
-	for (i=0; i<num_streams; i++) {
+	for (i = 0; i < num_streams && ofs <= max_data_bytes; i++) {
 		unsigned int next_offset;
 		size_t namelen;
 		smb_ucs2_t *namebuf;
@@ -3682,11 +3682,6 @@ static NTSTATUS marshall_stream_info(unsigned int num_streams,
 
 		namelen -= 2;
 
-		if (ofs + 24 + namelen > max_data_bytes) {
-			TALLOC_FREE(namebuf);
-			return NT_STATUS_BUFFER_TOO_SMALL;
-		}
-
 		SIVAL(data, ofs+4, namelen);
 		SOFF_T(data, ofs+8, streams[i].size);
 		SOFF_T(data, ofs+16, streams[i].alloc_size);
@@ -3701,10 +3696,6 @@ static NTSTATUS marshall_stream_info(unsigned int num_streams,
 		else {
 			unsigned int align = ndr_align_size(next_offset, 8);
 
-			if (next_offset + align > max_data_bytes) {
-				return NT_STATUS_BUFFER_TOO_SMALL;
-			}
-
 			memset(data+next_offset, 0, align);
 			next_offset += align;
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list