From: Ralph Boehme Date: Fri, 16 Oct 2020 12:35:10 +0000 (+0200) Subject: smbd: add vfs_stat() X-Git-Tag: samba-4.14.0rc1~325 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9d075d8072210a9806141021c7758575a411ffcf;p=thirdparty%2Fsamba.git smbd: add vfs_stat() Deals with POSIX paths and either calls lstat() for POSIX or stat(). Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 1924762b8ba..6192e22fda6 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -1298,6 +1298,8 @@ NTSTATUS check_reduced_name(connection_struct *conn, NTSTATUS check_reduced_name_with_privilege(connection_struct *conn, const struct smb_filename *smb_fname, struct smb_request *smbreq); +int vfs_stat(struct connection_struct *conn, + struct smb_filename *smb_fname); int vfs_stat_smb_basename(struct connection_struct *conn, const struct smb_filename *smb_fname_in, SMB_STRUCT_STAT *psbuf); diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 3e30805b690..45e1b9989bc 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -1492,6 +1492,18 @@ NTSTATUS check_reduced_name(connection_struct *conn, return NT_STATUS_OK; } +/* + * Ensure LSTAT is called for POSIX paths. + */ +int vfs_stat(struct connection_struct *conn, + struct smb_filename *smb_fname) +{ + if (smb_fname->flags & SMB_FILENAME_POSIX_PATH) { + return SMB_VFS_LSTAT(conn, smb_fname); + } + return SMB_VFS_STAT(conn, smb_fname); +} + /** * XXX: This is temporary and there should be no callers of this once * smb_filename is plumbed through all path based operations.