smbd - allow updates on directory write times on open handles.
authorJeremy Allison <jra@samba.org>
Wed, 4 Dec 2013 01:22:19 +0000 (17:22 -0800)
committerKarolin Seeger <kseeger@samba.org>
Tue, 10 Dec 2013 17:20:48 +0000 (18:20 +0100)
If we set a non-null 'old timestamp' in the share mode database
when creating a directory handle, this prevents mtime (write time)
updates from being seen by clients, as we will always return the
timestamp stored in the database whilst the handle is open.

For files this is ok, as we update the stored timestamp
ourselves when we write to the handle. For directories
we should just rely on the mtime value from the underlying
filesystem.

Torture test to follow.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/open.c

index 02827224bb672b74bc281c1c68486ec6cc835393..a41d3d534fe86c443f8bedfe398fb065e1f18f90 100644 (file)
@@ -3154,7 +3154,14 @@ static NTSTATUS open_directory(connection_struct *conn,
                return status;
        }
 
-       mtimespec = smb_dname->st.st_ex_mtime;
+       /* Don't store old timestamps for directory
+          handles in the internal database. We don't
+          update them in there if new objects
+          are creaded in the directory. Currently
+          we only update timestamps on file writes.
+          See bug #9870.
+       */
+       ZERO_STRUCT(mtimespec);
 
 #ifdef O_DIRECTORY
        status = fd_open(conn, fsp, O_RDONLY|O_DIRECTORY, 0);