[SCM] Samba Shared Repository - branch master updated - 45ad3df1405c5d978872d6de63df5059efcc181f

Volker Lendecke vlendec at samba.org
Fri Dec 19 13:54:00 GMT 2008


The branch, master has been updated
       via  45ad3df1405c5d978872d6de63df5059efcc181f (commit)
       via  4abdd3981e9688aaaf19173182ace7b1fdf93f6d (commit)
      from  1aff97bc48844afba5de48447fdcdcc02d163a97 (commit)

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


- Log -----------------------------------------------------------------
commit 45ad3df1405c5d978872d6de63df5059efcc181f
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Dec 19 14:28:29 2008 +0100

    Fix the padding calculation in smb_splice_chain for "bytes_padding!=0"

commit 4abdd3981e9688aaaf19173182ace7b1fdf93f6d
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Dec 19 14:27:20 2008 +0100

    Pass "bytes_alignment" up through cli_request_send
    
    This parameter makes smb_spice_chain add padding before the bytes field

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

Summary of changes:
 source3/include/async_smb.h   |    1 +
 source3/libsmb/async_smb.c    |    9 ++++++---
 source3/libsmb/cliconnect.c   |    2 +-
 source3/libsmb/clientgen.c    |    2 +-
 source3/libsmb/clifile.c      |    4 ++--
 source3/libsmb/clireadwrite.c |    2 +-
 source3/libsmb/clitrans.c     |    6 +++---
 7 files changed, 15 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h
index 25fd353..fd0b0d2 100644
--- a/source3/include/async_smb.h
+++ b/source3/include/async_smb.h
@@ -119,6 +119,7 @@ struct async_req *cli_request_send(TALLOC_CTX *mem_ctx,
 				   uint8_t smb_command,
 				   uint8_t additional_flags,
 				   uint8_t wct, const uint16_t *vwv,
+				   size_t bytes_alignment,
 				   uint16_t num_bytes, const uint8_t *bytes);
 
 bool cli_chain_cork(struct cli_state *cli, struct event_context *ev,
diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index 522d73f..24e09e0 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -269,7 +269,7 @@ bool smb_splice_chain(char **poutbuf, uint8_t smb_command,
 	new_size = old_size + chain_padding + 1 + wct * sizeof(uint16_t) + 2;
 
 	if ((bytes_alignment != 0) && ((new_size % bytes_alignment) != 0)) {
-		bytes_padding = bytes_alignment + (new_size % bytes_alignment);
+		bytes_padding = bytes_alignment - (new_size % bytes_alignment);
 	}
 
 	new_size += bytes_padding + num_bytes;
@@ -394,6 +394,7 @@ static struct async_req *cli_request_chain(TALLOC_CTX *mem_ctx,
 					   uint8_t smb_command,
 					   uint8_t additional_flags,
 					   uint8_t wct, const uint16_t *vwv,
+					   size_t bytes_alignment,
 					   uint16_t num_bytes,
 					   const uint8_t *bytes)
 {
@@ -423,7 +424,7 @@ static struct async_req *cli_request_chain(TALLOC_CTX *mem_ctx,
 			      cli_async_req_destructor);
 
 	if (!smb_splice_chain(&req->outbuf, smb_command, wct, vwv,
-			      0, num_bytes, bytes)) {
+			      bytes_alignment, num_bytes, bytes)) {
 		goto fail;
 	}
 
@@ -569,6 +570,7 @@ void cli_chain_uncork(struct cli_state *cli)
  * @param[in] additional_flags	open_and_x wants to add oplock header flags
  * @param[in] wct		How many words?
  * @param[in] vwv		The words, already in network order
+ * @param[in] bytes_alignment	How shall we align "bytes"?
  * @param[in] num_bytes		How many bytes?
  * @param[in] bytes		The data the request ships
  *
@@ -581,6 +583,7 @@ struct async_req *cli_request_send(TALLOC_CTX *mem_ctx,
 				   uint8_t smb_command,
 				   uint8_t additional_flags,
 				   uint8_t wct, const uint16_t *vwv,
+				   size_t bytes_alignment,
 				   uint16_t num_bytes, const uint8_t *bytes)
 {
 	struct async_req *result;
@@ -596,7 +599,7 @@ struct async_req *cli_request_send(TALLOC_CTX *mem_ctx,
 	}
 
 	result = cli_request_chain(mem_ctx, ev, cli, smb_command,
-				   additional_flags, wct, vwv,
+				   additional_flags, wct, vwv, bytes_alignment,
 				   num_bytes, bytes);
 
 	if (result == NULL) {
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index b528777..5892bdc 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -1269,7 +1269,7 @@ struct async_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
 		}
 	}
 
-	result = cli_request_send(mem_ctx, ev, cli, SMBnegprot, 0, 0, NULL,
+	result = cli_request_send(mem_ctx, ev, cli, SMBnegprot, 0, 0, NULL, 0,
 				  talloc_get_size(bytes), bytes);
 	TALLOC_FREE(bytes);
 	return result;
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index d944278..ff01b67 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -705,7 +705,7 @@ struct async_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
 		return NULL;
 	}
 
-	result = cli_request_send(mem_ctx, ev, cli, SMBecho, 0, 1, vwv,
+	result = cli_request_send(mem_ctx, ev, cli, SMBecho, 0, 1, vwv, 0,
 				  data.length, data.data);
 	if (result == NULL) {
 		TALLOC_FREE(data_copy);
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 733abb6..7c75826 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -895,7 +895,7 @@ struct async_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
 	}
 
 	result = cli_request_send(mem_ctx, ev, cli, SMBopenX, additional_flags,
-				  15, vwv, talloc_get_size(bytes), bytes);
+				  15, vwv, 0, talloc_get_size(bytes), bytes);
 	TALLOC_FREE(bytes);
 	return result;
 }
@@ -974,7 +974,7 @@ struct async_req *cli_close_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
 	SSVAL(vwv+0, 0, fnum);
 	SIVALS(vwv+1, 0, -1);
 
-	return cli_request_send(mem_ctx, ev, cli, SMBclose, 0, 3, vwv,
+	return cli_request_send(mem_ctx, ev, cli, SMBclose, 0, 3, vwv, 0,
 				0, NULL);
 }
 
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c
index e0a2d21..0c65505 100644
--- a/source3/libsmb/clireadwrite.c
+++ b/source3/libsmb/clireadwrite.c
@@ -112,7 +112,7 @@ struct async_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
 		wct += 2;
 	}
 
