s3: smbd: In call_trans2qfilepathinfo(), TRANSACT2_QPATHINFO, use helper function...
authorJeremy Allison <jra@samba.org>
Mon, 13 Dec 2021 22:13:59 +0000 (14:13 -0800)
committerJeremy Allison <jra@samba.org>
Wed, 15 Dec 2021 18:36:31 +0000 (18:36 +0000)
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 <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/smbd/trans2.c

index 542db58c48d3ab11fd9eff2bec1f217ec31935c4..fdafe1521b57b03594f7b4aaae6e099df1fd14c9 100644 (file)
@@ -6166,28 +6166,14 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
                        }
                }
 
-               if (INFO_LEVEL_IS_UNIX(info_level) || req->posix_pathnames) {
-                       /* Always do lstat for UNIX calls. */
-                       if (SMB_VFS_LSTAT(conn, smb_fname)) {
-                               DEBUG(3,("call_trans2qfilepathinfo: "
-                                        "SMB_VFS_LSTAT of %s failed (%s)\n",
-                                        smb_fname_str_dbg(smb_fname),
-                                        strerror(errno)));
-                               reply_nterror(req,
-                                       map_nt_error_from_unix(errno));
-                               return;
-                       }
-
-               } else {
-                       if (SMB_VFS_STAT(conn, smb_fname) != 0) {
-                               DEBUG(3,("call_trans2qfilepathinfo: "
-                                        "SMB_VFS_STAT of %s failed (%s)\n",
-                                        smb_fname_str_dbg(smb_fname),
-                                        strerror(errno)));
-                               reply_nterror(req,
-                                       map_nt_error_from_unix(errno));
-                               return;
-                       }
+               ret = vfs_stat(conn, smb_fname);
+               if (ret != 0) {
+                       DBG_NOTICE("vfs_stat of %s failed (%s)\n",
+                               smb_fname_str_dbg(smb_fname),
+                               strerror(errno));
+                       reply_nterror(req,
+                               map_nt_error_from_unix(errno));
+                       return;
                }
 
                status = file_name_hash(conn,