From: Volker Lendecke Date: Mon, 25 May 2020 16:23:31 +0000 (+0200) Subject: libsmb: Use async cli_smb2_chkpath in async cli_chkpath X-Git-Tag: ldb-2.2.0~264 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4bf5b23811f9bc14a8b6cabd3bfcb98778d31e0;p=thirdparty%2Fsamba.git libsmb: Use async cli_smb2_chkpath in async cli_chkpath No need to call the sync wrapper in cli_chkpath() Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 3df5d9447aa..ac546c21f8b 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -4612,6 +4612,7 @@ NTSTATUS cli_setatr(struct cli_state *cli, ****************************************************************************/ static void cli_chkpath_done(struct tevent_req *subreq); +static void cli_chkpath_done2(struct tevent_req *subreq); struct cli_chkpath_state { int dummy; @@ -4633,6 +4634,15 @@ struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx, return NULL; } + if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) { + subreq = cli_smb2_chkpath_send(state, ev, cli, fname); + if (tevent_req_nomem(subreq, req)) { + return tevent_req_post(req, ev); + } + tevent_req_set_callback(subreq, cli_chkpath_done2, req); + return req; + } + bytes = talloc_array(state, uint8_t, 1); if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev); @@ -4673,6 +4683,12 @@ static void cli_chkpath_done(struct tevent_req *subreq) tevent_req_done(req); } +static void cli_chkpath_done2(struct tevent_req *subreq) +{ + NTSTATUS status = cli_smb2_chkpath_recv(subreq); + tevent_req_simple_finish_ntstatus(subreq, status); +} + NTSTATUS cli_chkpath_recv(struct tevent_req *req) { return tevent_req_simple_recv_ntstatus(req); @@ -4686,10 +4702,6 @@ NTSTATUS cli_chkpath(struct cli_state *cli, const char *path) char *path2 = NULL; NTSTATUS status = NT_STATUS_OK; - if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) { - return cli_smb2_chkpath(cli, path); - } - frame = talloc_stackframe(); if (smbXcli_conn_has_async_calls(cli->conn)) { @@ -4731,6 +4743,7 @@ NTSTATUS cli_chkpath(struct cli_state *cli, const char *path) } status = cli_chkpath_recv(req); + cli->raw_status = status; /* cli_smb2_chkpath_recv doesn't set this */ fail: TALLOC_FREE(frame);