-	result = cli_request_send(mem_ctx, ev, cli, SMBreadX, 0, wct, vwv,
+	result = cli_request_send(mem_ctx, ev, cli, SMBreadX, 0, wct, vwv, 0,
 				  0, NULL);
 	if (result == NULL) {
 		return NULL;
diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c
index 120b6c0..baa73ae 100644
--- a/source3/libsmb/clitrans.c
+++ b/source3/libsmb/clitrans.c
@@ -918,7 +918,7 @@ static struct async_req *cli_ship_trans(TALLOC_CTX *mem_ctx,
 		 * Primary request, retrieve our mid
 		 */
 		result = cli_request_send(mem_ctx, state->ev, state->cli,
-					  cmd, 0, wct, vwv,
+					  cmd, 0, wct, vwv, 0,
 					  talloc_get_size(bytes), bytes);
 		if (result == NULL) {
 			goto fail;
@@ -936,8 +936,8 @@ static struct async_req *cli_ship_trans(TALLOC_CTX *mem_ctx,
 				    wct * sizeof(uint16_t) + num_bytes + 3)) {
 			goto fail;
 		}
-		result = cli_request_send(mem_ctx, state->ev, state->cli,
-					  cmd, 0, wct, vwv, num_bytes, bytes);
+		result = cli_request_send(mem_ctx, state->ev, state->cli, cmd,
+					  0, wct, vwv, 0, num_bytes, bytes);
 		if (result == NULL) {
 			goto fail;
 		}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list