summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2019-06-19 20:47:24 +0200
committerJeremy Allison <jra@samba.org>2019-06-20 17:18:18 +0000
commit56521c5fbf0bea3dcf0d58a686879485a939b7af (patch)
tree4b7ae6e02afb522cc17d9d39baa3737e93241e77 /source3/libsmb
parent3f6ed6e35239507ebe78091b9e1b4af7b644e3fd (diff)
downloadsamba-56521c5fbf0bea3dcf0d58a686879485a939b7af.tar.gz
libsmb: Make cli_lockingx cancellable
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clifile.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 3738904f894..e696b536093 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -3434,9 +3434,11 @@ static uint8_t *cli_lockingx_put_locks(
struct cli_lockingx_state {
uint16_t vwv[8];
struct iovec bytes;
+ struct tevent_req *subreq;
};
static void cli_lockingx_done(struct tevent_req *subreq);
+static bool cli_lockingx_cancel(struct tevent_req *req);
struct tevent_req *cli_lockingx_create(
TALLOC_CTX *mem_ctx,
@@ -3515,6 +3517,7 @@ struct tevent_req *cli_lockingx_send(
const struct smb1_lock_element *locks)
{
struct tevent_req *req = NULL, *subreq = NULL;
+ struct cli_lockingx_state *state = NULL;
NTSTATUS status;
req = cli_lockingx_create(
@@ -3533,11 +3536,14 @@ struct tevent_req *cli_lockingx_send(
if (req == NULL) {
return NULL;
}
+ state = tevent_req_data(req, struct cli_lockingx_state);
+ state->subreq = subreq;
status = smb1cli_req_chain_submit(&subreq, 1);
if (tevent_req_nterror(req, status)) {
return tevent_req_post(req, ev);
}
+ tevent_req_set_cancel_fn(req, cli_lockingx_cancel);
return req;
}
@@ -3548,6 +3554,16 @@ static void cli_lockingx_done(struct tevent_req *subreq)
tevent_req_simple_finish_ntstatus(subreq, status);
}
+static bool cli_lockingx_cancel(struct tevent_req *req)
+{
+ struct cli_lockingx_state *state = tevent_req_data(
+ req, struct cli_lockingx_state);
+ if (state->subreq == NULL) {
+ return false;
+ }
+ return tevent_req_cancel(state->subreq);
+}
+
NTSTATUS cli_lockingx_recv(struct tevent_req *req)
{
return tevent_req_simple_recv_ntstatus(req);