The branch, master has been updated
       via  ef1c317... s4:libcli/wrepl: correctly remove the tstream_context 
when the connection is dead
      from  c2a6631... s4-smbtorture: fix include of proto header in main RAP 
test.

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


- Log -----------------------------------------------------------------
commit ef1c3176c80a5d8533d590aacd0b5035ba589b17
Author: Stefan Metzmacher <[email protected]>
Date:   Thu Mar 25 17:58:19 2010 +0100

    s4:libcli/wrepl: correctly remove the tstream_context when the connection 
is dead
    
    metze

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

Summary of changes:
 source4/libcli/wrepl/winsrepl.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/libcli/wrepl/winsrepl.c b/source4/libcli/wrepl/winsrepl.c
index 380c79a..ec7e379 100644
--- a/source4/libcli/wrepl/winsrepl.c
+++ b/source4/libcli/wrepl/winsrepl.c
@@ -413,6 +413,11 @@ static void wrepl_request_trigger(struct tevent_req *req,
                                            struct wrepl_request_state);
        struct tevent_req *subreq;
 
+       if (state->caller.wrepl_socket->stream == NULL) {
+               tevent_req_nterror(req, NT_STATUS_INVALID_CONNECTION);
+               return;
+       }
+
        if (DEBUGLVL(10)) {
                DEBUG(10,("Sending WINS packet of length %u\n",
                          (unsigned)state->req.blob.length));
@@ -445,10 +450,16 @@ static void wrepl_request_writev_done(struct tevent_req 
*subreq)
        TALLOC_FREE(subreq);
        if (ret == -1) {
                NTSTATUS status = map_nt_error_from_unix(sys_errno);
+               TALLOC_FREE(state->caller.wrepl_socket->stream);
                tevent_req_nterror(req, status);
                return;
        }
 
+       if (state->caller.wrepl_socket->stream == NULL) {
+               tevent_req_nterror(req, NT_STATUS_INVALID_CONNECTION);
+               return;
+       }
+
        if (state->ctrl.disconnect_after_send) {
                subreq = tstream_disconnect_send(state,
                                                 state->caller.ev,
@@ -490,12 +501,13 @@ static void wrepl_request_disconnect_done(struct 
tevent_req *subreq)
        TALLOC_FREE(subreq);
        if (ret == -1) {
                NTSTATUS status = map_nt_error_from_unix(sys_errno);
+               TALLOC_FREE(state->caller.wrepl_socket->stream);
                tevent_req_nterror(req, status);
                return;
        }
 
        DEBUG(10,("WINS connection disconnected\n"));
-       state->caller.wrepl_socket->stream = NULL;
+       TALLOC_FREE(state->caller.wrepl_socket->stream);
 
        tevent_req_done(req);
 }
@@ -512,6 +524,7 @@ static void wrepl_request_read_pdu_done(struct tevent_req 
*subreq)
 
        status = tstream_read_pdu_blob_recv(subreq, state, &state->rep.blob);
        if (!NT_STATUS_IS_OK(status)) {
+               TALLOC_FREE(state->caller.wrepl_socket->stream);
                tevent_req_nterror(req, status);
                return;
        }
@@ -554,6 +567,7 @@ NTSTATUS wrepl_request_recv(struct tevent_req *req,
        NTSTATUS status;
 
        if (tevent_req_is_nterror(req, &status)) {
+               TALLOC_FREE(state->caller.wrepl_socket->stream);
                tevent_req_received(req);
                return status;
        }


-- 
Samba Shared Repository

Reply via email to