private -> private_data for struct smb2_request
authorAndrew Tridgell <tridge@samba.org>
Fri, 16 May 2008 05:03:58 +0000 (15:03 +1000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 16 May 2008 05:03:58 +0000 (15:03 +1000)
(This used to be commit 67290e0ad69df2f2fe651249c6550b8e32dd641b)

source4/libcli/smb2/connect.c
source4/libcli/smb2/request.c
source4/libcli/smb2/session.c
source4/libcli/smb2/smb2.h
source4/libcli/smb_composite/smb_composite.h
source4/librpc/rpc/dcerpc_smb2.c
source4/torture/smb2/oplocks.c

index 59d4e6ea2d5625b743e75a7405ec8d427bd23692..867af14c9297135ff6339963047e34185396f2f0 100644 (file)
@@ -44,7 +44,7 @@ struct smb2_connect_state {
 */
 static void continue_tcon(struct smb2_request *req)
 {
-       struct composite_context *c = talloc_get_type(req->async.private, 
+       struct composite_context *c = talloc_get_type(req->async.private_data
                                                      struct composite_context);
        struct smb2_connect_state *state = talloc_get_type(c->private_data, 
                                                           struct smb2_connect_state);
@@ -83,7 +83,7 @@ static void continue_session(struct composite_context *creq)
        if (composite_nomem(req, c)) return;
 
        req->async.fn = continue_tcon;
-       req->async.private = c; 
+       req->async.private_data = c;    
 }
 
 /*
@@ -91,7 +91,7 @@ static void continue_session(struct composite_context *creq)
 */
 static void continue_negprot(struct smb2_request *req)
 {
-       struct composite_context *c = talloc_get_type(req->async.private, 
+       struct composite_context *c = talloc_get_type(req->async.private_data
                                                      struct composite_context);
        struct smb2_connect_state *state = talloc_get_type(c->private_data, 
                                                           struct smb2_connect_state);
@@ -142,7 +142,7 @@ static void continue_socket(struct composite_context *creq)
        if (composite_nomem(req, c)) return;
 
        req->async.fn = continue_negprot;
-       req->async.private = c;
+       req->async.private_data = c;
 }
 
 
index f52b0ceef2586ab17f22fbfcc639c51134078854..64d427f889c196de06b554b4576f0ef20d60c9b4 100644 (file)
@@ -43,6 +43,18 @@ void smb2_setup_bufinfo(struct smb2_request *req)
        }
 }
 
+
+/* destroy a request structure */
+static int smb2_request_destructor(struct smb2_request *req)
+{
+       if (req->transport) {
+               /* remove it from the list of pending requests (a null op if
+                  its not in the list) */
+               DLIST_REMOVE(req->transport->pending_recv, req);
+       }
+       return 0;
+}
+
 /*
   initialise a smb2 request
 */
@@ -122,6 +134,8 @@ struct smb2_request *smb2_request_init(struct smb2_transport *transport, uint16_
                SCVAL(req->out.dynamic, 0, 0);
        }
 
+       talloc_set_destructor(req, smb2_request_destructor);
+
        return req;
 }
 
@@ -154,18 +168,13 @@ NTSTATUS smb2_request_destroy(struct smb2_request *req)
           _send() call fails completely */
        if (!req) return NT_STATUS_UNSUCCESSFUL;
 
-       if (req->transport) {
-               /* remove it from the list of pending requests (a null op if
-                  its not in the list) */
-               DLIST_REMOVE(req->transport->pending_recv, req);
-       }
-
        if (req->state == SMB2_REQUEST_ERROR &&
            NT_STATUS_IS_OK(req->status)) {
-               req->status = NT_STATUS_INTERNAL_ERROR;
+               status = NT_STATUS_INTERNAL_ERROR;
+       } else {
+               status = req->status;
        }
 
-       status = req->status;
        talloc_free(req);
        return status;
 }
index 18fe3486a4d1666f7aa9d240a37928364cf0883c..29af6652f2d845c6baaf9d66cfe855f5aec9dfa7 100644 (file)
@@ -145,7 +145,7 @@ struct smb2_session_state {
 */
 static void session_request_handler(struct smb2_request *req)
 {
-       struct composite_context *c = talloc_get_type(req->async.private, 
+       struct composite_context *c = talloc_get_type(req->async.private_data
                                                      struct composite_context);
        struct smb2_session_state *state = talloc_get_type(c->private_data, 
                                                           struct smb2_session_state);
@@ -178,7 +178,7 @@ static void session_request_handler(struct smb2_request *req)
                }
 
                state->req->async.fn = session_request_handler;
-               state->req->async.private = c;
+               state->req->async.private_data = c;
                return;
        }
 
index ae66a6e0d3bd898916fcc36bf03d2924797b0b38..964dcf320c4eaf76c6239f4feb6d49f4c12577cb 100644 (file)
@@ -19,6 +19,9 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#ifndef __LIBCLI_SMB2_SMB2_H__
+#define __LIBCLI_SMB2_SMB2_H__
+
 #include "libcli/raw/request.h"
 
 struct smb2_handle;
@@ -165,7 +168,7 @@ struct smb2_request {
        */
        struct {
                void (*fn)(struct smb2_request *);
-               void *private;
+               void *private_data;
        } async;
 };
 
@@ -282,3 +285,5 @@ struct smb2_request {
                return NT_STATUS_INVALID_PARAMETER; \
        } \
 } while (0)
