]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: call_trans2setfilepathinfo(), TRANSACT2_SETFILEINFO case, use helper functi...
authorJeremy Allison <jra@samba.org>
Mon, 13 Dec 2021 22:19:35 +0000 (14:19 -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 fdafe1521b57b03594f7b4aaae6e099df1fd14c9..8b97aa64d282ea1bbf04a304e0c6bb171f825723 100644 (file)
@@ -9250,6 +9250,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
        files_struct *fsp = NULL;
        NTSTATUS status = NT_STATUS_OK;
        int data_return_size = 0;
+       int ret;
 
        if (!params) {
                reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
@@ -9288,26 +9289,14 @@ static void call_trans2setfilepathinfo(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_trans2setfilepathinfo: "
-                                                "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_trans2setfilepathinfo: "
-                                                "fileinfo 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;
                        }
                } else if (fsp->print_file) {
                        /*