smbXsrv_client: make sure we only wait for smb2srv_client_mc_negprot_filter once...
authorStefan Metzmacher <metze@samba.org>
Wed, 12 Oct 2022 12:15:53 +0000 (14:15 +0200)
committerJule Anger <janger@samba.org>
Tue, 18 Oct 2022 13:32:11 +0000 (13:32 +0000)
This will simplify the following changes...

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15200

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 8c8d8cf01e01c2726d03fa1c81e0ce9992ee736c)

source3/smbd/smbXsrv_client.c

index f0d34bbf4940cc4920fe2be93f185a8c3b8da442..0a958842d34104f5664c89029a217c97da3a19ac 100644 (file)
@@ -471,6 +471,7 @@ struct smb2srv_client_mc_negprot_state {
        struct db_record *db_rec;
        uint64_t watch_instance;
        uint32_t last_seqnum;
+       struct tevent_req *filter_subreq;
 };
 
 static void smb2srv_client_mc_negprot_cleanup(struct tevent_req *req,
@@ -534,6 +535,7 @@ static void smb2srv_client_mc_negprot_next(struct tevent_req *req)
        NTSTATUS status;
        uint32_t seqnum = 0;
 
+       TALLOC_FREE(state->filter_subreq);
        SMB_ASSERT(state->db_rec == NULL);
        state->db_rec = smbXsrv_client_global_fetch_locked(table->global.db_ctx,
                                                           &client_guid,
@@ -610,6 +612,7 @@ static void smb2srv_client_mc_negprot_next(struct tevent_req *req)
                        return;
                }
                tevent_req_set_callback(subreq, smb2srv_client_mc_negprot_done, req);
+               state->filter_subreq = subreq;
        }
 
        if (procid_is_local(&global->server_id)) {
@@ -692,6 +695,9 @@ static void smb2srv_client_mc_negprot_done(struct tevent_req *subreq)
        NTSTATUS status;
        int ret;
 
+       SMB_ASSERT(state->filter_subreq == subreq);
+       state->filter_subreq = NULL;
+
        ret = messaging_filtered_read_recv(subreq, state, &rec);
        TALLOC_FREE(subreq);
        if (ret != 0) {