1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

s3: smbd: In rmdir_internals(), Change is_visible_file() -> is_visible_fsp().

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>
This commit is contained in:
Jeremy Allison 2021-06-02 17:51:25 -07:00 committed by Ralph Boehme
parent e6377a909a
commit 452dbd10d9

View 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,