summaryrefslogtreecommitdiffstats
path: root/source3
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
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')
-rw-r--r--source3/smbd/nttrans.c24
-rw-r--r--source3/smbd/trans2.c31
2 files changed, 46 insertions, 9 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;
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index f88ddb41aae..f94b24f595b 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -433,6 +433,13 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
mdate = sbuf.st_mtime;
adate = sbuf.st_atime;
cdate = get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn)));
+
+ if (lp_dos_filetime_resolution(SNUM(conn))) {
+ cdate &= ~1;
+ mdate &= ~1;
+ adate &= ~1;
+ }
+
if(mode & aDIR)
size = 0;
@@ -1311,6 +1318,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
BOOL bad_path = False;
BOOL delete_pending = False;
int len;
+ time_t c_time;
if (tran_call == TRANSACT2_QFILEINFO) {
files_struct *fsp = file_fsp(params,0);
@@ -1415,12 +1423,21 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
memset((char *)pdata,'\0',data_size);
+ 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;
+ }
+
switch (info_level)
{
case SMB_INFO_STANDARD:
case SMB_INFO_QUERY_EA_SIZE:
data_size = (info_level==1?22:26);
- put_dos_date2(pdata,l1_fdateCreation,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn))));
+ put_dos_date2(pdata,l1_fdateCreation,c_time);
put_dos_date2(pdata,l1_fdateLastAccess,sbuf.st_atime);
put_dos_date2(pdata,l1_fdateLastWrite,sbuf.st_mtime); /* write time */
SIVAL(pdata,l1_cbFile,(uint32)size);
@@ -1431,7 +1448,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
case SMB_INFO_QUERY_EAS_FROM_LIST:
data_size = 24;
- put_dos_date2(pdata,0,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn))));
+ put_dos_date2(pdata,0,c_time);
put_dos_date2(pdata,4,sbuf.st_atime);
put_dos_date2(pdata,8,sbuf.st_mtime);
SIVAL(pdata,12,(uint32)size);
@@ -1456,7 +1473,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
data_size = 40;
SIVAL(pdata,36,0);
}
- put_long_date(pdata,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn))));
+ put_long_date(pdata,c_time);
put_long_date(pdata+8,sbuf.st_atime);
put_long_date(pdata+16,sbuf.st_mtime); /* write time */
put_long_date(pdata+24,sbuf.st_mtime); /* change time */
@@ -1464,7 +1481,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
DEBUG(5,("SMB_QFBI - "));
{
- time_t create_time = get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn)));
+ time_t create_time = c_time;
DEBUG(5,("create: %s ", ctime(&create_time)));
}
DEBUG(5,("access: %s ", ctime(&sbuf.st_atime)));
@@ -1529,7 +1546,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
break;
case SMB_QUERY_FILE_ALL_INFO:
- put_long_date(pdata,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn))));
+ put_long_date(pdata,c_time);
put_long_date(pdata+8,sbuf.st_atime);
put_long_date(pdata+16,sbuf.st_mtime); /* write time */
put_long_date(pdata+24,sbuf.st_mtime); /* change time */
@@ -1629,7 +1646,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
pstring new_fname;
size_t byte_len;
- put_long_date(pdata,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn))));
+ put_long_date(pdata,c_time);
put_long_date(pdata+8,sbuf.st_atime);
put_long_date(pdata+16,sbuf.st_mtime); /* write time */
put_long_date(pdata+24,sbuf.st_mtime); /* change time */
@@ -1676,7 +1693,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
break;
case 1034:
- put_long_date(pdata,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn))));
+ put_long_date(pdata,c_time);
put_long_date(pdata+8,sbuf.st_atime);
put_long_date(pdata+16,sbuf.st_mtime); /* write time */
put_long_date(pdata+24,sbuf.st_mtime); /* change time */