Remove cli_request_get()
authorVolker Lendecke <vl@samba.org>
Thu, 28 Aug 2008 13:44:14 +0000 (15:44 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 28 Aug 2008 16:22:49 +0000 (18:22 +0200)
req->private_data==NULL at this point is definitely a bug.
(This used to be commit ce3dc9f616cafc1289a94ac7cae0beca967d836e)

source3/include/async_smb.h
source3/libsmb/async_smb.c
source3/libsmb/clientgen.c
source3/libsmb/clireadwrite.c

index ed42baef0d6394f532df2e6e80ebb7b16994c919..e9e10023e34790507d6cf8a7e3de2c9009638637 100644 (file)
@@ -125,12 +125,6 @@ bool cli_chain_cork(struct cli_state *cli, struct event_context *ev,
                    size_t size_hint);
 void cli_chain_uncork(struct cli_state *cli);
 
-/*
- * Convenience function to get the SMB part out of an async_req
- */
-
-struct cli_request *cli_request_get(struct async_req *req);
-
 NTSTATUS cli_pull_reply(struct async_req *req,
                        uint8_t *pwct, uint16_t **pvwv,
                        uint16_t *pnum_bytes, uint8_t **pbytes);
index b5fa9c44b15863a3010dcad379d44aac06bc427f..79a924b9db67c166ee65c596f3cc1fae744466cc 100644 (file)
@@ -107,7 +107,8 @@ static uint16_t cli_new_mid(struct cli_state *cli)
 static char *cli_request_print(TALLOC_CTX *mem_ctx, struct async_req *req)
 {
        char *result = async_req_print(mem_ctx, req);
-       struct cli_request *cli_req = cli_request_get(req);
+       struct cli_request *cli_req = talloc_get_type_abort(
+               req->private_data, struct cli_request);
 
        if (result == NULL) {
                return NULL;
@@ -216,7 +217,8 @@ static bool find_andx_cmd_ofs(char *buf, size_t *pofs)
 
 static int cli_async_req_destructor(struct async_req *req)
 {
-       struct cli_request *cli_req = cli_request_get(req);
+       struct cli_request *cli_req = talloc_get_type_abort(
+               req->private_data, struct cli_request);
        int i, pending;
        bool found = false;
 
@@ -560,7 +562,8 @@ NTSTATUS cli_pull_reply(struct async_req *req,
                        uint8_t *pwct, uint16_t **pvwv,
                        uint16_t *pnum_bytes, uint8_t **pbytes)
 {
-       struct cli_request *cli_req = cli_request_get(req);
+       struct cli_request *cli_req = talloc_get_type_abort(
+               req->private_data, struct cli_request);
        uint8_t wct, cmd;
        uint16_t num_bytes;
        size_t wct_ofs, bytes_offset;
@@ -666,20 +669,6 @@ NTSTATUS cli_pull_reply(struct async_req *req,
        return NT_STATUS_OK;
 }
 
-/**
- * Convenience function to get the SMB part out of an async_req
- * @param[in] req      The request to look at
- * @retval The private_data as struct cli_request
- */
-
-struct cli_request *cli_request_get(struct async_req *req)
-{
-       if (req == NULL) {
-               return NULL;
-       }
-       return talloc_get_type_abort(req->private_data, struct cli_request);
-}
-
 /**
  * A PDU has arrived on cli->evt_inbuf
  * @param[in] cli      The cli_state that received something
index 239ba470a9649055cd90c9660e77d98a5263baaa..9d65fb4e94423ccc19bc2a7428693a90387e1b46 100644 (file)
@@ -661,7 +661,7 @@ static void cli_echo_recv_helper(struct async_req *req)
                return;
        }
 
-       cli_req = cli_request_get(req);
+       cli_req = talloc_get_type_abort(req->private_data, struct cli_request);
 
        if ((num_bytes != cli_req->data.echo.data.length)
            || (memcmp(cli_req->data.echo.data.data, bytes,
@@ -713,7 +713,7 @@ struct async_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
                TALLOC_FREE(data_copy);
                return NULL;
        }
-       req = cli_request_get(result);
+       req = talloc_get_type_abort(result->private_data, struct cli_request);
 
        client_set_trans_sign_state_on(cli, req->mid);
 
index b64a4c68f3304947f732ecf5865cdabc67074cf3..ec632816303bd37e06f22740c4bbf2c595263c3f 100644 (file)
@@ -83,7 +83,7 @@ struct async_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
-       req = cli_request_get(result);
+       req = talloc_get_type_abort(result->private_data, struct cli_request);
 
        req->data.read.ofs = offset;
        req->data.read.size = size;
@@ -103,7 +103,8 @@ struct async_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
 NTSTATUS cli_read_andx_recv(struct async_req *req, ssize_t *received,
                            uint8_t **rcvbuf)
 {
-       struct cli_request *cli_req = cli_request_get(req);
+       struct cli_request *cli_req = talloc_get_type_abort(
+               req->private_data, struct cli_request);
        uint8_t wct;
        uint16_t *vwv;
        uint16_t num_bytes;
@@ -311,7 +312,8 @@ static void cli_pull_read_done(struct async_req *read_req)
                read_req->async.priv, struct async_req);
        struct cli_pull_state *state = talloc_get_type_abort(
                pull_req->private_data, struct cli_pull_state);
-       struct cli_request *read_state = cli_request_get(read_req);
+       struct cli_request *read_state = talloc_get_type_abort(
+               read_req->private_data, struct cli_request);
        NTSTATUS status;
 
        status = cli_read_andx_recv(read_req, &read_state->data.read.received,
@@ -342,7 +344,9 @@ static void cli_pull_read_done(struct async_req *read_req)
                        return;
                }
 
-               top_read = cli_request_get(state->reqs[state->top_req]);
+               top_read = talloc_get_type_abort(
+                       state->reqs[state->top_req]->private_data,
+                       struct cli_request);
 
                DEBUG(10, ("cli_pull_read_done: Pushing %d bytes, %d already "
                           "pushed\n", (int)top_read->data.read.received,