smbd: fix handling of sentinel timestamp values
authorRalph Boehme <slow@samba.org>
Mon, 2 Dec 2019 15:30:50 +0000 (16:30 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 6 Dec 2019 00:17:36 +0000 (00:17 +0000)
commit69691dd0cd5fac292bfb1c1dc28136ae253bbc76
tree89c86e4ee8bd9d7a9e390bdb7c3e87460ba92212
parent6e58cfab98d958c8008c77b0d909a3384de28d7b
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>
23 files changed:
selftest/knownfail.d/samba3.smb2 [deleted file]
source3/include/vfs.h
source3/librpc/idl/open_files.idl
source3/locking/locking.c
source3/locking/share_mode_lock.c
source3/modules/vfs_ceph.c
source3/modules/vfs_default.c
source3/modules/vfs_fruit.c
source3/modules/vfs_glusterfs.c
source3/modules/vfs_gpfs.c
source3/modules/vfs_recycle.c
source3/smbd/close.c
source3/smbd/dir.c
source3/smbd/dosmode.c
source3/smbd/durable.c
source3/smbd/fileio.c
source3/smbd/files.c
source3/smbd/open.c
source3/smbd/reply.c
source3/smbd/smb2_create.c
source3/smbd/smb2_query_directory.c
source3/smbd/trans2.c
source3/torture/cmd_vfs.c