Convert cli_request->outbuf to uint8_t
authorVolker Lendecke <vl@samba.org>
Fri, 19 Dec 2008 16:44:32 +0000 (17:44 +0100)
committerVolker Lendecke <vl@samba.org>
Fri, 19 Dec 2008 16:47:30 +0000 (17:47 +0100)
source3/include/async_smb.h
source3/libsmb/async_smb.c

index f8f94aa4c9c762a8ddacc85ec961db494c47da4d..ef53ee21639c8f1683bec362634c4041554b63ef 100644 (file)
@@ -66,7 +66,7 @@ struct cli_request {
        /**
         * The bytes we have to ship to the server
         */
-       char *outbuf;
+       uint8_t *outbuf;
 
        /**
         * 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);
 void cli_chain_uncork(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,
                      size_t bytes_alignment,
                      uint32_t num_bytes, const uint8_t *bytes);
index a5ce505908e14a67af93cd545728cc48d98e8299..9ef9f9e06dd64c9b81e97d40de759acf626ff1a8 100644 (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)
 {
        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);
        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.
  */
 
-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;
        size_t ofs;
@@ -231,12 +231,12 @@ static bool find_andx_cmd_ofs(char *buf, size_t *pofs)
  * *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,
                      size_t bytes_alignment,
                      uint32_t num_bytes, const uint8_t *bytes)
 {
-       char *outbuf;
+       uint8_t *outbuf;
        size_t old_size, new_size;
        size_t ofs;
        size_t chain_padding = 0;
@@ -280,7 +280,7 @@ bool smb_splice_chain(char **poutbuf, uint8_t smb_command,
                return false;
        }
 
-       outbuf = TALLOC_REALLOC_ARRAY(NULL, *poutbuf, char, new_size);
+       outbuf = TALLOC_REALLOC_ARRAY(NULL, *poutbuf, uint8_t, new_size);
        if (outbuf == NULL) {
                DEBUG(0, ("talloc failed\n"));
                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)) {
                        DEBUG(1, ("invalid command chain\n"));
                        *poutbuf = TALLOC_REALLOC_ARRAY(
-                               NULL, *poutbuf, char, old_size);
+                               NULL, *poutbuf, uint8_t, old_size);
                        return false;
                }
 
@@ -512,11 +512,12 @@ bool cli_chain_cork(struct cli_state *cli, struct event_context *ev,
        if (size_hint == 0) {
                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) {
                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->async = NULL;
@@ -525,7 +526,7 @@ bool cli_chain_cork(struct cli_state *cli, struct event_context *ev,
        req->recv_helper.fn = NULL;
 
        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);
 
@@ -559,22 +560,23 @@ void cli_chain_uncork(struct cli_state *cli)
        cli->chain_accumulator = NULL;
 
        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)) {
                NTSTATUS status;
                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)) {
                        DEBUG(0, ("Error in encrypting client message. "
                                  "Error %s\n", nt_errstr(status)));
                        TALLOC_FREE(req);
                        return;
                }
-               req->outbuf = enc_buf;
+               req->outbuf = (uint8_t *)enc_buf;
                req->enc_state = cli->trans_enc_state;
        }