summaryrefslogtreecommitdiffstats
path: root/source3/smbd/nttrans.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-07-04 01:01:02 +0000
committerJeremy Allison <jra@samba.org>2001-07-04 01:01:02 +0000
commit17a0a89c797c02b34a7584c67643a8ceb2fd6660 (patch)
treeda36a82a9d370c61d12e60f3d3a106e4337071c1 /source3/smbd/nttrans.c
parent4a6ef39261a91e03f9bb6a18dcbfce0742d98702 (diff)
downloadsamba-17a0a89c797c02b34a7584c67643a8ceb2fd6660.tar.gz
samba-17a0a89c797c02b34a7584c67643a8ceb2fd6660.tar.xz
samba-17a0a89c797c02b34a7584c67643a8ceb2fd6660.zip
Ensure we correctly round down to 2 second boundary if dos filetime
set for a share. Jeremy. (This used to be commit 8f57233c0f871763bc3657d754c894dbd29ae501)
Diffstat (limited to 'source3/smbd/nttrans.c')
-rw-r--r--source3/smbd/nttrans.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index d58bb106af8..f2b6ba7a803 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -635,6 +635,7 @@ int reply_ntcreate_and_X(connection_struct *conn,
files_struct *fsp=NULL;
char *p = NULL;
BOOL stat_open_only = False;
+ time_t c_time;
START_PROFILE(SMBntcreateX);
/* If it's an IPC, use the pipe handler. */
@@ -913,7 +914,16 @@ int reply_ntcreate_and_X(connection_struct *conn,
p += 4;
/* Create time. */
- put_long_date(p,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn))));
+ c_time = get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn)));
+
+ if (lp_dos_filetime_resolution(SNUM(conn))) {
+ c_time &= ~1;
+ sbuf.st_atime &= ~1;
+ sbuf.st_mtime &= ~1;
+ sbuf.st_mtime &= ~1;
+ }
+
+ put_long_date(p,c_time);
p += 8;
put_long_date(p,sbuf.st_atime); /* access time */
p += 8;
@@ -1115,6 +1125,7 @@ static int call_nt_transact_create(connection_struct *conn,
int smb_attr;
int error_class;
uint32 error_code;
+ time_t c_time;
DEBUG(5,("call_nt_transact_create\n"));
@@ -1385,7 +1396,16 @@ static int call_nt_transact_create(connection_struct *conn,
p += 8;
/* Create time. */
- put_long_date(p,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn))));
+ c_time = get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn)));
+
+ if (lp_dos_filetime_resolution(SNUM(conn))) {
+ c_time &= ~1;
+ sbuf.st_atime &= ~1;
+ sbuf.st_mtime &= ~1;
+ sbuf.st_mtime &= ~1;
+ }
+
+ put_long_date(p,c_time);
p += 8;
put_long_date(p,sbuf.st_atime); /* access time */
p += 8;