]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: In call_trans2qfilepathinfo(), TRANSACT2_QFILEINFO case, use helper functio...
authorJeremy Allison <jra@samba.org>
Mon, 13 Dec 2021 22:05:32 +0000 (14:05 -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 eb6a66d553d11fb16be8421088973c2032121b7a..bbaeb1b55cb7590dc1d427d4c3fdbece57001ab6 100644 (file)
@@ -5947,6 +5947,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
        char *lock_data = NULL;
        size_t fixed_portion;
        NTSTATUS status = NT_STATUS_OK;
+       int ret;
 
        if (!params) {
                reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
@@ -6005,24 +6006,11 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
                         * handle (returned from an NT SMB). NT5.0 seems
                         * to do this call. JRA.
                         */
-
-                       if (INFO_LEVEL_IS_UNIX(info_level)) {
-                               /* 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)) {
-                               DEBUG(3,("call_trans2qfilepathinfo: "
-                                        "SMB_VFS_STAT of %s failed (%s)\n",
+                       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)));
+                                        strerror(errno));
                                reply_nterror(req,
                                        map_nt_error_from_unix(errno));
                                return;