mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
libsmb: Make cli_notify_send/recv smb2-aware
smb2-awareness only existed in the sync wrapper Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
d4a8bed855
commit
4c984f3f50
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user