diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 7c38a79e9d7..38965f67987 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -877,15 +877,6 @@ bool recursive_rmdir(TALLOC_CTX *ctx, continue; } - if (!is_visible_file(conn, - dir_hnd, - dname, - &st, - false)) { - TALLOC_FREE(talloced); - continue; - } - /* Construct the full name. */ fullname = talloc_asprintf(ctx, "%s/%s", @@ -931,6 +922,14 @@ bool recursive_rmdir(TALLOC_CTX *ctx, goto err_break; } + if (!is_visible_fsp(atname->fsp, false)) { + TALLOC_FREE(smb_dname_full); + TALLOC_FREE(fullname); + TALLOC_FREE(talloced); + TALLOC_FREE(atname); + continue; + } + retval = SMB_VFS_UNLINKAT(conn, dirfsp, atname,