]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: use openat_pathref_fsp() rename_internals()
authorRalph Boehme <slow@samba.org>
Thu, 12 Nov 2020 14:44:08 +0000 (15:44 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 16 Dec 2020 09:08:31 +0000 (09:08 +0000)
Ensures we have a pathref handle in the smb_fname we pass to
SMB_VFS_CREATE_FILE().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/reply.c

index e945c4ecbe59d380afd08aaa6466644efc0993d9..2dbe3c60b8aa373087e4805eaeb2911c42dc37e3 100644 (file)
@@ -8017,6 +8017,14 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
                        goto out;
                }
 
+               status = openat_pathref_fsp(conn->cwd_fsp, smb_fname_src);
+               if (NT_STATUS_EQUAL(status, NT_STATUS_STOPPED_ON_SYMLINK)) {
+                       status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+               }
+               if (!NT_STATUS_IS_OK(status)) {
+                       goto out;
+               }
+
                if (S_ISDIR(smb_fname_src->st.st_ex_mode)) {
                        create_options |= FILE_DIRECTORY_FILE;
                }
@@ -8181,6 +8189,17 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
                        SMB_VFS_STAT(conn, smb_fname_src);
                }
 
+               status = openat_pathref_fsp(conn->cwd_fsp, smb_fname_src);
+               if (NT_STATUS_EQUAL(status, NT_STATUS_STOPPED_ON_SYMLINK)) {
+                       status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+               }
+               if (!NT_STATUS_IS_OK(status)) {
+                       DBG_INFO("openat_pathref_fsp [%s] failed: %s\n",
+                                smb_fname_str_dbg(smb_fname_src),
+                                nt_errstr(status));
+                       break;
+               }
+
                create_options = 0;
 
                if (S_ISDIR(smb_fname_src->st.st_ex_mode)) {