pylibsmb: Use async cli_unlink also for smb2
authorVolker Lendecke <vl@samba.org>
Tue, 26 May 2020 07:01:57 +0000 (09:01 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 28 May 2020 19:11:38 +0000 (19:11 +0000)
Async cli_smb2_unlink was just added

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

index bfa6f1bec24777a0cf0fa9953011ffb8867365a4..38bcae73db06802ca625148f900981e159fa94df 100644 (file)
@@ -1258,20 +1258,15 @@ static NTSTATUS unlink_file(struct py_cli_state *self, const char *filename)
 {
        NTSTATUS status;
        uint16_t attrs = (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+       struct tevent_req *req = NULL;
 
-       if (self->is_smb1) {
-               struct tevent_req *req = NULL;
-
-               req = cli_unlink_send(NULL, self->ev, self->cli, filename,
-                                     attrs);
-               if (!py_tevent_req_wait_exc(self, req)) {
-                       return NT_STATUS_INTERNAL_ERROR;
-               }
-               status = cli_unlink_recv(req);
-               TALLOC_FREE(req);
-       } else {
-               status = cli_unlink(self->cli, filename, attrs);
+       req = cli_unlink_send(
+               NULL, self->ev, self->cli, filename, attrs);
+       if (!py_tevent_req_wait_exc(self, req)) {
+               return NT_STATUS_INTERNAL_ERROR;
        }
+       status = cli_unlink_recv(req);
+       TALLOC_FREE(req);
 
        return status;
 }