The branch, master has been updated
       via  7b1fb08 s4:librpc/rpc: make dcerpc_bh_raw_call_* more robust 
against disconnects and timeouts
       via  01c404a s4:librpc/rpc: make dcerpc_bh_is_connected() more robust
      from  54d3609 s3-rpc_server: Do not register embedded ncacn_np endpoints 
by default

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 7b1fb088421565f1752acde02377237e4ca19248
Author: Stefan Metzmacher <[email protected]>
Date:   Wed Mar 7 16:54:18 2012 +0100

    s4:librpc/rpc: make dcerpc_bh_raw_call_* more robust against disconnects 
and timeouts
    
    Using tevent_req_defer_callback() should make the situation a bit better,
    until we have a common robust low level dcerpc library.
    
    metze
    
    Autobuild-User: Stefan Metzmacher <[email protected]>
    Autobuild-Date: Wed Mar  7 18:44:24 CET 2012 on sn-devel-104

commit 01c404a67c3321c8959b47841db5c1900b4ebac4
Author: Stefan Metzmacher <[email protected]>
Date:   Wed Mar 7 16:52:57 2012 +0100

    s4:librpc/rpc: make dcerpc_bh_is_connected() more robust
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 source4/librpc/rpc/dcerpc.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index caf421b..599ad78 100644
--- a/source4/librpc/rpc/dcerpc.c
+++ b/source4/librpc/rpc/dcerpc.c
@@ -165,6 +165,14 @@ static bool dcerpc_bh_is_connected(struct 
dcerpc_binding_handle *h)
                return false;
        }
 
+       if (!hs->p->conn) {
+               return false;
+       }
+
+       if (hs->p->conn->dead) {
+               return false;
+       }
+
        return true;
 }
 
@@ -186,6 +194,7 @@ static uint32_t dcerpc_bh_set_timeout(struct 
dcerpc_binding_handle *h,
 }
 
 struct dcerpc_bh_raw_call_state {
+       struct tevent_context *ev;
        struct dcerpc_binding_handle *h;
        DATA_BLOB in_data;
        DATA_BLOB out_data;
@@ -215,6 +224,7 @@ static struct tevent_req 
*dcerpc_bh_raw_call_send(TALLOC_CTX *mem_ctx,
        if (req == NULL) {
                return NULL;
        }
+       state->ev = ev;
        state->h = h;
        state->in_data.data = discard_const_p(uint8_t, in_data);
        state->in_data.length = in_length;
@@ -260,6 +270,19 @@ static void dcerpc_bh_raw_call_done(struct rpc_request 
*subreq)
        if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
                status = dcerpc_fault_to_nt_status(fault_code);
        }
+
+       /*
+        * We trigger the callback in the next event run
+        * because the code in this file might trigger
+        * multiple request callbacks from within a single
+        * while loop.
+        *
+        * In order to avoid segfaults from within
+        * dcerpc_connection_dead() we call
+        * tevent_req_defer_callback().
+        */
+       tevent_req_defer_callback(req, state->ev);
+
        if (!NT_STATUS_IS_OK(status)) {
                tevent_req_nterror(req, status);
                return;


-- 
Samba Shared Repository

Reply via email to