1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-28 11:42:03 +03:00

Convert cli_request->outbuf to uint8_t

This commit is contained in:
Volker Lendecke
2008-12-19 17:44:32 +01:00
parent 398ef0fb85
commit 1f04d07db0
2 changed files with 17 additions and 15 deletions

View File

@ -66,7 +66,7 @@ struct cli_request {
/** /**
* The bytes we have to ship to the server * The bytes we have to ship to the server
*/ */
char *outbuf; uint8_t *outbuf;
/** /**
* How much from "outbuf" did we already send * How much from "outbuf" did we already send
@ -126,7 +126,7 @@ bool cli_chain_cork(struct cli_state *cli, struct event_context *ev,
size_t size_hint); size_t size_hint);
void cli_chain_uncork(struct cli_state *cli); void cli_chain_uncork(struct cli_state *cli);
bool cli_in_chain(struct cli_state *cli); bool cli_in_chain(struct cli_state *cli);
bool smb_splice_chain(char **poutbuf, uint8_t smb_command, bool smb_splice_chain(uint8_t **poutbuf, uint8_t smb_command,
uint8_t wct, const uint16_t *vwv, uint8_t wct, const uint16_t *vwv,
size_t bytes_alignment, size_t bytes_alignment,
uint32_t num_bytes, const uint8_t *bytes); uint32_t num_bytes, const uint8_t *bytes);

View File

@ -127,7 +127,7 @@ static char *cli_request_print(TALLOC_CTX *mem_ctx, struct async_req *req)
static int cli_request_destructor(struct cli_request *req) static int cli_request_destructor(struct cli_request *req)
{ {
if (req->enc_state != NULL) { if (req->enc_state != NULL) {
common_free_enc_buffer(req->enc_state, req->outbuf); common_free_enc_buffer(req->enc_state, (char *)req->outbuf);
} }
DLIST_REMOVE(req->cli->outstanding_requests, req); DLIST_REMOVE(req->cli->outstanding_requests, req);
if (req->cli->outstanding_requests == NULL) { if (req->cli->outstanding_requests == NULL) {
@ -187,7 +187,7 @@ static bool is_andx_req(uint8_t cmd)
* to the chain. Find the offset to the place where we have to put our cmd. * to the chain. Find the offset to the place where we have to put our cmd.
*/ */
static bool find_andx_cmd_ofs(char *buf, size_t *pofs) static bool find_andx_cmd_ofs(uint8_t *buf, size_t *pofs)
{ {
uint8_t cmd; uint8_t cmd;
size_t ofs; size_t ofs;
@ -231,12 +231,12 @@ static bool find_andx_cmd_ofs(char *buf, size_t *pofs)
* *poutbuf. * *poutbuf.
*/ */
bool smb_splice_chain(char **poutbuf, uint8_t smb_command, bool smb_splice_chain(uint8_t **poutbuf, uint8_t smb_command,
uint8_t wct, const uint16_t *vwv, uint8_t wct, const uint16_t *vwv,
size_t bytes_alignment, size_t bytes_alignment,
uint32_t num_bytes, const uint8_t *bytes) uint32_t num_bytes, const uint8_t *bytes)
{ {
char *outbuf; uint8_t *outbuf;
size_t old_size, new_size; size_t old_size, new_size;
size_t ofs; size_t ofs;
size_t chain_padding = 0; size_t chain_padding = 0;
@ -280,7 +280,7 @@ bool smb_splice_chain(char **poutbuf, uint8_t smb_command,
return false; return false;
} }
outbuf = TALLOC_REALLOC_ARRAY(NULL, *poutbuf, char, new_size); outbuf = TALLOC_REALLOC_ARRAY(NULL, *poutbuf, uint8_t, new_size);
if (outbuf == NULL) { if (outbuf == NULL) {
DEBUG(0, ("talloc failed\n")); DEBUG(0, ("talloc failed\n"));
return false; return false;
@ -295,7 +295,7 @@ bool smb_splice_chain(char **poutbuf, uint8_t smb_command,
if (!find_andx_cmd_ofs(outbuf, &andx_cmd_ofs)) { if (!find_andx_cmd_ofs(outbuf, &andx_cmd_ofs)) {
DEBUG(1, ("invalid command chain\n")); DEBUG(1, ("invalid command chain\n"));
*poutbuf = TALLOC_REALLOC_ARRAY( *poutbuf = TALLOC_REALLOC_ARRAY(
NULL, *poutbuf, char, old_size); NULL, *poutbuf, uint8_t, old_size);
return false; return false;
} }
@ -512,11 +512,12 @@ bool cli_chain_cork(struct cli_state *cli, struct event_context *ev,
if (size_hint == 0) { if (size_hint == 0) {
size_hint = 100; size_hint = 100;
} }
req->outbuf = talloc_array(req, char, smb_wct + size_hint); req->outbuf = talloc_array(req, uint8_t, smb_wct + size_hint);
if (req->outbuf == NULL) { if (req->outbuf == NULL) {
goto fail; goto fail;
} }
req->outbuf = TALLOC_REALLOC_ARRAY(NULL, req->outbuf, char, smb_wct); req->outbuf = TALLOC_REALLOC_ARRAY(NULL, req->outbuf, uint8_t,
smb_wct);
req->num_async = 0; req->num_async = 0;
req->async = NULL; req->async = NULL;
@ -525,7 +526,7 @@ bool cli_chain_cork(struct cli_state *cli, struct event_context *ev,
req->recv_helper.fn = NULL; req->recv_helper.fn = NULL;
SSVAL(req->outbuf, smb_tid, cli->cnum); SSVAL(req->outbuf, smb_tid, cli->cnum);
cli_setup_packet_buf(cli, req->outbuf); cli_setup_packet_buf(cli, (char *)req->outbuf);
req->mid = cli_new_mid(cli); req->mid = cli_new_mid(cli);
@ -559,22 +560,23 @@ void cli_chain_uncork(struct cli_state *cli)
cli->chain_accumulator = NULL; cli->chain_accumulator = NULL;
SSVAL(req->outbuf, smb_mid, req->mid); SSVAL(req->outbuf, smb_mid, req->mid);
smb_setlen(req->outbuf, talloc_get_size(req->outbuf) - 4); smb_setlen((char *)req->outbuf, talloc_get_size(req->outbuf) - 4);
cli_calculate_sign_mac(cli, req->outbuf); cli_calculate_sign_mac(cli, (char *)req->outbuf);
if (cli_encryption_on(cli)) { if (cli_encryption_on(cli)) {
NTSTATUS status; NTSTATUS status;
char *enc_buf; char *enc_buf;
status = cli_encrypt_message(cli, req->outbuf, &enc_buf); status = cli_encrypt_message(cli, (char *)req->outbuf,
&enc_buf);
if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Error in encrypting client message. " DEBUG(0, ("Error in encrypting client message. "
"Error %s\n", nt_errstr(status))); "Error %s\n", nt_errstr(status)));
TALLOC_FREE(req); TALLOC_FREE(req);
return; return;
} }
req->outbuf = enc_buf; req->outbuf = (uint8_t *)enc_buf;
req->enc_state = cli->trans_enc_state; req->enc_state = cli->trans_enc_state;
} }