]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: In rmdir_internals(), Change is_visible_file() -> is_visible_fsp().
authorJeremy Allison <jra@samba.org>
Thu, 3 Jun 2021 00:51:25 +0000 (17:51 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 9 Jun 2021 13:14:30 +0000 (13:14 +0000)
This needs some slight re-arranging, as previously
is_visible_file() preceeds the call to recursive_rmdir().

As we have to move the call to is_visible_fsp()
until after we have direntry_fname->fsp, then
we must also move the recursive_rmdir() to be
after is_visible_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/close.c

index 38965f679879c0d79575661e7e1b9866b4536e62..0113bed781cf649ea060364dc3c0a45c4ad4f660 100644 (file)
@@ -1094,15 +1094,6 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp)
                        TALLOC_FREE(talloced);
                        continue;
                }
-               if (!is_visible_file(conn,
-                                    dir_hnd,
-                                    dname,
-                                    &st,
-                                    false))
-               {
-                       TALLOC_FREE(talloced);
-                       continue;
-               }
 
                fullname = talloc_asprintf(ctx,
                                           "%s/%s",
@@ -1134,17 +1125,6 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp)
                        goto err_break;
                }
 
-               unlink_flags = 0;
-
-               if (smb_dname_full->st.st_ex_mode & S_IFDIR) {
-                       if (!recursive_rmdir(ctx, conn,
-                                            smb_dname_full))
-                       {
-                               goto err_break;
-                       }
-                       unlink_flags = AT_REMOVEDIR;
-               }
-
                status = synthetic_pathref(talloc_tos(),
                                           dirfsp,
                                           dname,
@@ -1158,6 +1138,25 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp)
                        goto err_break;
                }
 
+               if (!is_visible_fsp(direntry_fname->fsp, false)) {
+                       TALLOC_FREE(fullname);
+                       TALLOC_FREE(smb_dname_full);
+                       TALLOC_FREE(talloced);
+                       TALLOC_FREE(direntry_fname);
+                       continue;
+               }
+
+               unlink_flags = 0;
+
+               if (smb_dname_full->st.st_ex_mode & S_IFDIR) {
+                       if (!recursive_rmdir(ctx, conn,
+                                            smb_dname_full))
+                       {
+                               goto err_break;
+                       }
+                       unlink_flags = AT_REMOVEDIR;
+               }
+
                retval = SMB_VFS_UNLINKAT(conn,
                                          dirfsp,
                                          direntry_fname,