smbd: Remove unused "pst" argument from dptr_ReadDirName()
authorVolker Lendecke <vl@samba.org>
Tue, 20 Jun 2023 10:19:15 +0000 (12:19 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 23 Jun 2023 17:34:30 +0000 (17:34 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/dir.c
source3/smbd/proto.h
source3/smbd/smb1_trans2.c

index 0daa1d16c9890364fc254c5163faad2743acadb8..c4d6b90a75b43ffdac636bd04427abf35a7512de 100644 (file)
@@ -391,10 +391,11 @@ bool dptr_case_sensitive(struct dptr_struct *dptr)
  Return the next visible file name, skipping veto'd and invisible files.
 ****************************************************************************/
 
-char *dptr_ReadDirName(TALLOC_CTX *ctx,
-                      struct dptr_struct *dptr,
-                      SMB_STRUCT_STAT *pst)
+char *dptr_ReadDirName(TALLOC_CTX *ctx, struct dptr_struct *dptr)
 {
+       struct stat_ex st = {
+               .st_ex_nlink = 0,
+       };
        struct smb_Dir *dir_hnd = dptr->dir_hnd;
        struct files_struct *dir_fsp = dir_hnd->fsp;
        struct smb_filename *dir_name = dir_fsp->fsp_name;
@@ -403,12 +404,10 @@ char *dptr_ReadDirName(TALLOC_CTX *ctx,
        int ret;
        int flags = 0;
 
-       SET_STAT_INVALID(*pst);
-
        if (dptr->has_wild) {
                const char *name_temp = NULL;
                char *talloced = NULL;
-               name_temp = ReadDirName(dir_hnd, pst, &talloced);
+               name_temp = ReadDirName(dir_hnd, &st, &talloced);
                if (name_temp == NULL) {
                        return NULL;
                }
@@ -439,7 +438,7 @@ char *dptr_ReadDirName(TALLOC_CTX *ctx,
                flags |= AT_SYMLINK_NOFOLLOW;
        }
 
-       ret = SMB_VFS_FSTATAT(dptr->conn, dir_fsp, &smb_fname_base, pst, flags);
+       ret = SMB_VFS_FSTATAT(dptr->conn, dir_fsp, &smb_fname_base, &st, flags);
        if (ret == 0) {
                return talloc_strdup(ctx, dptr->wcard);
        }
@@ -551,7 +550,6 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
        slashlen = ( dpath[pathlen-1] != '/') ? 1 : 0;
 
        while (true) {
-               SMB_STRUCT_STAT sbuf = { 0 };
                char *dname = NULL;
                bool isdots;
                char *fname = NULL;
@@ -563,7 +561,7 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
                bool get_dosmode = get_dosmode_in;
                bool ok;
 
-               dname = dptr_ReadDirName(ctx, dirptr, &sbuf);
+               dname = dptr_ReadDirName(ctx, dirptr);
 
                DBG_DEBUG("dir [%s] dirptr [%p] offset [%u] => "
                          "dname [%s]\n",
index 6b48d7c918db58dceefa330d72f5b364ef441e03..817f4a1103823140b0f74a054305e3d10bf1e0c0 100644 (file)
@@ -198,9 +198,7 @@ int dptr_dnum(struct dptr_struct *dptr);
 bool dptr_get_priv(struct dptr_struct *dptr);
 void dptr_set_priv(struct dptr_struct *dptr);
 bool dptr_case_sensitive(struct dptr_struct *dptr);
-char *dptr_ReadDirName(TALLOC_CTX *ctx,
-                      struct dptr_struct *dptr,
-                      SMB_STRUCT_STAT *pst);
+char *dptr_ReadDirName(TALLOC_CTX *ctx, struct dptr_struct *dptr);
 struct smb_Dir;
 struct files_struct *dir_hnd_fetch_fsp(struct smb_Dir *dir_hnd);
 files_struct *dptr_fetch_lanman2_fsp(struct smbd_server_connection *sconn,
index b13afd288f8e00c02b22e6baedfcd24129ae2762..6a10437713326abb0eb2355878caeeaf2ac8f4e8 100644 (file)
@@ -1544,15 +1544,13 @@ static void call_trans2findnext(connection_struct *conn,
                                                  resume_name,
                                                  last_name_sent);
                if (!sequential) {
-                       struct stat_ex st;
                        char *name = NULL;
                        bool found = false;
 
                        dptr_RewindDir(fsp->dptr);
 
                        while ((name = dptr_ReadDirName(talloc_tos(),
-                                                       fsp->dptr,
-                                                       &st)) != NULL) {
+                                                       fsp->dptr)) != NULL) {
                                found = smbd_dptr_name_equal(fsp->dptr,
                                                             resume_name,
                                                             name);