s4:rpc_server: split out dcesrv_auth_prepare_bind_ack()
authorStefan Metzmacher <metze@samba.org>
Mon, 15 May 2017 10:16:35 +0000 (12:16 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 21 May 2017 19:05:12 +0000 (21:05 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/rpc_server/dcesrv_auth.c

index 5e3df0460c4a9a8bfa99c822c1acd5df6439e7b9..ae3cebc1e0a4e021481a1cd1531155a826104e04 100644 (file)
@@ -305,10 +305,9 @@ NTSTATUS dcesrv_auth_complete(struct dcesrv_call_state *call, NTSTATUS status)
   add any auth information needed in a bind ack, and process the authentication
   information found in the bind.
 */
-NTSTATUS dcesrv_auth_bind_ack(struct dcesrv_call_state *call, struct ncacn_packet *pkt)
+NTSTATUS dcesrv_auth_prepare_bind_ack(struct dcesrv_call_state *call, struct ncacn_packet *pkt)
 {
        struct dcesrv_connection *dce_conn = call->conn;
-       NTSTATUS status;
 
        dce_conn->allow_alter = true;
        dce_conn->allow_auth3 = true;
@@ -335,6 +334,23 @@ NTSTATUS dcesrv_auth_bind_ack(struct dcesrv_call_state *call, struct ncacn_packe
        };
        call->out_auth_info = &call->_out_auth_info;
 
+       return NT_STATUS_OK;
+}
+
+NTSTATUS dcesrv_auth_bind_ack(struct dcesrv_call_state *call, struct ncacn_packet *pkt)
+{
+       struct dcesrv_connection *dce_conn = call->conn;
+       NTSTATUS status;
+
+       status = dcesrv_auth_prepare_bind_ack(call, pkt);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (dce_conn->auth_state.auth_finished) {
+               return NT_STATUS_OK;
+       }
+
        status = gensec_update_ev(dce_conn->auth_state.gensec_security,
                               call, call->event_ctx,
                               call->in_auth_info.credentials,