]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Slightly simplify smbd_do_qfilepathinfo()
authorVolker Lendecke <vl@samba.org>
Sat, 13 Sep 2025 10:20:34 +0000 (12:20 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 21 Oct 2025 17:33:29 +0000 (17:33 +0000)
Use metadata_fsp() instead of explicitly checking fsp->base_fsp

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/smb2_trans2.c

index 9f60fa3e05bd34d1e8a1551ea927cacb5a78e02b..8d52e31c4f5573fe0950a995803b1417c9db71e6 100644 (file)
@@ -2975,7 +2975,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
        unsigned int data_size;
        struct timespec create_time_ts, mtime_ts, atime_ts, ctime_ts;
        SMB_STRUCT_STAT *psbuf = NULL;
-       SMB_STRUCT_STAT *base_sp = NULL;
+       struct files_struct *base_fsp = NULL;
        char *p;
        char *base_name;
        char *dos_fname;
@@ -3018,9 +3018,6 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
        mode = fdos_mode(fsp);
        psbuf = &smb_fname->st;
 
-       base_sp = (fsp->base_fsp != NULL) ? &fsp->base_fsp->fsp_name->st
-                                         : &fsp->fsp_name->st;
-
        nlink = psbuf->st_ex_nlink;
 
        if (nlink && (mode&FILE_ATTRIBUTE_DIRECTORY)) {
@@ -3120,7 +3117,8 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
 
           I think this causes us to fail the IFSKIT
           BasicFileInformationTest. -tpot */
-       file_id = SMB_VFS_FS_FILE_ID(conn, base_sp);
+       base_fsp = metadata_fsp(fsp);
+       file_id = SMB_VFS_FS_FILE_ID(conn, &base_fsp->fsp_name->st);
 
        *fixed_portion = 0;