summaryrefslogtreecommitdiff
path: root/source3/smbd/files.c
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2019-12-02 16:30:50 +0100
committerJeremy Allison <jra@samba.org>2019-12-06 00:17:36 +0000
commit69691dd0cd5fac292bfb1c1dc28136ae253bbc76 (patch)
tree89c86e4ee8bd9d7a9e390bdb7c3e87460ba92212 /source3/smbd/files.c
parent6e58cfab98d958c8008c77b0d909a3384de28d7b (diff)
downloadsamba-69691dd0cd5fac292bfb1c1dc28136ae253bbc76.tar.gz
smbd: fix handling of sentinel timestamp values
This implements two core changes: * use NTTIME instead of struct timespec at the database layer * use struct timespec { .tv_nsec = SAMBA_UTIME_OMIT } as special sentinel value in smbd when processing timestamps Using NTTIME at the database layer is only done to avoid storing the special struct timespec sentinel values on disk. Instead, with NTTIME the sentinel value for an "unset" timestamp is just 0 on-disk. The NTTIME value of 0 gets translated by nt_time_to_full_timespec() to the struct timespec sentinel value { .tv_nsec = SAMBA_UTIME_OMIT }. The function is_omit_timespec() can be used to check this. Beside nt_time_to_full_timespec(), there are various other new time conversion functions with *full* in their name that can be used to safely convert between different types with the changed sentinel value. BUG: https://bugzilla.samba.org/show_bug.cgi?id=7771 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd/files.c')
-rw-r--r--source3/smbd/files.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 077610cad75..97947753170 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -65,6 +65,7 @@ NTSTATUS fsp_new(struct connection_struct *conn, TALLOC_CTX *mem_ctx,
fsp->fnum = FNUM_FIELD_INVALID;
fsp->conn = conn;
+ fsp->close_write_time = make_omit_timespec();
DLIST_ADD(sconn->files, fsp);
sconn->num_files += 1;