smbd: Remove unused "sbuf" argument from ReadDirName()
authorVolker Lendecke <vl@samba.org>
Tue, 20 Jun 2023 10:25:45 +0000 (12:25 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 23 Jun 2023 17:34:30 +0000 (17:34 +0000)
Nobody used that anymore, most callers had passed in NULL anyway.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_ceph_snapshots.c
source3/modules/vfs_fruit.c
source3/modules/vfs_shadow_copy.c
source3/modules/vfs_streams_depot.c
source3/smbd/close.c
source3/smbd/dir.c
source3/smbd/filename.c
source3/smbd/msdfs.c
source3/smbd/proto.h
source3/torture/cmd_vfs.c

index c09b1895f88202d9d433f0ed8508bfe7a690c5ec..f9ae977918c5ba73f5af271fef9fe821c2fe7230 100644 (file)
@@ -264,9 +264,7 @@ static int ceph_snap_enum_snapdir(struct vfs_handle_struct *handle,
        sc_data->num_volumes = 0;
        sc_data->labels = NULL;
 
-        while ((dname = ReadDirName(dir_hnd, NULL, &talloced))
-              != NULL)
-       {
+       while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
                if (ISDOT(dname) || ISDOTDOT(dname)) {
                        TALLOC_FREE(talloced);
                        continue;
@@ -587,9 +585,7 @@ static int ceph_snap_gmt_convert_dir(struct vfs_handle_struct *handle,
                goto err_out;
        }
 
-        while ((dname = ReadDirName(dir_hnd, NULL, &talloced))
-              != NULL)
-       {
+       while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
                struct smb_filename *smb_fname = NULL;
                struct smb_filename *atname = NULL;
                time_t snap_secs = 0;
index 8be6b4c7791d7f64785a4d63bd61979443ac6b7f..02f04196e482baad44460f66f670f0654190222c 100644 (file)
@@ -5224,9 +5224,7 @@ static bool fruit_get_num_bands(vfs_handle_struct *handle,
 
        nbands = 0;
 
-        while ((dname = ReadDirName(dir_hnd, NULL, &talloced))
-              != NULL)
-       {
+       while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
                if (ISDOT(dname) || ISDOTDOT(dname)) {
                        continue;
                }
@@ -5365,9 +5363,7 @@ static uint64_t fruit_disk_free(vfs_handle_struct *handle,
                return UINT64_MAX;
        }
 
-        while ((dname = ReadDirName(dir_hnd, NULL, &talloced))
-              != NULL)
-       {
+       while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
                ok = fruit_tmsize_do_dirent(handle, &state, dname);
                if (!ok) {
                        TALLOC_FREE(talloced);
index 7b1ff9c7fc14cb435393039cd76f3cdb88450fbe..e32826f88b41cce08b8efc1dac6eb5f079db08b3 100644 (file)
@@ -195,7 +195,7 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
                SHADOW_COPY_LABEL *tlabels;
                int ret;
 
-               dname = ReadDirName(dir_hnd, NULL, &talloced);
+               dname = ReadDirName(dir_hnd, &talloced);
                if (dname == NULL) {
                        break;
                }
index 08c3114771cee96f30177f2ea0a4d68d347f787f..91d592307b391a8c73adf3e4e4615642cc2876bc 100644 (file)
@@ -563,9 +563,7 @@ static NTSTATUS walk_streams(vfs_handle_struct *handle,
                return status;
        }
 
-        while ((dname = ReadDirName(dir_hnd, NULL, &talloced))
-              != NULL)
-       {
+       while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
                if (ISDOT(dname) || ISDOTDOT(dname)) {
                        TALLOC_FREE(talloced);
                        continue;
index 38c2a5ac73e1a55157310d7dba11a6c3fc2be6ce..75089d41b470c85875cfd04236335f9a0ac2e1b1 100644 (file)
@@ -968,7 +968,7 @@ NTSTATUS recursive_rmdir(TALLOC_CTX *ctx,
 
        dirfsp = dir_hnd_fetch_fsp(dir_hnd);
 
-       while ((dname = ReadDirName(dir_hnd, NULL, &talloced))) {
+       while ((dname = ReadDirName(dir_hnd, &talloced))) {
                struct smb_filename *atname = NULL;
                struct smb_filename *smb_dname_full = NULL;
                char *fullname = NULL;
@@ -1054,7 +1054,7 @@ NTSTATUS recursive_rmdir(TALLOC_CTX *ctx,
                if (do_break) {
                        break;
                }
-       }
+        }
        TALLOC_FREE(dir_hnd);
        return status;
 }
@@ -1169,8 +1169,7 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp)
 
        dirfsp = dir_hnd_fetch_fsp(dir_hnd);
 
-       while ((dname = ReadDirName(
-                       dir_hnd, NULL, &talloced)) != NULL) {
+       while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
                struct smb_filename *smb_dname_full = NULL;
                struct smb_filename *direntry_fname = NULL;
                char *fullname = NULL;
@@ -1318,8 +1317,7 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp)
        /* Do a recursive delete. */
        RewindDir(dir_hnd);
 
-       while ((dname = ReadDirName(
-                       dir_hnd, NULL, &talloced)) != NULL) {
+       while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
                struct smb_filename *direntry_fname = NULL;
                struct smb_filename *smb_dname_full = NULL;
                char *fullname = NULL;
index c4d6b90a75b43ffdac636bd04427abf35a7512de..5b12f773ddffe576da3625a32e7e89e4d3473476 100644 (file)
@@ -407,7 +407,7 @@ char *dptr_ReadDirName(TALLOC_CTX *ctx, struct dptr_struct *dptr)
        if (dptr->has_wild) {
                const char *name_temp = NULL;
                char *talloced = NULL;
-               name_temp = ReadDirName(dir_hnd, &st, &talloced);
+               name_temp = ReadDirName(dir_hnd, &talloced);
                if (name_temp == NULL) {
                        return NULL;
                }
@@ -1249,9 +1249,11 @@ static NTSTATUS OpenDir_fsp(
  Don't check for veto or invisible files.
 ********************************************************************/
 
-const char *ReadDirName(struct smb_Dir *dir_hnd,
-                       SMB_STRUCT_STAT *sbuf, char **ptalloced)
+const char *ReadDirName(struct smb_Dir *dir_hnd, char **ptalloced)
 {
+       struct stat_ex st = {
+               .st_ex_nlink = 0,
+       };
        const char *n;
        char *talloced = NULL;
        connection_struct *conn = dir_hnd->conn;
@@ -1267,7 +1269,11 @@ const char *ReadDirName(struct smb_Dir *dir_hnd,
                return n;
        }
 
-       while ((n = vfs_readdirname(conn, dir_hnd->fsp, dir_hnd->dir, sbuf, &talloced))) {
+       while ((n = vfs_readdirname(conn,
+                                   dir_hnd->fsp,
+                                   dir_hnd->dir,
+                                   &st,
+                                   &talloced))) {
                /* Ignore . and .. - we've already returned them. */
                if (ISDOT(n) || ISDOTDOT(n)) {
                        TALLOC_FREE(talloced);
@@ -1425,7 +1431,7 @@ NTSTATUS can_delete_directory_fsp(files_struct *fsp)
                return status;
        }
 
-       while ((dname = ReadDirName(dir_hnd, NULL, &talloced))) {
+       while ((dname = ReadDirName(dir_hnd, &talloced))) {
                struct smb_filename *smb_dname_full = NULL;
                struct smb_filename *direntry_fname = NULL;
                char *fullname = NULL;
index 963251c40edbf5d69fee5d194f052ffafeb77d6a..3cffef1cfeeb8f98bab01c9ed7101398ff2361a4 100644 (file)
@@ -323,7 +323,7 @@ NTSTATUS get_real_filename_full_scan_at(struct files_struct *dirfsp,
        }
 
        /* now scan for matching names */
-       while ((dname = ReadDirName(cur_dir, NULL, &talloced))) {
+       while ((dname = ReadDirName(cur_dir, &talloced))) {
 
                /* Is it dot or dot dot. */
                if (ISDOT(dname) || ISDOTDOT(dname)) {
index 2487ea18c94df94ffaf4a798940817f357d8a848..dfe11e65d2a0d09a199379a314153c26db726ad6 100644 (file)
@@ -1538,9 +1538,7 @@ static size_t count_dfs_links(TALLOC_CTX *ctx,
                goto out;
        }
 
-        while ((dname = ReadDirName(dir_hnd, NULL, &talloced))
-              != NULL)
-       {
+       while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
                struct smb_filename *smb_dname =
                        synthetic_smb_fname(frame,
                                        dname,
@@ -1680,9 +1678,7 @@ static int form_junctions(TALLOC_CTX *ctx,
                goto out;
        }
 
-        while ((dname = ReadDirName(dir_hnd, NULL, &talloced))
-              != NULL)
-       {
+       while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
                struct smb_filename *smb_dname = NULL;
 
                if (cnt >= jn_remain) {
index 817f4a1103823140b0f74a054305e3d10bf1e0c0..7f1bbf0655e22dfb23b39f15ffb0dec9402fa554 100644 (file)
@@ -216,8 +216,7 @@ NTSTATUS OpenDir_from_pathref(TALLOC_CTX *mem_ctx,
                              const char *mask,
                              uint32_t attr,
                              struct smb_Dir **_dir_hnd);
-const char *ReadDirName(struct smb_Dir *dir_hnd,
-                       SMB_STRUCT_STAT *sbuf, char **talloced);
+const char *ReadDirName(struct smb_Dir *dir_hnd, char **talloced);
 void RewindDir(struct smb_Dir *dir_hnd);
 NTSTATUS can_delete_directory(struct connection_struct *conn,
                                const char *dirname);
index f8da602ec434877a21892fabbe8632f556fc36e1..9939f2d2c2f160bd7316f02d79efaf3d3c021ee6 100644 (file)
@@ -202,9 +202,7 @@ static NTSTATUS cmd_readdir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc
                return NT_STATUS_UNSUCCESSFUL;
        }
 
-        dname = ReadDirName(vfs->currentdir,
-                           NULL,
-                           &talloced);
+       dname = ReadDirName(vfs->currentdir, &talloced);
        if (dname == NULL) {
                printf("readdir: NULL\n");
                return NT_STATUS_OK;
@@ -2154,9 +2152,7 @@ static NTSTATUS cmd_translate_name(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
 
        while (true) {
                /* ReadDirName() returns Windows "encoding" */
-               dname = ReadDirName(vfs->currentdir,
-                                   NULL,
-                                   &dname_talloced);
+               dname = ReadDirName(vfs->currentdir, &dname_talloced);
                if (dname == NULL) {
                        break;
                }