]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: In call_trans2qfilepathinfo(), TRANSACT2_QPATHINFO on a named stream case...
authorJeremy Allison <jra@samba.org>
Mon, 13 Dec 2021 22:09:33 +0000 (14:09 -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 bbaeb1b55cb7590dc1d427d4c3fdbece57001ab6..542db58c48d3ab11fd9eff2bec1f217ec31935c4 100644 (file)
@@ -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,