]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smb2_sesssetup: remove unused smbd_smb2_session_setup_* destructors
authorStefan Metzmacher <metze@samba.org>
Sat, 2 May 2015 14:29:03 +0000 (16:29 +0200)
committerKarolin Seeger <kseeger@samba.org>
Wed, 20 May 2015 14:34:30 +0000 (16:34 +0200)
The cleanup of a failing session setup is now handled in
smbd_smb2_session_setup_wrap_*().

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11182

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(similar to commit 5871d3da871349cba058bb91218ae58107cf05c8)

source3/smbd/smb2_sesssetup.c

index cfad834c0ba882b7126424fb72c3d8212b35e3d9..9f34a09931d000c2596d65b2a601afc25816d5cd 100644 (file)
@@ -442,53 +442,11 @@ struct smbd_smb2_session_setup_state {
        uint16_t out_session_flags;
        DATA_BLOB out_security_buffer;
        uint64_t out_session_id;
-       /* The following pointer is owned by state->session. */
-       struct smbd_smb2_session_setup_state **pp_self_ref;
 };
 
-static int pp_self_ref_destructor(struct smbd_smb2_session_setup_state **pp_state)
-{
-       (*pp_state)->session = NULL;
-       /*
-        * To make things clearer, ensure the pp_self_ref
-        * pointer is nulled out. We're never going to
-        * access this again.
-        */
-       (*pp_state)->pp_self_ref = NULL;
-       return 0;
-}
-
-static int smbd_smb2_session_setup_state_destructor(struct smbd_smb2_session_setup_state *state)
-{
-       /*
-        * if state->session is not NULL,
-        * we remove the session on failure
-        */
-       TALLOC_FREE(state->session);
-       return 0;
-}
-
 static void smbd_smb2_session_setup_gensec_done(struct tevent_req *subreq);
 static void smbd_smb2_session_setup_previous_done(struct tevent_req *subreq);
 
-/************************************************************************
- We have to tag the state->session pointer with memory talloc'ed
- on it to ensure it gets NULL'ed out if the underlying struct smbXsrv_session
- is deleted by shutdown whilst this request is in flight.
-************************************************************************/
-
-static NTSTATUS tag_state_session_ptr(struct smbd_smb2_session_setup_state *state)
-{
-       state->pp_self_ref = talloc_zero(state->session,
-                       struct smbd_smb2_session_setup_state *);
-       if (state->pp_self_ref == NULL) {
-               return NT_STATUS_NO_MEMORY;
-       }
-       *state->pp_self_ref = state;
-       talloc_set_destructor(state->pp_self_ref, pp_self_ref_destructor);
-       return NT_STATUS_OK;
-}
-
 static struct tevent_req *smbd_smb2_session_setup_send(TALLOC_CTX *mem_ctx,
                                        struct tevent_context *ev,
                                        struct smbd_smb2_request *smb2req,
@@ -530,8 +488,6 @@ static struct tevent_req *smbd_smb2_session_setup_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       talloc_set_destructor(state, smbd_smb2_session_setup_state_destructor);
-
        if (state->in_session_id == 0) {
                /* create a new session */
                status = smbXsrv_session_create(state->smb2req->sconn->conn,
@@ -558,11 +514,6 @@ static struct tevent_req *smbd_smb2_session_setup_send(TALLOC_CTX *mem_ctx,
                }
        }
 
-       status = tag_state_session_ptr(state);
-       if (tevent_req_nterror(req, status)) {
-               return tevent_req_post(req, ev);
-       }
-
        if (state->session->gensec == NULL) {
                status = auth_generic_prepare(state->session,
                                              state->session->connection->remote_address,
@@ -617,8 +568,6 @@ static void smbd_smb2_session_setup_gensec_done(struct tevent_req *subreq)
 
        if (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
                state->out_session_id = state->session->global->session_wire_id;
-               /* we want to keep the session */
-               TALLOC_FREE(state->pp_self_ref);
                tevent_req_nterror(req, status);
                return;
        }
@@ -657,8 +606,6 @@ static void smbd_smb2_session_setup_gensec_done(struct tevent_req *subreq)
                if (tevent_req_nterror(req, status)) {
                        return;
                }
-               /* we want to keep the session */
-               TALLOC_FREE(state->pp_self_ref);
                tevent_req_done(req);
                return;
        }
@@ -673,8 +620,6 @@ static void smbd_smb2_session_setup_gensec_done(struct tevent_req *subreq)
                return;
        }
 
-       /* we want to keep the session */
-       TALLOC_FREE(state->pp_self_ref);
        tevent_req_done(req);
        return;
 }
@@ -704,8 +649,6 @@ static void smbd_smb2_session_setup_previous_done(struct tevent_req *subreq)
                if (tevent_req_nterror(req, status)) {
                        return;
                }
-               /* we want to keep the session */
-               TALLOC_FREE(state->pp_self_ref);
                tevent_req_done(req);
                return;
        }
@@ -720,8 +663,6 @@ static void smbd_smb2_session_setup_previous_done(struct tevent_req *subreq)
                return;
        }
 
-       /* we want to keep the session */
-       TALLOC_FREE(state->pp_self_ref);
        tevent_req_done(req);
        return;
 }