libsmb: Remove "mntpoint" argument from cli_list() callback
authorVolker Lendecke <vl@samba.org>
Mon, 19 Oct 2020 08:09:23 +0000 (10:09 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 4 Nov 2020 18:55:40 +0000 (18:55 +0000)
do_list()/do_list_helper() in source3/client/client.c was the only user of this
argument. And that use was wrong.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
14 files changed:
libgpo/gpo_filesync.c
source3/client/client.c
source3/libsmb/cli_smb2_fnum.c
source3/libsmb/cli_smb2_fnum.h
source3/libsmb/clilist.c
source3/libsmb/libsmb_dir.c
source3/libsmb/proto.h
source3/libsmb/pylibsmb.c
source3/torture/nbio.c
source3/torture/test_hidenewfiles.c
source3/torture/test_readdir_timestamp.c
source3/torture/torture.c
source3/utils/net_rpc.c
source3/utils/smbcacls.c

index 3cd9470655121353d5f8f3362f1b184dced449ab..a547f5da77c8344f970690e75aba001c63f23174 100644 (file)
@@ -33,8 +33,7 @@ struct sync_context {
        uint16_t attribute;
 };
 
-static NTSTATUS gpo_sync_func(const char *mnt,
-                         struct file_info *info,
+static NTSTATUS gpo_sync_func(struct file_info *info,
                          const char *mask,
                          void *state);
 
@@ -136,8 +135,7 @@ static NTSTATUS gpo_sync_files(struct sync_context *ctx)
  syncronisation call back
 ****************************************************************/
 
-static NTSTATUS gpo_sync_func(const char *mnt,
-                         struct file_info *info,
+static NTSTATUS gpo_sync_func(struct file_info *info,
                          const char *mask,
                          void *state)
 {
index 45bfb18de1e2d1b3170bde5aa4035716568c8ed8..e2fdacd1251cd2c422215f3c4c30e91ee4e60a1b 100644 (file)
@@ -748,9 +748,8 @@ struct do_list_helper_state {
 };
 
 static NTSTATUS do_list_helper(
-       const char *mntpoint,
        struct file_info *f,
-       const char *mask,
+       const char *_mask,
        void *private_data)
 {
        struct do_list_helper_state *state = private_data;
@@ -5721,8 +5720,7 @@ struct completion_remote {
        int len;
 };
 
-static NTSTATUS completion_remote_filter(const char *mnt,
-                               struct file_info *f,
+static NTSTATUS completion_remote_filter(struct file_info *f,
                                const char *mask,
                                void *state)
 {
index 492bc4a54145151172dbafdc7c783d456b530414..b64ff087047b2c5f706e5139216c6b529853cd6e 100644 (file)
@@ -1287,8 +1287,7 @@ static bool windows_parent_dirname(TALLOC_CTX *mem_ctx,
 NTSTATUS cli_smb2_list(struct cli_state *cli,
                       const char *pathname,
                       uint32_t attribute,
-                      NTSTATUS (*fn)(const char *mointpoint,
-                                     struct file_info *finfo,
+                      NTSTATUS (*fn)(struct file_info *finfo,
                                      const char *mask,
                                      void *private_data),
                       void *private_data)
@@ -1430,7 +1429,7 @@ NTSTATUS cli_smb2_list(struct cli_state *cli,
                                 */
                                processed_file = true;
 
-                               status = fn(cli->dfs_mountpoint,
+                               status = fn(
                                        finfo,
                                        pathname,
                                        private_data);
index e24c8cb727905b07d7ae2422574068a0585aba99..d47ca43f9dd96394d5b796bd2510ce288ac97b8b 100644 (file)
@@ -96,8 +96,7 @@ NTSTATUS cli_smb2_unlink_recv(struct tevent_req *req);
 NTSTATUS cli_smb2_list(struct cli_state *cli,
                       const char *pathname,
                       uint32_t attribute,
-                      NTSTATUS (*fn)(const char *mointpoint,
-                                     struct file_info *finfo,
+                      NTSTATUS (*fn)(struct file_info *finfo,
                                      const char *mask,
                                      void *private_data),
                       void *private_data);
index 57fefdc382a6a5a020250375999ad6406b990053..48635b9cac8011c7115237b091a32ea64cf2df68 100644 (file)
@@ -569,7 +569,7 @@ static NTSTATUS cli_list_old_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
 
 NTSTATUS cli_list_old(struct cli_state *cli, const char *mask,
                      uint32_t attribute,
-                     NTSTATUS (*fn)(const char *, struct file_info *,
+                     NTSTATUS (*fn)(struct file_info *,
                                 const char *, void *), void *state)
 {
        TALLOC_CTX *frame = talloc_stackframe();
@@ -603,7 +603,7 @@ NTSTATUS cli_list_old(struct cli_state *cli, const char *mask,
        }
        num_finfo = talloc_array_length(finfo);
        for (i=0; i<num_finfo; i++) {
-               status = fn(cli->dfs_mountpoint, &finfo[i], mask, state);
+               status = fn(&finfo[i], mask, state);
                if (!NT_STATUS_IS_OK(status)) {
                        goto fail;
                }
@@ -1040,8 +1040,7 @@ NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
 NTSTATUS cli_list(struct cli_state *cli,
                  const char *mask,
                  uint32_t attribute,
-                 NTSTATUS (*fn)(const char *mointpoint,
-                                struct file_info *finfo,
+                 NTSTATUS (*fn)(struct file_info *finfo,
                                 const char *mask,
                                 void *private_data),
                  void *private_data)
@@ -1089,8 +1088,7 @@ NTSTATUS cli_list(struct cli_state *cli,
        }
 
        for (i=0; i<num_finfo; i++) {
-               status = fn(
-                       cli->dfs_mountpoint, &finfo[i], mask, private_data);
+               status = fn(&finfo[i], mask, private_data);
                if (!NT_STATUS_IS_OK(status)) {
                        goto fail;
                }
index 4fbfb19b15d9c78d7b6d679f1a9d7e8189ecb70f..27d0fbd4db56a324e37a38d3d745f6a64ae8f3bd 100644 (file)
@@ -333,8 +333,7 @@ list_fn(const char *name,
 }
 
 static NTSTATUS
-dir_list_fn(const char *mnt,
-            struct file_info *finfo,
+dir_list_fn(struct file_info *finfo,
             const char *mask,
             void *state)
 {
@@ -1636,8 +1635,7 @@ SMBC_mkdir_ctx(SMBCCTX *context,
  */
 
 static NTSTATUS
-rmdir_list_fn(const char *mnt,
-              struct file_info *finfo,
+rmdir_list_fn(struct file_info *finfo,
               const char *mask,
               void *state)
 {
index 0e036c5ddc8e88d6052f5612072bb70908583a12..5715a0173ecfaf391559d4c205bf725e54259490 100644 (file)
@@ -742,7 +742,7 @@ NTSTATUS is_bad_finfo_name(const struct cli_state *cli,
                        const struct file_info *finfo);
 
 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint32_t attribute,
-                     NTSTATUS (*fn)(const char *, struct file_info *,
+                     NTSTATUS (*fn)(struct file_info *,
                                 const char *, void *), void *state);
 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
                        uint32_t attribute, int info_level,
@@ -760,8 +760,7 @@ NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
 NTSTATUS cli_list(struct cli_state *cli,
                  const char *mask,
                  uint32_t attribute,
-                 NTSTATUS (*fn)(const char *mointpoint,
-                                struct file_info *finfo,
+                 NTSTATUS (*fn)(struct file_info *finfo,
                                 const char *mask,
                                 void *private_data),
                  void *private_data);
index c7a2d73afcb56f05666b3d676ee556171fe2b617..7985b842a1576fa0a28ee206eae2494fb7fde535 100644 (file)
@@ -1106,7 +1106,7 @@ static PyObject *py_cli_delete_on_close(struct py_cli_state *self,
 /*
  * Helper to add directory listing entries to an overall Python list
  */
-static NTSTATUS list_helper(const char *mntpoint, struct file_info *finfo,
+static NTSTATUS list_helper(struct file_info *finfo,
                            const char *mask, void *state)
 {
        PyObject *result = (PyObject *)state;
@@ -1149,8 +1149,7 @@ static NTSTATUS list_helper(const char *mntpoint, struct file_info *finfo,
 static NTSTATUS do_listing(struct py_cli_state *self,
                           const char *base_dir, const char *user_mask,
                           uint16_t attribute,
-                          NTSTATUS (*callback_fn)(const char *,
-                                                  struct file_info *,
+                          NTSTATUS (*callback_fn)(struct file_info *,
                                                   const char *, void *),
                           void *priv)
 {
@@ -1194,7 +1193,7 @@ static NTSTATUS do_listing(struct py_cli_state *self,
 
        /* invoke the callback for the async results (SMBv1 connections) */
        for (i = 0; i < num_finfos; i++) {
-               status = callback_fn(base_dir, &finfos[i], user_mask,
+               status = callback_fn(&finfos[i], user_mask,
                                     priv);
                if (!NT_STATUS_IS_OK(status)) {
                        TALLOC_FREE(finfos);
@@ -1375,8 +1374,7 @@ static NTSTATUS delete_dir_tree(struct py_cli_state *self,
  * or a directory. This function gets invoked as a callback for every item in
  * the given directory's listings.
  */
-static NTSTATUS delete_tree_callback(const char *mntpoint,
-                                    struct file_info *finfo,
+static NTSTATUS delete_tree_callback(struct file_info *finfo,
                                     const char *mask, void *priv)
 {
        char *filepath = NULL;
index 582f0b7e2e9fe1f615a1547fb4ded7de1f9f5dcd..4fedfc59912351aba5ca3d690fb6dbfc71dc924e 100644 (file)
@@ -290,7 +290,7 @@ void nb_qfsinfo(int level)
        cli_disk_size(c, "", &bsize, &total, &avail);
 }
 
-static NTSTATUS find_fn(const char *mnt, struct file_info *finfo, const char *name,
+static NTSTATUS find_fn(struct file_info *finfo, const char *name,
                    void *state)
 {
        /* noop */
@@ -312,7 +312,7 @@ void nb_flush(int fnum)
 
 static int total_deleted;
 
-static NTSTATUS delete_fn(const char *mnt, struct file_info *finfo,
+static NTSTATUS delete_fn(struct file_info *finfo,
                      const char *name, void *state)
 {
        NTSTATUS status;
index 2f1638a6ae7faba7f4b440c0abe801d8b470a377..05e6d7ef2b1081a70a90f1a05fd5f266a9a2e6fd 100644 (file)
@@ -62,8 +62,7 @@ struct have_file_state {
        const char *fname;
 };
 
-static NTSTATUS have_file_fn(const char *mntpoint,
-                            struct file_info *f,
+static NTSTATUS have_file_fn(struct file_info *f,
                             const char *mask,
                             void *private_data)
 {
index e53883cc21fd78ff248a4d74c09634c512824e3a..0eba415c8b45ce93634df6e7e0ed329a8883a28d 100644 (file)
@@ -403,7 +403,6 @@ struct list_cb_state {
 };
 
 static NTSTATUS list_cb(
-       const char *mntpoint,
        struct file_info *f,
        const char *mask,
        void *private_data)
index d68ee579daf16e9d2c8d1f2e1d83b27daa8fd937..5440b7288eac90989b1866e039c0b3157618a098 100644 (file)
@@ -9659,7 +9659,7 @@ static bool run_openattrtest(int dummy)
        return correct;
 }
 
-static NTSTATUS list_fn(const char *mnt, struct file_info *finfo,
+static NTSTATUS list_fn(struct file_info *finfo,
                    const char *name, void *state)
 {
        int *matched = (int *)state;
@@ -9732,7 +9732,7 @@ static bool run_dirtest(int dummy)
        return correct;
 }
 
-static NTSTATUS del_fn(const char *mnt, struct file_info *finfo, const char *mask,
+static NTSTATUS del_fn(struct file_info *finfo, const char *mask,
                   void *state)
 {
        struct cli_state *pcli = (struct cli_state *)state;
@@ -10909,8 +10909,7 @@ static bool run_mangle1(int dummy)
        return true;
 }
 
-static NTSTATUS mangle_illegal_list_shortname_fn(const char *mntpoint,
-                                                struct file_info *f,
+static NTSTATUS mangle_illegal_list_shortname_fn(struct file_info *f,
                                                 const char *mask,
                                                 void *state)
 {
@@ -10927,8 +10926,7 @@ static NTSTATUS mangle_illegal_list_shortname_fn(const char *mntpoint,
        return NT_STATUS_OBJECT_NAME_INVALID;
 }
 
-static NTSTATUS mangle_illegal_list_name_fn(const char *mntpoint,
-                                           struct file_info *f,
+static NTSTATUS mangle_illegal_list_name_fn(struct file_info *f,
                                            const char *mask,
                                            void *state)
 {
@@ -11461,8 +11459,7 @@ static bool run_large_readx(int dummy)
        return correct;
 }
 
-static NTSTATUS msdfs_attribute_list_fn(const char *mnt,
-                                 struct file_info *finfo,
+static NTSTATUS msdfs_attribute_list_fn(struct file_info *finfo,
                                  const char *mask,
                                  void *private_data)
 {
@@ -11806,7 +11803,7 @@ static bool run_uid_regression_test(int dummy)
 static const char *illegal_chars = "*\\/?<>|\":";
 static char force_shortname_chars[] = " +,.[];=\177";
 
-static NTSTATUS shortname_del_fn(const char *mnt, struct file_info *finfo,
+static NTSTATUS shortname_del_fn(struct file_info *finfo,
                             const char *mask, void *state)
 {
        struct cli_state *pcli = (struct cli_state *)state;
@@ -11838,7 +11835,7 @@ struct sn_state {
        bool val;
 };
 
-static NTSTATUS shortname_list_fn(const char *mnt, struct file_info *finfo,
+static NTSTATUS shortname_list_fn(struct file_info *finfo,
                              const char *name, void *state)
 {
        struct sn_state *s = (struct sn_state  *)state;
@@ -12645,8 +12642,7 @@ static bool run_symlink_open_test(int dummy)
        return correct;
 }
 
-static NTSTATUS smb1_wild_mangle_list_fn(const char *mnt,
-                                       struct file_info *finfo,
+static NTSTATUS smb1_wild_mangle_list_fn(struct file_info *finfo,
                                        const char *name,
                                        void *state)
 {
index 0a7c8429ff938982f3c948d89c7fe71c9b517eff..da1d904305bd28042afdfcbbfd928c31f14faf2d 100644 (file)
@@ -3973,7 +3973,7 @@ static int rpc_share_migrate_shares(struct net_context *c, int argc,
  * @param state        arg-pointer
  *
  **/
-static NTSTATUS copy_fn(const char *mnt, struct file_info *f,
+static NTSTATUS copy_fn(struct file_info *f,
                    const char *mask, void *state)
 {
        static NTSTATUS nt_status;
index 2ff30ad495ee87856d347975a1652372a38a6353..7d280b2fadca8912328fe10b138c7a6e3c0d8651 100644 (file)
@@ -1240,7 +1240,7 @@ out:
  * propagate_inherited_aces. Children that are themselves directories are passed
  * to cli_list again ( to decend the directory structure )
  */
-static NTSTATUS cacl_set_cb(const char *mntpoint, struct file_info *f,
+static NTSTATUS cacl_set_cb(struct file_info *f,
                           const char *mask, void *state)
 {
        struct cacl_callback_state *cbstate =