From: Jeremy Allison Date: Thu, 4 Nov 2021 02:02:36 +0000 (-0700) Subject: s3: smbd: Ensure in the directory scanning loops inside rmdir_internals() we don... X-Git-Tag: ldb-2.5.0~320 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=141f3f5f9a5ef556cc7864b2afbf8ad48b7ebe77;p=thirdparty%2Fsamba.git s3: smbd: Ensure in the directory scanning loops inside rmdir_internals() we don't overwrite the 'ret' variable. 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 Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Thu Nov 4 09:10:27 UTC 2021 on sn-devel-184 --- diff --git a/selftest/knownfail.d/del_on_close_nonempty b/selftest/knownfail.d/del_on_close_nonempty deleted file mode 100644 index 7109b993f91..00000000000 --- a/selftest/knownfail.d/del_on_close_nonempty +++ /dev/null @@ -1 +0,0 @@ -^samba3.smbtorture_s3.plain.SMB2-DEL-ON-CLOSE-NONEMPTY.smbtorture\(fileserver\) diff --git a/source3/smbd/close.c b/source3/smbd/close.c index ad10215a4fa..e6272376739 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -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; }