From: Jeremy Allison Date: Thu, 3 Jun 2021 00:51:25 +0000 (-0700) Subject: s3: smbd: In rmdir_internals(), Change is_visible_file() -> is_visible_fsp(). X-Git-Tag: tevent-0.11.0~577 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=452dbd10d928debcbb61effc347e5cedfd5e7681;p=thirdparty%2Fsamba.git 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 Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 38965f67987..0113bed781c 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -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,