s3-spoolss: move SYSTEMTIME parsing to a more generic place, as suggested.
authorGünther Deschner <gd@samba.org>
Tue, 17 Mar 2009 13:45:24 +0000 (14:45 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 17 Mar 2009 17:39:23 +0000 (18:39 +0100)
Guenther

source3/include/proto.h
source3/include/rpc_misc.h
source3/include/rpc_spoolss.h
source3/registry/reg_perfcount.c
source3/rpc_parse/parse_misc.c
source3/rpc_parse/parse_spoolss.c

index ddc6ed1fad64f422eb1b2536d081f76468199292..fea9588775b9260c5b4627c98ae8658573328125 100644 (file)
@@ -5677,6 +5677,8 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli,
 
 bool smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth);
 bool smb_io_nttime(const char *desc, prs_struct *ps, int depth, NTTIME *nttime);
+bool smb_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime);
+bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime);
 bool smb_io_dom_sid(const char *desc, DOM_SID *sid, prs_struct *ps, int depth);
 bool smb_io_uuid(const char *desc, struct GUID *uuid, 
                 prs_struct *ps, int depth);
@@ -5826,8 +5828,6 @@ bool sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int
 
 /* The following definitions come from rpc_parse/parse_spoolss.c  */
 
-bool spoolss_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime);
-bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime);
 bool spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode);
 uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p);
 bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src);
index 1e9d43bfa06424a1f4c86f1432102b868c1f1bf2..37dffbb00592941b8d76005b6d0192f7e6b98196 100644 (file)
@@ -138,4 +138,23 @@ typedef struct {           /* UNISTR3 - XXXX not sure about this structure */
        UNISTR str;
 } UNISTR3;
 
+/*
+ * I'm really wondering how many different time formats
+ * I will have to cope with
+ *
+ * JFM, 09/13/98 In a mad mood ;-(
+*/
+typedef struct systemtime
+{
+       uint16 year;
+       uint16 month;
+       uint16 dayofweek;
+       uint16 day;
+       uint16 hour;
+       uint16 minute;
+       uint16 second;
+       uint16 milliseconds;
+}
+SYSTEMTIME;
+
 #endif /* _RPC_MISC_H */
index 0d98afba251d3643999d1ab8eda4980dd4b1d379..29f505ab599570c84e0af974a167bda555f866c4 100644 (file)
@@ -233,25 +233,6 @@ typedef struct devicemode
 }
 DEVICEMODE;
 
-/*
- * I'm really wondering how many different time formats
- * I will have to cope with
- *
- * JFM, 09/13/98 In a mad mood ;-(
-*/
-typedef struct systemtime
-{
-       uint16 year;
-       uint16 month;
-       uint16 dayofweek;
-       uint16 day;
-       uint16 hour;
-       uint16 minute;
-       uint16 second;
-       uint16 milliseconds;
-}
-SYSTEMTIME;
-
 /********************************************/
 
 typedef struct printer_enum_values
index fed3cbdd525bcb22a71bba61d366008fc4ae682a..14716b2f532cb52154ccca9ddd0595e0bf13337a 100644 (file)
@@ -1114,7 +1114,7 @@ static bool _reg_perfcount_marshall_perf_data_block(prs_struct *ps, PERF_DATA_BL
                return False;
        if(!prs_uint32("DefaultObject", ps, depth, &block.DefaultObject))
                return False;
-       if(!spoolss_io_system_time("SystemTime", ps, depth, &block.SystemTime))
+       if(!smb_io_system_time("SystemTime", ps, depth, &block.SystemTime))
                return False;
        if(!prs_uint32("Padding", ps, depth, &block.Padding))
                return False;
index 38d5b953766b9ebc30903b64ecc1c9af78cde09a..e948afde87b3c858f43c77b7378dea6e7fce16ee 100644 (file)
@@ -67,6 +67,48 @@ bool smb_io_nttime(const char *desc, prs_struct *ps, int depth, NTTIME *nttime)
        return smb_io_time( desc, nttime, ps, depth );
 }
 
+/*******************************************************************
+********************************************************************/
+
+bool smb_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime)
+{
+       if(!prs_uint16("year", ps, depth, &systime->year))
+               return False;
+       if(!prs_uint16("month", ps, depth, &systime->month))
+               return False;
+       if(!prs_uint16("dayofweek", ps, depth, &systime->dayofweek))
+               return False;
+       if(!prs_uint16("day", ps, depth, &systime->day))
+               return False;
+       if(!prs_uint16("hour", ps, depth, &systime->hour))
+               return False;
+       if(!prs_uint16("minute", ps, depth, &systime->minute))
+               return False;
+       if(!prs_uint16("second", ps, depth, &systime->second))
+               return False;
+       if(!prs_uint16("milliseconds", ps, depth, &systime->milliseconds))
+               return False;
+
+       return True;
+}
+
+/*******************************************************************
+********************************************************************/
+
+bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime)
+{
+       systime->year=unixtime->tm_year+1900;
+       systime->month=unixtime->tm_mon+1;
+       systime->dayofweek=unixtime->tm_wday;
+       systime->day=unixtime->tm_mday;
+       systime->hour=unixtime->tm_hour;
+       systime->minute=unixtime->tm_min;
+       systime->second=unixtime->tm_sec;
+       systime->milliseconds=0;
+
+       return True;
+}
+
 /*******************************************************************
  Reads or writes a DOM_SID structure.
 ********************************************************************/
index ae73c35c0a55f26734df34e48d3dde1de2576191..c082af6f099a728a7c582e5f65ba39856020de01 100644 (file)
 #define DBGC_CLASS DBGC_RPC_PARSE
 
 
-/*******************************************************************
-This should be moved in a more generic lib.
-********************************************************************/  
-
-bool spoolss_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime)
-{
-       if(!prs_uint16("year", ps, depth, &systime->year))
-               return False;
-       if(!prs_uint16("month", ps, depth, &systime->month))
-               return False;
-       if(!prs_uint16("dayofweek", ps, depth, &systime->dayofweek))
-               return False;
-       if(!prs_uint16("day", ps, depth, &systime->day))
-               return False;
-       if(!prs_uint16("hour", ps, depth, &systime->hour))
-               return False;
-       if(!prs_uint16("minute", ps, depth, &systime->minute))
-               return False;
-       if(!prs_uint16("second", ps, depth, &systime->second))
-               return False;
-       if(!prs_uint16("milliseconds", ps, depth, &systime->milliseconds))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/  
-
-bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime)
-{
-       systime->year=unixtime->tm_year+1900;
-       systime->month=unixtime->tm_mon+1;
-       systime->dayofweek=unixtime->tm_wday;
-       systime->day=unixtime->tm_mday;
-       systime->hour=unixtime->tm_hour;
-       systime->minute=unixtime->tm_min;
-       systime->second=unixtime->tm_sec;
-       systime->milliseconds=0;
-
-       return True;
-}
-
 /*******************************************************************
  * read or write a DEVICEMODE struct.
  * on reading allocate memory for the private member