]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs: restore stat fields in vfs_stat_fsp()
authorRalph Boehme <slow@samba.org>
Mon, 9 Sep 2019 06:08:06 +0000 (08:08 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 10 Sep 2019 20:22:21 +0000 (20:22 +0000)
This ensures we preserve btime, itime and File-ID.

As the Durable Handles code calls vfs_stat_fsp() in the DH disconnect function,
previously the btime was lost and NOT stored in the cookie. With this change the
cookie will store the correct btime (and iflags), which requires us to call
dos_mode() in the reconnect function to ensure we pass
vfs_default_durable_reconnect_check_stat().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Sep 10 20:22:21 UTC 2019 on sn-devel-184

selftest/knownfail.d/samba3.smb2.create [deleted file]
source3/smbd/durable.c
source3/smbd/vfs.c

diff --git a/selftest/knownfail.d/samba3.smb2.create b/selftest/knownfail.d/samba3.smb2.create
deleted file mode 100644 (file)
index 89455da..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.smb2.fileid.fileid\(nt4_dc\)
index db02c229edda901842a6d86ab5b04b4153353e66..a42c201b81b74d42fd6674d801d250e1a77bc3ec 100644 (file)
@@ -841,6 +841,8 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
        }
 
+       (void)dos_mode(fsp->conn, fsp->fsp_name);
+
        ok = vfs_default_durable_reconnect_check_stat(&cookie.stat_info,
                                                      &fsp->fsp_name->st,
                                                      fsp_str_dbg(fsp));
index c08c7302a249b00c04b8a00a5a55a159358d525f..a131b3303d581fb072c5d85d454fae88dc76e3a0 100644 (file)
@@ -1413,6 +1413,7 @@ int vfs_stat_smb_basename(struct connection_struct *conn,
 NTSTATUS vfs_stat_fsp(files_struct *fsp)
 {
        int ret;
+       struct stat_ex saved_stat = fsp->fsp_name->st;
 
        if(fsp->fh->fd == -1) {
                if (fsp->posix_flags & FSP_POSIX_FLAGS_OPEN) {
@@ -1426,6 +1427,7 @@ NTSTATUS vfs_stat_fsp(files_struct *fsp)
        if (ret == -1) {
                return map_nt_error_from_unix(errno);
        }
+       update_stat_ex_from_saved_stat(&fsp->fsp_name->st, &saved_stat);
        return NT_STATUS_OK;
 }