From: Volker Lendecke Date: Mon, 25 May 2020 16:23:31 +0000 (+0200) Subject: libsmb: Use async cli_smb2_rmdir in async cli_rmdir X-Git-Tag: ldb-2.2.0~269 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe1e4dc9d956b2b53946855757543eb205fae5c0;p=thirdparty%2Fsamba.git libsmb: Use async cli_smb2_rmdir in async cli_rmdir No need to call the sync wrapper in cli_rmdir() Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 9c029c48d3e..9eefb6fbb06 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -2097,6 +2097,7 @@ NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname) ****************************************************************************/ static void cli_rmdir_done(struct tevent_req *subreq); +static void cli_rmdir_done2(struct tevent_req *subreq); struct cli_rmdir_state { int dummy; @@ -2118,6 +2119,15 @@ struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx, return NULL; } + if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) { + subreq = cli_smb2_rmdir_send(state, ev, cli, dname, NULL); + if (tevent_req_nomem(subreq, req)) { + return tevent_req_post(req, ev); + } + tevent_req_set_callback(subreq, cli_rmdir_done2, req); + return req; + } + bytes = talloc_array(state, uint8_t, 1); if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev); @@ -2158,6 +2168,12 @@ static void cli_rmdir_done(struct tevent_req *subreq) tevent_req_done(req); } +static void cli_rmdir_done2(struct tevent_req *subreq) +{ + NTSTATUS status = cli_smb2_rmdir_recv(subreq); + tevent_req_simple_finish_ntstatus(subreq, status); +} + NTSTATUS cli_rmdir_recv(struct tevent_req *req) { return tevent_req_simple_recv_ntstatus(req); @@ -2170,10 +2186,6 @@ NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname) struct tevent_req *req; NTSTATUS status = NT_STATUS_OK; - if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) { - return cli_smb2_rmdir(cli, dname, NULL); - } - frame = talloc_stackframe(); if (smbXcli_conn_has_async_calls(cli->conn)) { @@ -2201,6 +2213,7 @@ NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname) } status = cli_rmdir_recv(req); + cli->raw_status = status; /* cli_smb2_rmdir_recv doesn't set this */ fail: TALLOC_FREE(frame);