+
+#endif
index afee11ce3bd099b1ccfc898057f5340694ee7ecb..7f4b9d73e4b48da338817e9558b39018119b6a25 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "libcli/raw/signing.h"
 #include "libcli/raw/libcliraw.h"
+#include "libcli/smb2/smb2.h"
 
 
 /*
index 8adca4caba5768f95f822323816ddaed0d0b5d91..4767165fba8dd62596f9d3689fa763776ec62a48 100644 (file)
@@ -83,7 +83,7 @@ static void smb2_read_callback(struct smb2_request *req)
        uint16_t frag_length;
        NTSTATUS status;
 
-       state = talloc_get_type(req->async.private, struct smb2_read_state);
+       state = talloc_get_type(req->async.private_data, struct smb2_read_state);
        smb = talloc_get_type(state->c->transport.private_data, struct smb2_private);
 
        status = smb2_read_recv(req, state, &io);
@@ -136,7 +136,7 @@ static void smb2_read_callback(struct smb2_request *req)
        }
 
        req->async.fn = smb2_read_callback;
-       req->async.private = state;
+       req->async.private_data = state;
 }
 
 
@@ -180,7 +180,7 @@ static NTSTATUS send_read_request_continue(struct dcerpc_connection *c, DATA_BLO
        }
 
        req->async.fn = smb2_read_callback;
-       req->async.private = state;
+       req->async.private_data = state;
 
        return NT_STATUS_OK;
 }
@@ -212,7 +212,7 @@ struct smb2_trans_state {
 */
 static void smb2_trans_callback(struct smb2_request *req)
 {
-       struct smb2_trans_state *state = talloc_get_type(req->async.private,
+       struct smb2_trans_state *state = talloc_get_type(req->async.private_data,
                                                        struct smb2_trans_state);
        struct dcerpc_connection *c = state->c;
        NTSTATUS status;
@@ -269,7 +269,7 @@ static NTSTATUS smb2_send_trans_request(struct dcerpc_connection *c, DATA_BLOB *
        }
 
        req->async.fn = smb2_trans_callback;
-       req->async.private = state;
+       req->async.private_data = state;
 
        talloc_steal(state, req);
 
@@ -281,7 +281,7 @@ static NTSTATUS smb2_send_trans_request(struct dcerpc_connection *c, DATA_BLOB *
 */
 static void smb2_write_callback(struct smb2_request *req)
 {
-       struct dcerpc_connection *c = (struct dcerpc_connection *)req->async.private;
+       struct dcerpc_connection *c = (struct dcerpc_connection *)req->async.private_data;
 
        if (!NT_STATUS_IS_OK(req->status)) {
                DEBUG(0,("dcerpc_smb2: write callback error\n"));
@@ -319,7 +319,7 @@ static NTSTATUS smb2_send_request(struct dcerpc_connection *c, DATA_BLOB *blob,
        }
 
        req->async.fn = smb2_write_callback;
-       req->async.private = c;
+       req->async.private_data = c;
 
        return NT_STATUS_OK;
 }
@@ -444,7 +444,7 @@ struct composite_context *dcerpc_pipe_open_smb2_send(struct dcerpc_pipe *p,
 static void pipe_open_recv(struct smb2_request *req)
 {
        struct pipe_open_smb2_state *state =
-               talloc_get_type(req->async.private,
+               talloc_get_type(req->async.private_data,
                                struct pipe_open_smb2_state);
        struct composite_context *ctx = state->ctx;
        struct dcerpc_connection *c = state->c;
index b0a1b31d1f22f321aadc7accce6b55262696004b..9a06ae1f19c924654750385c8a70b672d16793f4 100644 (file)
@@ -99,7 +99,7 @@ static bool torture_oplock_handler(struct smb2_transport *transport,
 
        req = smb2_break_send(tree, &break_info.br);
        req->async.fn = torture_oplock_break_callback;
-       req->async.private = NULL;
+       req->async.private_data = NULL;
 
        return true;
 }