smbd: Use srv_put_dos_date2_ts() in reply_printqueue()
authorVolker Lendecke <vl@samba.org>
Sun, 26 Nov 2023 15:17:07 +0000 (16:17 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 19 Dec 2023 16:05:36 +0000 (16:05 +0000)
srv_put_dos_date2_ts() uses convert_timespec_to_time_t() on the passed
timespec, which for ts_nsec==0 returns just tv_sec.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source3/smbd/smb1_reply.c

index 967eddfc56231e4bb9a710dfce5d23879c1547e5..ed5bbdd96398bb44b65cd23154834894374baa9d 100644 (file)
@@ -6022,7 +6022,10 @@ void reply_printqueue(struct smb_request *req)
                for (i = first; i < num_to_get; i++) {
                        char blob[28];
                        char *p = blob;
-                       time_t qtime = spoolss_Time_to_time_t(&info[i].info2.submitted);
+                       struct timespec qtime = {
+                               .tv_sec = spoolss_Time_to_time_t(
+                                       &info[i].info2.submitted),
+                       };
                        int qstatus;
                        size_t len = 0;
                        uint16_t qrapjobid = pjobid_to_rap(sharename,
@@ -6034,7 +6037,7 @@ void reply_printqueue(struct smb_request *req)
                                qstatus = 3;
                        }
 
-                       srv_put_dos_date2(p, 0, qtime);
+                       srv_put_dos_date2_ts(p, 0, qtime);
                        SCVAL(p, 4, qstatus);
                        SSVAL(p, 5, qrapjobid);
                        SIVAL(p, 7, info[i].info2.size);