s3: smbd: Ensure in the directory scanning loops inside rmdir_internals() we don...
authorJeremy Allison <jra@samba.org>
Thu, 4 Nov 2021 02:02:36 +0000 (19:02 -0700)
committerRalph Boehme <slow@samba.org>
Thu, 4 Nov 2021 09:10:27 +0000 (09:10 +0000)
If we overwrite with ret=0, we return NT_STATUS_OK even when we goto err.

This function should be restructured to use NT_STATUS internally,
and make 'int ret' transitory, but that's a patch for another
time.

Remove knownfail.

BUG: BUG: https://bugzilla.samba.org/show_bug.cgi?id=14892

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Nov  4 09:10:27 UTC 2021 on sn-devel-184

selftest/knownfail.d/del_on_close_nonempty [deleted file]
source3/smbd/close.c

diff --git a/selftest/knownfail.d/del_on_close_nonempty b/selftest/knownfail.d/del_on_close_nonempty
deleted file mode 100644 (file)
index 7109b99..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.smbtorture_s3.plain.SMB2-DEL-ON-CLOSE-NONEMPTY.smbtorture\(fileserver\)
index ad10215a4fa294cbf477708260310cab665fb931..e627237673943207762346f98a4d84df8a628227 100644 (file)
@@ -1058,6 +1058,7 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp)
                struct smb_filename *smb_dname_full = NULL;
                struct smb_filename *direntry_fname = NULL;
                char *fullname = NULL;
+               int retval;
 
                if (ISDOT(dname) || ISDOTDOT(dname)) {
                        TALLOC_FREE(talloced);
@@ -1092,8 +1093,8 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp)
                        goto err;
                }
 
-               ret = SMB_VFS_LSTAT(conn, smb_dname_full);
-               if (ret != 0) {
+               retval = SMB_VFS_LSTAT(conn, smb_dname_full);
+               if (retval != 0) {
                        int saved_errno = errno;
                        TALLOC_FREE(talloced);
                        TALLOC_FREE(fullname);
@@ -1136,8 +1137,8 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp)
                        }
 
                        /* Not a DFS link - could it be a dangling symlink ? */
-                       ret = SMB_VFS_STAT(conn, smb_dname_full);
-                       if (ret == -1 && (errno == ENOENT || errno == ELOOP)) {
+                       retval = SMB_VFS_STAT(conn, smb_dname_full);
+                       if (retval == -1 && (errno == ENOENT || errno == ELOOP)) {
                                /*
                                 * Dangling symlink.
                                 * Allow delete as "delete veto files = yes"
@@ -1240,8 +1241,8 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp)
                 * Todo: use SMB_VFS_STATX() once that's available.
                 */
 
-               ret = SMB_VFS_LSTAT(conn, smb_dname_full);
-               if (ret != 0) {
+               retval = SMB_VFS_LSTAT(conn, smb_dname_full);
+               if (retval != 0) {
                        goto err_break;
                }