1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +03:00

smbd: use openat_pathref_fsp() rename_internals()

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>
This commit is contained in:
Ralph Boehme 2020-11-12 15:44:08 +01:00
parent 36b03af0ea
commit 492ca5819a

View 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)) {