s3:smbd: introduce struct smbXsrv_connection
[samba.git] / source3 / smbd / process.c
index 7b12315fc3cbbcfe5db171467751c14a7672774a..087326205c3dddc479df242f24c7643224b117c2 100644 (file)
@@ -3149,6 +3149,17 @@ static void smbd_id_cache_kill(struct messaging_context *msg_ctx,
        id_cache_delete_from_cache(&id);
 }
 
+NTSTATUS smbXsrv_connection_init_tables(struct smbXsrv_connection *conn,
+                                       enum protocol_types protocol)
+{
+       NTSTATUS status;
+
+       set_Protocol(protocol);
+       conn->protocol = protocol;
+
+       return NT_STATUS_OK;
+}
+
 /****************************************************************************
  Process commands from the client
 ****************************************************************************/
@@ -3167,6 +3178,12 @@ void smbd_process(struct tevent_context *ev_ctx,
        char *rhost;
        int ret;
 
+       sconn->conn = talloc_zero(sconn, struct smbXsrv_connection);
+       if (sconn->conn == NULL) {
+               DEBUG(0,("talloc_zero(struct smbXsrv_connection)\n"));
+               exit_server_cleanly("talloc_zero(struct smbXsrv_connection).\n");
+       }
+
        if (lp_srv_maxprotocol() >= PROTOCOL_SMB2_02) {
                /*
                 * We're not making the decision here,
@@ -3430,6 +3447,14 @@ void smbd_process(struct tevent_context *ev_ctx,
                exit_server("failed to create smbd_server_connection fde");
        }
 
+       sconn->conn->sconn = sconn;
+       sconn->conn->ev_ctx = sconn->ev_ctx;
+       sconn->conn->msg_ctx = sconn->msg_ctx;
+       sconn->conn->local_address = sconn->local_address;
+       sconn->conn->remote_address = sconn->remote_address;
+       sconn->conn->remote_hostname = sconn->remote_hostname;
+       sconn->conn->protocol = PROTOCOL_NONE;
+
        TALLOC_FREE(frame);
 
        while (True) {