summaryrefslogtreecommitdiff
path: root/source3/torture/cmd_vfs.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/torture/cmd_vfs.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/torture/cmd_vfs.c')
-rw-r--r--source3/torture/cmd_vfs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c
index fb9615e26a3..81068fb84a0 100644
--- a/source3/torture/cmd_vfs.c
+++ b/source3/torture/cmd_vfs.c
@@ -1003,10 +1003,10 @@ static NTSTATUS cmd_utime(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
return NT_STATUS_OK;
}
- ZERO_STRUCT(ft);
+ init_smb_file_time(&ft);
- ft.atime = convert_time_t_to_timespec(atoi(argv[2]));
- ft.mtime = convert_time_t_to_timespec(atoi(argv[3]));
+ ft.atime = time_t_to_full_timespec(atoi(argv[2]));
+ ft.mtime = time_t_to_full_timespec(atoi(argv[3]));
smb_fname = synthetic_smb_fname_split(mem_ctx,
argv[1],