]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Remove unused sync cli_smb2_list()
authorVolker Lendecke <vl@samba.org>
Tue, 17 Nov 2020 11:31:20 +0000 (12:31 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 19 Nov 2020 02:48:40 +0000 (02:48 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/cli_smb2_fnum.c
source3/libsmb/cli_smb2_fnum.h

index 575741458613d81edeebda9b1037097291cfaf45..2dd76de967a03223394a869187e991e38f6cbc44 100644 (file)
@@ -1538,111 +1538,6 @@ fail:
        return status;
 }
 
-/***************************************************************
- Wrapper that allows SMB2 to list a directory.
-***************************************************************/
-
-struct cli_smb2_list_sync_state {
-       const char *pathname;
-       uint32_t attribute;
-       NTSTATUS (*fn)(struct file_info *finfo,
-                      const char *mask,
-                      void *private_data);
-       void *private_data;
-       NTSTATUS status;
-       bool processed_file;
-};
-
-static void cli_smb2_list_sync_cb(struct tevent_req *subreq)
-{
-       struct cli_smb2_list_sync_state *state =
-               tevent_req_callback_data_void(subreq);
-       struct file_info *finfo = NULL;
-       bool ok;
-
-       state->status = cli_smb2_list_recv(subreq, talloc_tos(), &finfo);
-       /* No TALLOC_FREE(subreq), we get here more than once */
-
-       if (!NT_STATUS_IS_OK(state->status)) {
-               return;
-       }
-
-       ok = dir_check_ftype(finfo->attr, state->attribute);
-       if (ok) {
-               /*
-                * Only process if attributes match.  SMB1 servers do
-                * the filtering, so with SMB2 we need to emulate it
-                * in the client.
-                *
-                * https://bugzilla.samba.org/show_bug.cgi?id=10260
-                */
-               state->status = state->fn(
-                       finfo, state->pathname, state->private_data);
-
-               state->processed_file = true;
-       }
-
-       TALLOC_FREE(finfo);
-}
-
-NTSTATUS cli_smb2_list(struct cli_state *cli,
-                      const char *pathname,
-                      uint32_t attribute,
-                      NTSTATUS (*fn)(struct file_info *finfo,
-                                     const char *mask,
-                                     void *private_data),
-                      void *private_data)
-{
-       TALLOC_CTX *frame = talloc_stackframe();
-       struct cli_smb2_list_sync_state state = {
-               .pathname = pathname,
-               .attribute = attribute,
-               .fn = fn,
-               .private_data = private_data,
-       };
-       struct tevent_context *ev = NULL;
-       struct tevent_req *req = NULL;
-       NTSTATUS status = NT_STATUS_NO_MEMORY;
-
-       if (smbXcli_conn_has_async_calls(cli->conn)) {
-               /*
-                * Can't use sync call while an async call is in flight
-                */
-               status = NT_STATUS_INVALID_PARAMETER;
-               goto fail;
-       }
-
-       ev = samba_tevent_context_init(frame);
-       if (ev == NULL) {
-               goto fail;
-       }
-       req = cli_smb2_list_send(frame, ev, cli, pathname);
-       if (req == NULL) {
-               goto fail;
-       }
-       tevent_req_set_callback(req, cli_smb2_list_sync_cb, &state);
-
-       if (!tevent_req_poll_ntstatus(req, ev, &status)) {
-               goto fail;
-       }
-
-       status = state.status;
-
-       if (NT_STATUS_EQUAL(status, NT_STATUS_NO_MORE_FILES)) {
-               if (state.processed_file) {
-                       status = NT_STATUS_OK;
-               } else {
-                       status = NT_STATUS_NO_SUCH_FILE;
-               }
-       }
-
-fail:
-       TALLOC_FREE(req);
-       TALLOC_FREE(ev);
-       TALLOC_FREE(frame);
-       return status;
-}
-
 /***************************************************************
  Wrapper that allows SMB2 to query a path info (basic level).
  Synchronous only.
index 3625a8182b06dce142ba80e971093add2f8a9211..91781b6a11b74c18a8e474972efa231e636e482e 100644 (file)
@@ -102,13 +102,6 @@ NTSTATUS cli_smb2_list_recv(
        struct tevent_req *req,
        TALLOC_CTX *mem_ctx,
        struct file_info **pfinfo);
-NTSTATUS cli_smb2_list(struct cli_state *cli,
-                      const char *pathname,
-                      uint32_t attribute,
-                      NTSTATUS (*fn)(struct file_info *finfo,
-                                     const char *mask,
-                                     void *private_data),
-                      void *private_data);
 NTSTATUS cli_smb2_qpathinfo_basic(struct cli_state *cli,
                        const char *name,
                        SMB_STRUCT_STAT *sbuf,