From: Ralph Boehme Date: Thu, 12 Nov 2020 11:51:04 +0000 (+0100) Subject: smbd: use openat_pathref_fsp() in get_file_handle_for_metadata() X-Git-Tag: samba-4.14.0rc1~349 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e5adfe64fc116defaba0aea376f81a31b70e1e4d;p=thirdparty%2Fsamba.git smbd: use openat_pathref_fsp() in get_file_handle_for_metadata() Ensures we have a pathref handle in the smb_fname we pass to SMB_VFS_CREATE_FILE(). As the create_disposition is FILE_OPEN we just return the error if openat_pathref_fsp() fails Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index b2cb83d9a94..9fc5f6ece6c 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -1392,6 +1392,15 @@ static NTSTATUS get_file_handle_for_metadata(connection_struct *conn, return NT_STATUS_NO_MEMORY; } + status = openat_pathref_fsp(conn->cwd_fsp, smb_fname_cp); + if (NT_STATUS_EQUAL(status, NT_STATUS_STOPPED_ON_SYMLINK)) { + status = NT_STATUS_OBJECT_NAME_NOT_FOUND; + } + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(smb_fname_cp); + return status; + } + /* Opens an INTERNAL_OPEN_ONLY write handle. */ status = SMB_VFS_CREATE_FILE( conn, /* conn */