[SCM] Samba Shared Repository - branch master updated - 398ef0fb855b3b2d6e55ae26304589fd89110628

Volker Lendecke vlendec at samba.org
Fri Dec 19 15:14:53 GMT 2008


The branch, master has been updated
       via  398ef0fb855b3b2d6e55ae26304589fd89110628 (commit)
       via  98c4055bcba17cde81345947d61fa2faae108654 (commit)
      from  af049ae83c5640016e912e9e839653df2946fa98 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 398ef0fb855b3b2d6e55ae26304589fd89110628
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Dec 19 16:11:14 2008 +0100

    For large smbwrite&x, we need more than 64k bcc

commit 98c4055bcba17cde81345947d61fa2faae108654
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Dec 19 16:10:08 2008 +0100

    Add some comments
    
    If it takes more than 10 seconds to understand the code you've written yourself
    less than a year ago, it's time for comments or refactoring. I couldn't find a
    way to refactor that cleanly, so add comments :-)

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

Summary of changes:
 source3/include/async_smb.h |    4 ++--
 source3/libsmb/async_smb.c  |   30 ++++++++++++++++++++++++++----
 2 files changed, 28 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h
index fd0b0d2..f8f94aa 100644
--- a/source3/include/async_smb.h
+++ b/source3/include/async_smb.h
@@ -120,7 +120,7 @@ struct async_req *cli_request_send(TALLOC_CTX *mem_ctx,
 				   uint8_t additional_flags,
 				   uint8_t wct, const uint16_t *vwv,
 				   size_t bytes_alignment,
-				   uint16_t num_bytes, const uint8_t *bytes);
+				   uint32_t num_bytes, const uint8_t *bytes);
 
 bool cli_chain_cork(struct cli_state *cli, struct event_context *ev,
 		    size_t size_hint);
@@ -129,7 +129,7 @@ bool cli_in_chain(struct cli_state *cli);
 bool smb_splice_chain(char **poutbuf, uint8_t smb_command,
 		      uint8_t wct, const uint16_t *vwv,
 		      size_t bytes_alignment,
-		      uint16_t num_bytes, const uint8_t *bytes);
+		      uint32_t num_bytes, const uint8_t *bytes);
 
 NTSTATUS cli_pull_reply(struct async_req *req,
 			uint8_t *pwct, uint16_t **pvwv,
diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index 24e09e0..a5ce505 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -234,7 +234,7 @@ static bool find_andx_cmd_ofs(char *buf, size_t *pofs)
 bool smb_splice_chain(char **poutbuf, uint8_t smb_command,
 		      uint8_t wct, const uint16_t *vwv,
 		      size_t bytes_alignment,
-		      uint16_t num_bytes, const uint8_t *bytes)
+		      uint32_t num_bytes, const uint8_t *bytes)
 {
 	char *outbuf;
 	size_t old_size, new_size;
@@ -274,7 +274,7 @@ bool smb_splice_chain(char **poutbuf, uint8_t smb_command,
 
 	new_size += bytes_padding + num_bytes;
 
-	if (new_size > 0xffff) {
+	if ((smb_command != SMBwriteX) && (new_size > 0xffff)) {
 		DEBUG(1, ("splice_chain: %u bytes won't fit\n",
 			  (unsigned)new_size));
 		return false;
@@ -310,20 +310,42 @@ bool smb_splice_chain(char **poutbuf, uint8_t smb_command,
 
 	ofs = old_size;
 
+	/*
+	 * Push the chained request:
+	 *
+	 * wct field
+	 */
+
 	SCVAL(outbuf, ofs, wct);
 	ofs += 1;
 
+	/*
+	 * vwv array
+	 */
+
 	memcpy(outbuf + ofs, vwv, sizeof(uint16_t) * wct);
 	ofs += sizeof(uint16_t) * wct;
 
+	/*
+	 * bcc (byte count)
+	 */
+
 	SSVAL(outbuf, ofs, num_bytes + bytes_padding);
 	ofs += sizeof(uint16_t);
 
+	/*
+	 * padding
+	 */
+
 	if (bytes_padding != 0) {
 		memset(outbuf + ofs, 0, bytes_padding);
 		ofs += bytes_padding;
 	}
 
+	/*
+	 * The bytes field
+	 */
+
 	memcpy(outbuf + ofs, bytes, num_bytes);
 
 	return true;
@@ -395,7 +417,7 @@ static struct async_req *cli_request_chain(TALLOC_CTX *mem_ctx,
 					   uint8_t additional_flags,
 					   uint8_t wct, const uint16_t *vwv,
 					   size_t bytes_alignment,
-					   uint16_t num_bytes,
+					   uint32_t num_bytes,
 					   const uint8_t *bytes)
 {
 	struct async_req **tmp_reqs;
@@ -584,7 +606,7 @@ struct async_req *cli_request_send(TALLOC_CTX *mem_ctx,
 				   uint8_t additional_flags,
 				   uint8_t wct, const uint16_t *vwv,
 				   size_t bytes_alignment,
-				   uint16_t num_bytes, const uint8_t *bytes)
+				   uint32_t num_bytes, const uint8_t *bytes)
 {
 	struct async_req *result;
 	bool uncork = false;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list