[SCM] Samba Shared Repository - branch v3-6-test updated

Karolin Seeger kseeger at samba.org
Wed Nov 16 12:37:04 MST 2011


The branch, v3-6-test has been updated
       via  b5e1b79 s3:libsmb: consistently use state->size in cli_write_andx_create() (bug #5326)
       via  2ce6d51 s3:libsmb: fix cli_write_and_x() against OS/2 print shares (bug #5326)
      from  3556436 Ensure we correctly calculate reply credits over all returned SMB2 replies, and do as Windows does and return the total in the last SMB2 reply. Fixes an issue found by Christian M Ambach <christian.ambach at de.ibm.com> (and thanks to Christian for the initial patch this was based on). (cherry picked from commit 65566dfa8629136eaf0dc1491502dc651d1a4858)

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


- Log -----------------------------------------------------------------
commit b5e1b792366dc769389353cdbb63466f6867efb0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Nov 11 02:10:00 2011 +0100

    s3:libsmb: consistently use state->size in cli_write_andx_create() (bug #5326)
    
    Otherwise we may get unexpected results.
    
    This is a fix that was missing in commit 95595dd93fd04999fcf56ecaab7c29b064d021f8
    (s3:libsmb: fix cli_write_and_x() against OS/2 print shares (bug #5326))
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Wed Nov  9 10:13:32 CET 2011 on sn-devel-104
    (cherry picked from commit 4b31c4273c45faa639445614061f3da548eb8505)

commit 2ce6d51713bb47059814c720307f337fd380fc1c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Nov 8 08:25:16 2011 +0100

    s3:libsmb: fix cli_write_and_x() against OS/2 print shares (bug #5326)
    
    Print shares doesn't support CAP_LARGE_WRITEX, while it's negotiated
    by the file server part.
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Tue Nov  8 17:01:36 CET 2011 on sn-devel-104
    (cherry picked from commit 95595dd93fd04999fcf56ecaab7c29b064d021f8)

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

Summary of changes:
 source3/libsmb/clireadwrite.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c
index b0f988c..215e1d3 100644
--- a/source3/libsmb/clireadwrite.c
+++ b/source3/libsmb/clireadwrite.c
@@ -807,7 +807,7 @@ struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
 		return NULL;
 	}
 
-	size = MIN(size, max_write);
+	state->size = MIN(size, max_write);
 
 	vwv = state->vwv;
 
@@ -819,8 +819,8 @@ struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
 	SIVAL(vwv+5, 0, 0);
 	SSVAL(vwv+7, 0, mode);
 	SSVAL(vwv+8, 0, 0);
-	SSVAL(vwv+9, 0, (size>>16));
-	SSVAL(vwv+10, 0, size);
+	SSVAL(vwv+9, 0, (state->size>>16));
+	SSVAL(vwv+10, 0, state->size);
 
 	SSVAL(vwv+11, 0,
 	      cli_smb_wct_ofs(reqs_before, num_reqs_before)
@@ -837,7 +837,7 @@ struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
 	state->iov[0].iov_base = (void *)&state->pad;
 	state->iov[0].iov_len = 1;
 	state->iov[1].iov_base = CONST_DISCARD(void *, buf);
-	state->iov[1].iov_len = size;
+	state->iov[1].iov_len = state->size;
 
 	subreq = cli_smb_req_create(state, ev, cli, SMBwriteX, 0, wct, vwv,
 				    2, state->iov);
@@ -890,7 +890,18 @@ static void cli_write_andx_done(struct tevent_req *subreq)
 		return;
 	}
 	state->written = SVAL(vwv+2, 0);
-	state->written |= SVAL(vwv+4, 0)<<16;
+	if (state->size > UINT16_MAX) {
+		/*
+		 * It is important that we only set the
+		 * high bits only if we asked for a large write.
+		 *
+		 * OS/2 print shares get this wrong and may send
+		 * invalid values.
+		 *
+		 * See bug #5326.
+		 */
+		state->written |= SVAL(vwv+4, 0)<<16;
+	}
 	tevent_req_done(req);
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list