s4:libcli: split out smb2_connect_session_start()
authorStefan Metzmacher <metze@samba.org>
Wed, 18 Jul 2018 14:43:32 +0000 (16:43 +0200)
committerKarolin Seeger <kseeger@samba.org>
Mon, 13 Aug 2018 10:56:33 +0000 (12:56 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13308

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
(cherry picked from commit 5ad5b81b6ef601596583b4ad7d6a14241fa99a71)

source4/libcli/smb2/connect.c

index 8ff56c9ca8f81886690ea561c56f3019e80eba25..ac37eae6aa89289082c932444c7643a95ed7a978 100644 (file)
@@ -50,6 +50,7 @@ struct smb2_connect_state {
        struct smb2_tree *tree;
 };
 
+static void smb2_connect_session_start(struct tevent_req *req);
 static void smb2_connect_socket_done(struct composite_context *creq);
 
 /*
@@ -170,10 +171,6 @@ static void smb2_connect_negprot_done(struct tevent_req *subreq)
        struct tevent_req *req =
                tevent_req_callback_data(subreq,
                struct tevent_req);
-       struct smb2_connect_state *state =
-               tevent_req_data(req,
-               struct smb2_connect_state);
-       struct smb2_transport *transport = state->transport;
        NTSTATUS status;
 
        status = smbXcli_negprot_recv(subreq);
@@ -182,6 +179,17 @@ static void smb2_connect_negprot_done(struct tevent_req *subreq)
                return;
        }
 
+       smb2_connect_session_start(req);
+}
+
+static void smb2_connect_session_start(struct tevent_req *req)
+{
+       struct smb2_connect_state *state =
+               tevent_req_data(req,
+               struct smb2_connect_state);
+       struct smb2_transport *transport = state->transport;
+       struct tevent_req *subreq = NULL;
+
        state->session = smb2_session_init(transport, state->gensec_settings, state);
        if (tevent_req_nomem(state->session, req)) {
                return;