summaryrefslogtreecommitdiff
path: root/source3/smbd/dir.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-03-12 15:39:38 +0100
committerStefan Metzmacher <metze@samba.org>2008-04-07 12:29:26 +0200
commitd03453864ab1bc5fd3b4a3abaf96176a006c102b (patch)
tree13389e06bd05336a1937b98d3e821ad995eef019 /source3/smbd/dir.c
parent2ccf50256e31bd7b9da0f7a7c223bebca5bca062 (diff)
downloadsamba-d03453864ab1bc5fd3b4a3abaf96176a006c102b.tar.gz
samba-d03453864ab1bc5fd3b4a3abaf96176a006c102b.tar.bz2
samba-d03453864ab1bc5fd3b4a3abaf96176a006c102b.zip
smbd: implement the strange write time update logic
We now never call file_ntimes() directly, every update is done via smb_set_file_time(). This let samba3 pass the BASE-DELAYWRITE test. The write time is only updated 2 seconds after the first write() on any open handle to the current time (not the time of the first write). Each handle which had write requests updates the write time to the current time on close(). If the write time is set explicit via setfileinfo or setpathinfo the write time is visible directly and a following close on the same handle doesn't update the write time. metze (This used to be commit 2eab212ea2e1bfd8fa716c2c89b2c042f7ba12ea)
Diffstat (limited to 'source3/smbd/dir.c')
-rw-r--r--source3/smbd/dir.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index ca6f8bfd8d..8531d6250d 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -841,6 +841,8 @@ bool get_dir_entry(TALLOC_CTX *ctx,
mask_match_search(filename,mask,False) ||
mangle_mask_match(conn,filename,mask)) {
char mname[13];
+ struct timespec write_time_ts;
+ struct file_id fileid;
if (!mangle_is_8_3(filename, False, conn->params)) {
if (!name_to_8_3(filename,mname,False,
@@ -883,6 +885,12 @@ bool get_dir_entry(TALLOC_CTX *ctx,
*size = sbuf.st_size;
*date = sbuf.st_mtime;
+ fileid = vfs_file_id_from_sbuf(conn, &sbuf);
+ write_time_ts = get_write_time(fileid);
+ if (!null_timespec(write_time_ts)) {
+ *date = convert_timespec_to_time_t(write_time_ts);
+ }
+
DEBUG(3,("get_dir_entry mask=[%s] found %s "
"fname=%s (%s)\n",
mask,