]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Alternative fix for smb2.stream.attributes2 test
authorVolker Lendecke <vl@samba.org>
Fri, 10 Nov 2023 07:39:15 +0000 (08:39 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 13 Nov 2023 23:08:30 +0000 (23:08 +0000)
It confused me that a function that supposedly just retrieves dos
attributes also updates something.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/dosmode.c
source3/smbd/vfs.c

index c0fc468cdfb61c7bc0425191c7c008e5656a17c8..5b695a1d6e303aeed91943c01c63bb4515d53362 100644 (file)
@@ -1292,6 +1292,10 @@ struct timespec get_create_timespec(connection_struct *conn,
                                struct files_struct *fsp,
                                const struct smb_filename *smb_fname)
 {
+       if (fsp != NULL) {
+               struct files_struct *meta_fsp = metadata_fsp(fsp);
+               return meta_fsp->fsp_name->st.st_ex_btime;
+       }
        return smb_fname->st.st_ex_btime;
 }
 
index a34b908335284ecc3feeea79523715a3e3c94373..3f984036ba31185f6f7127d6ee409194f77e68b3 100644 (file)
@@ -1303,37 +1303,11 @@ NTSTATUS vfs_fget_dos_attributes(struct files_struct *fsp,
        NTSTATUS status;
 
        /*
-        * First make sure to pass the base_fsp to the VFS
+        * Make sure to pass the base_fsp to the VFS
         */
        status = SMB_VFS_FGET_DOS_ATTRIBUTES(
                fsp->conn, metadata_fsp(fsp), dosmode);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-
-       /*
-        * If this isn't a stream fsp we're done, ...
-        */
-       if (!fsp_is_alternate_stream(fsp)) {
-               return NT_STATUS_OK;
-       }
-
-       /*
-        * ...otherwise the VFS might have updated the btime, propagate the
-        * btime from the base_fsp to the stream fsp.
-        */
-
-       if (fsp->base_fsp->fsp_name->st.st_ex_iflags & ST_EX_IFLAG_CALCULATED_BTIME) {
-               /*
-                * Not a value from backend storage, ignore it
-                */
-               return NT_STATUS_OK;
-       }
-
-       update_stat_ex_create_time(&fsp->fsp_name->st,
-                                  fsp->base_fsp->fsp_name->st.st_ex_btime);
-
-       return NT_STATUS_OK;
+       return status;
 }
 
 static struct smb_vfs_deny_state *smb_vfs_deny_global;