From 572d4e3a56eef00e29f93482daa21647af7310d0 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Sat, 30 Nov 2019 21:29:07 +0100 Subject: [PATCH] smbd: use put_long_date_full_timespec() BUG: https://bugzilla.samba.org/show_bug.cgi?id=7771 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/smbd/negprot.c | 2 +- source3/smbd/nttrans.c | 16 +++--- source3/smbd/smb2_close.c | 16 +++--- source3/smbd/smb2_create.c | 16 +++--- source3/smbd/smb2_query_directory.c | 8 +-- source3/smbd/trans2.c | 80 ++++++++++++++--------------- 6 files changed, 69 insertions(+), 69 deletions(-) diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c index e77c8f52261..67ef60da852 100644 --- a/source3/smbd/negprot.c +++ b/source3/smbd/negprot.c @@ -371,7 +371,7 @@ static NTSTATUS reply_nt1(struct smb_request *req, uint16_t choice) SIVAL(req->outbuf,smb_vwv7+1, getpid()); /* session key */ SIVAL(req->outbuf,smb_vwv9+1, capabilities); /* capabilities */ clock_gettime(CLOCK_REALTIME,&ts); - put_long_date_timespec(TIMESTAMP_SET_NT_OR_BETTER,(char *)req->outbuf+smb_vwv11+1,ts); + put_long_date_full_timespec(TIMESTAMP_SET_NT_OR_BETTER,(char *)req->outbuf+smb_vwv11+1,&ts); SSVALS(req->outbuf,smb_vwv15+1,set_server_zone_offset(ts.tv_sec)/60); if (!negotiate_spnego) { diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 857581f824f..d169a59a620 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -680,13 +680,13 @@ void reply_ntcreate_and_X(struct smb_request *req) dos_filetime_timespec(&c_timespec); } - put_long_date_timespec(conn->ts_res, p, create_timespec); /* create time. */ + put_long_date_full_timespec(conn->ts_res, p, &create_timespec); /* create time. */ p += 8; - put_long_date_timespec(conn->ts_res, p, a_timespec); /* access time */ + put_long_date_full_timespec(conn->ts_res, p, &a_timespec); /* access time */ p += 8; - put_long_date_timespec(conn->ts_res, p, m_timespec); /* write time */ + put_long_date_full_timespec(conn->ts_res, p, &m_timespec); /* write time */ p += 8; - put_long_date_timespec(conn->ts_res, p, c_timespec); /* change time */ + put_long_date_full_timespec(conn->ts_res, p, &c_timespec); /* change time */ p += 8; SIVAL(p,0,fattr); /* File Attributes. */ p += 4; @@ -1335,13 +1335,13 @@ static void call_nt_transact_create(connection_struct *conn, dos_filetime_timespec(&c_timespec); } - put_long_date_timespec(conn->ts_res, p, create_timespec); /* create time. */ + put_long_date_full_timespec(conn->ts_res, p, &create_timespec); /* create time. */ p += 8; - put_long_date_timespec(conn->ts_res, p, a_timespec); /* access time */ + put_long_date_full_timespec(conn->ts_res, p, &a_timespec); /* access time */ p += 8; - put_long_date_timespec(conn->ts_res, p, m_timespec); /* write time */ + put_long_date_full_timespec(conn->ts_res, p, &m_timespec); /* write time */ p += 8; - put_long_date_timespec(conn->ts_res, p, c_timespec); /* change time */ + put_long_date_full_timespec(conn->ts_res, p, &c_timespec); /* change time */ p += 8; SIVAL(p,0,fattr); /* File Attributes. */ p += 4; diff --git a/source3/smbd/smb2_close.c b/source3/smbd/smb2_close.c index 93539d48845..ae0873e3bbe 100644 --- a/source3/smbd/smb2_close.c +++ b/source3/smbd/smb2_close.c @@ -132,14 +132,14 @@ static void smbd_smb2_request_close_done(struct tevent_req *subreq) SSVAL(outbody.data, 0x00, 0x3C); /* struct size */ SSVAL(outbody.data, 0x02, out_flags); SIVAL(outbody.data, 0x04, 0); /* reserved */ - put_long_date_timespec(conn->ts_res, - (char *)outbody.data + 0x08, out_creation_ts); - put_long_date_timespec(conn->ts_res, - (char *)outbody.data + 0x10, out_last_access_ts); - put_long_date_timespec(conn->ts_res, - (char *)outbody.data + 0x18, out_last_write_ts); - put_long_date_timespec(conn->ts_res, - (char *)outbody.data + 0x20, out_change_ts); + put_long_date_full_timespec(conn->ts_res, + (char *)outbody.data + 0x08, &out_creation_ts); + put_long_date_full_timespec(conn->ts_res, + (char *)outbody.data + 0x10, &out_last_access_ts); + put_long_date_full_timespec(conn->ts_res, + (char *)outbody.data + 0x18, &out_last_write_ts); + put_long_date_full_timespec(conn->ts_res, + (char *)outbody.data + 0x20, &out_change_ts); SBVAL(outbody.data, 0x28, out_allocation_size); SBVAL(outbody.data, 0x30, out_end_of_file); SIVAL(outbody.data, 0x38, out_file_attributes); diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c index 6cf3499c411..1a3af78acf2 100644 --- a/source3/smbd/smb2_create.c +++ b/source3/smbd/smb2_create.c @@ -372,18 +372,18 @@ static void smbd_smb2_request_create_done(struct tevent_req *tsubreq) SCVAL(outbody.data, 0x03, 0); /* reserved */ SIVAL(outbody.data, 0x04, out_create_action); /* create action */ - put_long_date_timespec(conn->ts_res, + put_long_date_full_timespec(conn->ts_res, (char *)outbody.data + 0x08, - out_creation_ts); /* creation time */ - put_long_date_timespec(conn->ts_res, + &out_creation_ts); /* creation time */ + put_long_date_full_timespec(conn->ts_res, (char *)outbody.data + 0x10, - out_last_access_ts); /* last access time */ - put_long_date_timespec(conn->ts_res, + &out_last_access_ts); /* last access time */ + put_long_date_full_timespec(conn->ts_res, (char *)outbody.data + 0x18, - out_last_write_ts); /* last write time */ - put_long_date_timespec(conn->ts_res, + &out_last_write_ts); /* last write time */ + put_long_date_full_timespec(conn->ts_res, (char *)outbody.data + 0x20, - out_change_ts); /* change time */ + &out_change_ts); /* change time */ SBVAL(outbody.data, 0x28, out_allocation_size); /* allocation size */ SBVAL(outbody.data, 0x30, diff --git a/source3/smbd/smb2_query_directory.c b/source3/smbd/smb2_query_directory.c index 031a2c87d7c..94d2144ad26 100644 --- a/source3/smbd/smb2_query_directory.c +++ b/source3/smbd/smb2_query_directory.c @@ -950,9 +950,9 @@ static void fetch_write_time_done(struct tevent_req *subreq) return; } - put_long_date_timespec(state->conn->ts_res, + put_long_date_full_timespec(state->conn->ts_res, state->entry_marshall_buf + off, - write_time); + &write_time); tevent_req_done(req); return; @@ -1076,9 +1076,9 @@ static void fetch_dos_mode_done(struct tevent_req *subreq) dos_filetime_timespec(&btime_ts); } - put_long_date_timespec(state->dir_fsp->conn->ts_res, + put_long_date_full_timespec(state->dir_fsp->conn->ts_res, (char *)state->entry_marshall_buf + btime_off, - btime_ts); + &btime_ts); switch (state->info_level) { case SMB_FIND_ID_BOTH_DIRECTORY_INFO: diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 080159be32a..aa3e968c5c7 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2058,10 +2058,10 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, was_8_3 = mangle_is_8_3(fname, True, conn->params); p += 4; SIVAL(p,0,reskey); p += 4; - put_long_date_timespec(conn->ts_res,p,create_date_ts); p += 8; - put_long_date_timespec(conn->ts_res,p,adate_ts); p += 8; - put_long_date_timespec(conn->ts_res,p,mdate_ts); p += 8; - put_long_date_timespec(conn->ts_res,p,cdate_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&create_date_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&adate_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&mdate_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&cdate_ts); p += 8; SOFF_T(p,0,file_size); p += 8; SOFF_T(p,0,allocation_size); p += 8; SIVAL(p,0,mode); p += 4; @@ -2132,10 +2132,10 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, DEBUG(10,("smbd_marshall_dir_entry: SMB_FIND_FILE_DIRECTORY_INFO\n")); p += 4; SIVAL(p,0,reskey); p += 4; - put_long_date_timespec(conn->ts_res,p,create_date_ts); p += 8; - put_long_date_timespec(conn->ts_res,p,adate_ts); p += 8; - put_long_date_timespec(conn->ts_res,p,mdate_ts); p += 8; - put_long_date_timespec(conn->ts_res,p,cdate_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&create_date_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&adate_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&mdate_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&cdate_ts); p += 8; SOFF_T(p,0,file_size); p += 8; SOFF_T(p,0,allocation_size); p += 8; SIVAL(p,0,mode); p += 4; @@ -2171,10 +2171,10 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, DEBUG(10,("smbd_marshall_dir_entry: SMB_FIND_FILE_FULL_DIRECTORY_INFO\n")); p += 4; SIVAL(p,0,reskey); p += 4; - put_long_date_timespec(conn->ts_res,p,create_date_ts); p += 8; - put_long_date_timespec(conn->ts_res,p,adate_ts); p += 8; - put_long_date_timespec(conn->ts_res,p,mdate_ts); p += 8; - put_long_date_timespec(conn->ts_res,p,cdate_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&create_date_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&adate_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&mdate_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&cdate_ts); p += 8; SOFF_T(p,0,file_size); p += 8; SOFF_T(p,0,allocation_size); p += 8; SIVAL(p,0,mode); p += 4; @@ -2254,10 +2254,10 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, DEBUG(10,("smbd_marshall_dir_entry: SMB_FIND_ID_FULL_DIRECTORY_INFO\n")); p += 4; SIVAL(p,0,reskey); p += 4; - put_long_date_timespec(conn->ts_res,p,create_date_ts); p += 8; - put_long_date_timespec(conn->ts_res,p,adate_ts); p += 8; - put_long_date_timespec(conn->ts_res,p,mdate_ts); p += 8; - put_long_date_timespec(conn->ts_res,p,cdate_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&create_date_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&adate_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&mdate_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&cdate_ts); p += 8; SOFF_T(p,0,file_size); p += 8; SOFF_T(p,0,allocation_size); p += 8; SIVAL(p,0,mode); p += 4; @@ -2305,10 +2305,10 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, was_8_3 = mangle_is_8_3(fname, True, conn->params); p += 4; SIVAL(p,0,reskey); p += 4; - put_long_date_timespec(conn->ts_res,p,create_date_ts); p += 8; - put_long_date_timespec(conn->ts_res,p,adate_ts); p += 8; - put_long_date_timespec(conn->ts_res,p,mdate_ts); p += 8; - put_long_date_timespec(conn->ts_res,p,cdate_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&create_date_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&adate_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&mdate_ts); p += 8; + put_long_date_full_timespec(conn->ts_res,p,&cdate_ts); p += 8; SOFF_T(p,0,file_size); p += 8; SOFF_T(p,0,allocation_size); p += 8; SIVAL(p,0,mode); p += 4; @@ -4685,9 +4685,9 @@ static char *store_file_unix_basic(connection_struct *conn, SOFF_T(pdata,0,SMB_VFS_GET_ALLOC_SIZE(conn,fsp,psbuf)); /* Number of bytes used on disk - 64 Bit */ pdata += 8; - put_long_date_timespec(TIMESTAMP_SET_NT_OR_BETTER, pdata, psbuf->st_ex_ctime); /* Change Time 64 Bit */ - put_long_date_timespec(TIMESTAMP_SET_NT_OR_BETTER ,pdata+8, psbuf->st_ex_atime); /* Last access time 64 Bit */ - put_long_date_timespec(TIMESTAMP_SET_NT_OR_BETTER, pdata+16, psbuf->st_ex_mtime); /* Last modification time 64 Bit */ + put_long_date_full_timespec(TIMESTAMP_SET_NT_OR_BETTER, pdata, &psbuf->st_ex_ctime); /* Change Time 64 Bit */ + put_long_date_full_timespec(TIMESTAMP_SET_NT_OR_BETTER ,pdata+8, &psbuf->st_ex_atime); /* Last access time 64 Bit */ + put_long_date_full_timespec(TIMESTAMP_SET_NT_OR_BETTER, pdata+16, &psbuf->st_ex_mtime); /* Last modification time 64 Bit */ pdata += 24; SIVAL(pdata,0,psbuf->st_ex_uid); /* user id for the owner */ @@ -4827,7 +4827,7 @@ static char *store_file_unix_basic_info2(connection_struct *conn, pdata = store_file_unix_basic(conn, pdata, fsp, psbuf); /* Create (birth) time 64 bit */ - put_long_date_timespec(TIMESTAMP_SET_NT_OR_BETTER,pdata, psbuf->st_ex_btime); + put_long_date_full_timespec(TIMESTAMP_SET_NT_OR_BETTER,pdata, &psbuf->st_ex_btime); pdata += 8; map_info2_flags_from_sbuf(psbuf, &file_flags, &flags_mask); @@ -5442,10 +5442,10 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn, data_size = 40; SIVAL(pdata,36,0); } - put_long_date_timespec(conn->ts_res,pdata,create_time_ts); - put_long_date_timespec(conn->ts_res,pdata+8,atime_ts); - put_long_date_timespec(conn->ts_res,pdata+16,mtime_ts); /* write time */ - put_long_date_timespec(conn->ts_res,pdata+24,ctime_ts); /* change time */ + put_long_date_full_timespec(conn->ts_res,pdata,&create_time_ts); + put_long_date_full_timespec(conn->ts_res,pdata+8,&atime_ts); + put_long_date_full_timespec(conn->ts_res,pdata+16,&mtime_ts); /* write time */ + put_long_date_full_timespec(conn->ts_res,pdata+24,&ctime_ts); /* change time */ SIVAL(pdata,32,mode); DEBUG(5,("SMB_QFBI - ")); @@ -5601,10 +5601,10 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn, unsigned int ea_size = estimate_ea_size(conn, fsp, smb_fname); DEBUG(10,("smbd_do_qfilepathinfo: SMB_FILE_ALL_INFORMATION\n")); - put_long_date_timespec(conn->ts_res,pdata,create_time_ts); - put_long_date_timespec(conn->ts_res,pdata+8,atime_ts); - put_long_date_timespec(conn->ts_res,pdata+16,mtime_ts); /* write time */ - put_long_date_timespec(conn->ts_res,pdata+24,ctime_ts); /* change time */ + put_long_date_full_timespec(conn->ts_res,pdata,&create_time_ts); + put_long_date_full_timespec(conn->ts_res,pdata+8,&atime_ts); + put_long_date_full_timespec(conn->ts_res,pdata+16,&mtime_ts); /* write time */ + put_long_date_full_timespec(conn->ts_res,pdata+24,&ctime_ts); /* change time */ SIVAL(pdata,32,mode); SIVAL(pdata,36,0); /* padding. */ pdata += 40; @@ -5636,10 +5636,10 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn, unsigned int ea_size = estimate_ea_size(conn, fsp, smb_fname); DEBUG(10,("smbd_do_qfilepathinfo: SMB2_FILE_ALL_INFORMATION\n")); - put_long_date_timespec(conn->ts_res,pdata+0x00,create_time_ts); - put_long_date_timespec(conn->ts_res,pdata+0x08,atime_ts); - put_long_date_timespec(conn->ts_res,pdata+0x10,mtime_ts); /* write time */ - put_long_date_timespec(conn->ts_res,pdata+0x18,ctime_ts); /* change time */ + put_long_date_full_timespec(conn->ts_res,pdata+0x00,&create_time_ts); + put_long_date_full_timespec(conn->ts_res,pdata+0x08,&atime_ts); + put_long_date_full_timespec(conn->ts_res,pdata+0x10,&mtime_ts); /* write time */ + put_long_date_full_timespec(conn->ts_res,pdata+0x18,&ctime_ts); /* change time */ SIVAL(pdata, 0x20, mode); SIVAL(pdata, 0x24, 0); /* padding. */ SBVAL(pdata, 0x28, allocation_size); @@ -5786,10 +5786,10 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn, case SMB_FILE_NETWORK_OPEN_INFORMATION: DEBUG(10,("smbd_do_qfilepathinfo: SMB_FILE_NETWORK_OPEN_INFORMATION\n")); - put_long_date_timespec(conn->ts_res,pdata,create_time_ts); - put_long_date_timespec(conn->ts_res,pdata+8,atime_ts); - put_long_date_timespec(conn->ts_res,pdata+16,mtime_ts); /* write time */ - put_long_date_timespec(conn->ts_res,pdata+24,ctime_ts); /* change time */ + put_long_date_full_timespec(conn->ts_res,pdata,&create_time_ts); + put_long_date_full_timespec(conn->ts_res,pdata+8,&atime_ts); + put_long_date_full_timespec(conn->ts_res,pdata+16,&mtime_ts); /* write time */ + put_long_date_full_timespec(conn->ts_res,pdata+24,&ctime_ts); /* change time */ SOFF_T(pdata,32,allocation_size); SOFF_T(pdata,40,file_size); SIVAL(pdata,48,mode); -- 2.34.1