]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli:smb: Implement smb2cli_read_cancel()
authorAndreas Schneider <asn@samba.org>
Wed, 28 Aug 2024 13:06:11 +0000 (15:06 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 29 Jan 2025 11:20:33 +0000 (11:20 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14430

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
libcli/smb/smb2cli_read.c

index 95071ed27a25bfea337500dbebca5e5330918bd6..6efaa8da5ee1b1d840589980f2aca8ed70452d26 100644 (file)
@@ -35,6 +35,7 @@ struct smb2cli_read_state {
        bool report_pending;
 };
 
+static bool smb2cli_read_cancel(struct tevent_req *req);
 static void smb2cli_read_done(struct tevent_req *subreq);
 
 struct tevent_req *smb2cli_read_send(TALLOC_CTX *mem_ctx,
@@ -83,9 +84,21 @@ struct tevent_req *smb2cli_read_send(TALLOC_CTX *mem_ctx,
        }
        tevent_req_set_callback(subreq, smb2cli_read_done, req);
        state->subreq = subreq;
+       tevent_req_set_cancel_fn(req, smb2cli_read_cancel);
+
        return req;
 }
 
+static bool smb2cli_read_cancel(struct tevent_req *req)
+{
+       struct smb2cli_read_state *state = tevent_req_data(
+               req, struct smb2cli_read_state);
+       bool ok;
+
+       ok = tevent_req_cancel(state->subreq);
+       return ok;
+}
+
 void smb2cli_read_set_notify_async(struct tevent_req *req)
 {
        struct smb2cli_read_state *state =