smbd: use put_long_date_full_timespec()
authorRalph Boehme <slow@samba.org>
Sat, 30 Nov 2019 20:29:07 +0000 (21:29 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 6 Dec 2019 00:17:36 +0000 (00:17 +0000)
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>
source3/smbd/negprot.c
source3/smbd/nttrans.c
source3/smbd/smb2_close.c
source3/smbd/smb2_create.c
source3/smbd/smb2_query_directory.c
source3/smbd/trans2.c

index e77c8f52261012ac57f541f5222b9f192a5935fc..67ef60da8528b46e88551cd26ea572e40cfb1c6f 100644 (file)
@@ -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) {
index 857581f824fd331a36963ca3c350bba8ea286f81..d169a59a6208fe3f5cc67d152f1ca481bba54840 100644 (file)
@@ -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;
index 93539d4884587bff00872b44b81e564a3e03d600..ae0873e3bbea8b63a307c16992b7184ee0a88567 100644 (file)
@@ -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);
index 6cf3499c411c8dad84afc4aaf996ddcb5a95fe42..1a3af78acf2d4c24af9f736cf6348c7523f58300 100644 (file)
@@ -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,
index 031a2c87d7c8bf1aa59a35dcda5ab1f51db963fd..94d2144ad26c243a915d0f9c890fd754b0f53f08 100644 (file)
@@ -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:
index 080159be32a9b3ef11e59cb98c2d61b9e8fef181..aa3e968c5c710f2376a7944bae7ef5d23ad63783 100644 (file)
@@ -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);