From: Jeremy Allison Date: Fri, 21 May 2021 17:53:49 +0000 (-0700) Subject: s3: smbd: Allow SMB1+UNIX extensions rename of dangling symlink. X-Git-Tag: tevent-0.11.0~769 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1d781bbff84667b3ada4afc06c1d15829754dcb4;p=thirdparty%2Fsamba.git s3: smbd: Allow SMB1+UNIX extensions rename of dangling symlink. Remove knownfail. Only in master, so no bug number needed. Signed-off-by: Jeremy Allison Reviewed-by: Noel Power Autobuild-User(master): Noel Power Autobuild-Date(master): Mon May 24 17:47:40 UTC 2021 on sn-devel-184 --- diff --git a/selftest/knownfail.d/posix_symlink_rename b/selftest/knownfail.d/posix_symlink_rename deleted file mode 100644 index b0889e7412a..00000000000 --- a/selftest/knownfail.d/posix_symlink_rename +++ /dev/null @@ -1,2 +0,0 @@ -^samba3.smbtorture_s3.plain.POSIX-SYMLINK-RENAME.smbtorture\(nt4_dc_smb1\) -^samba3.smbtorture_s3.crypt.POSIX-SYMLINK-RENAME.smbtorture\(nt4_dc_smb1\) diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 27e9b5f904f..1b670020143 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -8044,7 +8044,19 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx, status = openat_pathref_fsp(conn->cwd_fsp, smb_fname_src); if (!NT_STATUS_IS_OK(status)) { - goto out; + if (!NT_STATUS_EQUAL(status, + NT_STATUS_OBJECT_NAME_NOT_FOUND)) { + goto out; + } + /* + * Possible symlink src. + */ + if (!(smb_fname_src->flags & SMB_FILENAME_POSIX_PATH)) { + goto out; + } + if (!S_ISLNK(smb_fname_src->st.st_ex_mode)) { + goto out; + } } if (S_ISDIR(smb_fname_src->st.st_ex_mode)) {