From 4abdd3981e9688aaaf19173182ace7b1fdf93f6d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 19 Dec 2008 14:27:20 +0100 Subject: Pass "bytes_alignment" up through cli_request_send This parameter makes smb_spice_chain add padding before the bytes field --- source3/libsmb/async_smb.c | 7 +++++-- 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 +++--- 6 files changed, 13 insertions(+), 10 deletions(-) (limited to 'source3/libsmb') diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c index 522d73fbd9..21ffa94fe7 100644 --- a/source3/libsmb/async_smb.c +++ b/source3/libsmb/async_smb.c @@ -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 b5287774f5..5892bdc859 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 d94427809c..ff01b6798f 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 733abb6510..7c75826414 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 e0a2d21870..0c65505793 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 120b6c0e29..baa73aeb14 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; } -- cgit