From 4c984f3f50c74a9f9fc35583ac00576faab1d0c5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 16 Nov 2018 13:53:01 +0100 Subject: [PATCH] libsmb: Make cli_notify_send/recv smb2-aware smb2-awareness only existed in the sync wrapper Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source3/libsmb/clifile.c | 43 ++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 5f6e98ce460..1964a155005 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -5497,6 +5497,7 @@ struct cli_notify_state { }; static void cli_notify_done(struct tevent_req *subreq); +static void cli_notify_done_smb2(struct tevent_req *subreq); struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, @@ -5513,6 +5514,22 @@ struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx, return NULL; } + if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) { + subreq = cli_smb2_notify_send( + state, + ev, + cli, + fnum, + buffer_size, + completion_filter, + recursive); + if (tevent_req_nomem(subreq, req)) { + return tevent_req_post(req, ev); + } + tevent_req_set_callback(subreq, cli_notify_done_smb2, req); + return req; + } + SIVAL(state->setup, 0, completion_filter); SSVAL(state->setup, 4, fnum); SSVAL(state->setup, 6, recursive); @@ -5622,6 +5639,26 @@ static void cli_notify_done(struct tevent_req *subreq) tevent_req_done(req); } +static void cli_notify_done_smb2(struct tevent_req *subreq) +{ + struct tevent_req *req = tevent_req_callback_data( + subreq, struct tevent_req); + struct cli_notify_state *state = tevent_req_data( + req, struct cli_notify_state); + NTSTATUS status; + + status = cli_smb2_notify_recv( + subreq, + state, + &state->changes, + &state->num_changes); + TALLOC_FREE(subreq); + if (tevent_req_nterror(req, status)) { + return; + } + tevent_req_done(req); +} + NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, uint32_t *pnum_changes, struct notify_change **pchanges) @@ -5649,12 +5686,6 @@ NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size, struct tevent_req *req; NTSTATUS status = NT_STATUS_NO_MEMORY; - if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) { - return cli_smb2_notify(cli, fnum, buffer_size, - completion_filter, recursive, - mem_ctx, pchanges, pnum_changes); - } - frame = talloc_stackframe(); if (smbXcli_conn_has_async_calls(cli->conn)) { -- 2.47.2