From: Volker Lendecke Date: Mon, 25 May 2020 16:23:31 +0000 (+0200) Subject: libsmb: Use async cli_smb2_unlink in async cli_unlink X-Git-Tag: ldb-2.2.0~281 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c8312f8e8777c4e5d0c3bcddc8ad8f95f8fa60e;p=thirdparty%2Fsamba.git libsmb: Use async cli_smb2_unlink in async cli_unlink No need to call the sync wrapper in cli_unlink() Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index b39a7968c57..a6ab8f6f8c4 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -1858,6 +1858,7 @@ NTSTATUS cli_hardlink( ****************************************************************************/ static void cli_unlink_done(struct tevent_req *subreq); +static void cli_unlink_done2(struct tevent_req *subreq); struct cli_unlink_state { uint16_t vwv[1]; @@ -1880,6 +1881,15 @@ struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx, return NULL; } + if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) { + subreq = cli_smb2_unlink_send(state, ev, cli, fname, NULL); + if (tevent_req_nomem(subreq, req)) { + return tevent_req_post(req, ev); + } + tevent_req_set_callback(subreq, cli_unlink_done2, req); + return req; + } + SSVAL(state->vwv+0, 0, mayhave_attrs); bytes = talloc_array(state, uint8_t, 1); @@ -1922,6 +1932,12 @@ static void cli_unlink_done(struct tevent_req *subreq) tevent_req_done(req); } +static void cli_unlink_done2(struct tevent_req *subreq) +{ + NTSTATUS status = cli_smb2_unlink_recv(subreq); + tevent_req_simple_finish_ntstatus(subreq, status); +} + NTSTATUS cli_unlink_recv(struct tevent_req *req) { return tevent_req_simple_recv_ntstatus(req); @@ -1934,10 +1950,6 @@ NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_a struct tevent_req *req; NTSTATUS status = NT_STATUS_OK; - if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) { - return cli_smb2_unlink(cli, fname, NULL); - } - frame = talloc_stackframe(); if (smbXcli_conn_has_async_calls(cli->conn)) { @@ -1965,6 +1977,7 @@ NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_a } status = cli_unlink_recv(req); + cli->raw_status = status; /* cli_smb2_unlink_recv doesn't set this */ fail: TALLOC_FREE(frame);