From: Jeremy Allison Date: Mon, 13 Dec 2021 22:09:33 +0000 (-0800) Subject: s3: smbd: In call_trans2qfilepathinfo(), TRANSACT2_QPATHINFO on a named stream case... X-Git-Tag: tdb-1.4.6~274 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80e3f4e5ca66cff1d078a8020c7de918824bb75a;p=thirdparty%2Fsamba.git s3: smbd: In call_trans2qfilepathinfo(), TRANSACT2_QPATHINFO on a named stream case, use helper function vfs_stat(). This isn't a change in behavior, even though the old comment says: "Always do lstat for UNIX calls". A previous commit enforces POSIX pathname negotiation before allowing UNIX info levels to be processed here, so we can guarantee that SMB_FILENAME_POSIX_PATH is set on smb_fname if we're allowing a UNIX info level. Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index bbaeb1b55cb..542db58c48d 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -6135,31 +6135,16 @@ static void call_trans2qfilepathinfo(connection_struct *conn, return; } - if (INFO_LEVEL_IS_UNIX(info_level) || req->posix_pathnames) { - /* Always do lstat for UNIX calls. */ - if (SMB_VFS_LSTAT(conn, smb_fname_base) != 0) { - DEBUG(3,("call_trans2qfilepathinfo: " - "SMB_VFS_LSTAT of %s failed " - "(%s)\n", - smb_fname_str_dbg(smb_fname_base), - strerror(errno))); - TALLOC_FREE(smb_fname_base); - reply_nterror(req, - map_nt_error_from_unix(errno)); - return; - } - } else { - if (SMB_VFS_STAT(conn, smb_fname_base) != 0) { - DEBUG(3,("call_trans2qfilepathinfo: " - "fileinfo of %s failed " - "(%s)\n", - smb_fname_str_dbg(smb_fname_base), - strerror(errno))); - TALLOC_FREE(smb_fname_base); - reply_nterror(req, - map_nt_error_from_unix(errno)); - return; - } + ret = vfs_stat(conn, smb_fname_base); + if (ret != 0) { + DBG_NOTICE("vfs_stat of %s failed " + "(%s)\n", + smb_fname_str_dbg(smb_fname_base), + strerror(errno)); + TALLOC_FREE(smb_fname_base); + reply_nterror(req, + map_nt_error_from_unix(errno)); + return; } status = file_name_hash(conn,