]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Use async cli_smb2_rmdir in async cli_rmdir
authorVolker Lendecke <vl@samba.org>
Mon, 25 May 2020 16:23:31 +0000 (18:23 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 28 May 2020 19:11:39 +0000 (19:11 +0000)
No need to call the sync wrapper in cli_rmdir()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/clifile.c

index 9c029c48d3e69ea7124fa6e17fc38e0d5f708342..9eefb6fbb0673c7245df12b8a545e94245ebf0e1 100644 (file)
@@ -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);