spoolss: pretty-print a struct spoolss_Time.
authorGünther Deschner <gd@samba.org>
Thu, 22 Apr 2010 09:42:45 +0000 (11:42 +0200)
committerKarolin Seeger <kseeger@samba.org>
Sat, 5 Mar 2011 13:34:55 +0000 (14:34 +0100)
Guenther
(cherry picked from commit 440075247d11a7852d8567753f426fa67f41d875)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 0396087c36652b6c3d2bf4206212c2823352f9e0)

librpc/gen_ndr/ndr_spoolss.c
librpc/gen_ndr/spoolss.h
librpc/idl/spoolss.idl
librpc/ndr/ndr_spoolss_buf.c
librpc/ndr/ndr_spoolss_buf.h

index af555d75ee6077bfea72cc5b993e5ac26f1c7583..18ca3f6fddc1368ab00eaff0567a2e4c193642b1 100644 (file)
@@ -44,21 +44,6 @@ static enum ndr_err_code ndr_pull_spoolss_Time(struct ndr_pull *ndr, int ndr_fla
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, const struct spoolss_Time *r)
-{
-       ndr_print_struct(ndr, name, "spoolss_Time");
-       ndr->depth++;
-       ndr_print_uint16(ndr, "year", r->year);
-       ndr_print_uint16(ndr, "month", r->month);
-       ndr_print_uint16(ndr, "day_of_week", r->day_of_week);
-       ndr_print_uint16(ndr, "day", r->day);
-       ndr_print_uint16(ndr, "hour", r->hour);
-       ndr_print_uint16(ndr, "minute", r->minute);
-       ndr_print_uint16(ndr, "second", r->second);
-       ndr_print_uint16(ndr, "millisecond", r->millisecond);
-       ndr->depth--;
-}
-
 static size_t ndr_size_spoolss_Time(const struct spoolss_Time *r, struct smb_iconv_convenience *ic, int flags)
 {
        return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_Time, ic);
index fc7114ada04ec333881712530c358ce92949ad4f..15ad8866044632ea018259ea735f2104a750a30d 100644 (file)
@@ -126,7 +126,7 @@ struct spoolss_Time {
        uint16_t minute;
        uint16_t second;
        uint16_t millisecond;
-}/* [gensize] */;
+}/* [noprint,gensize] */;
 
 struct spoolss_TimeCtr {
        uint32_t size;/* [value(ndr_size_spoolss_Time(time,ndr->iconv_convenience,ndr->flags))] */
index 44839be1bdc5de8cda9f6c0f0f08db32b79ca280..e0d9d2f9549432e044d9852f9a5aa87127d2ef7e 100644 (file)
@@ -17,7 +17,7 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor")
 ] interface spoolss
 {
        typedef [v1_enum] enum winreg_Type winreg_Type;
-       typedef [gensize] struct {
+       typedef [gensize,noprint] struct {
                uint16 year;
                uint16 month;
                uint16 day_of_week;
index 5aa89e408eb96c903aab939b51bf97789783f2b4..811a8e2accbca3d854368929922a1ed2613bb88d 100644 (file)
@@ -1382,3 +1382,30 @@ _PUBLIC_ enum ndr_err_code ndr_push_spoolss_PrinterInfo2(struct ndr_push *ndr, i
        }
        return NDR_ERR_SUCCESS;
 }
+
+_PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, const struct spoolss_Time *r)
+{
+       struct tm tm;
+       time_t t;
+       char *str;
+
+       tm.tm_sec       = r->second;
+       tm.tm_min       = r->minute;
+       tm.tm_hour      = r->hour;
+       tm.tm_mday      = r->day;
+       tm.tm_mon       = r->month - 1;
+       tm.tm_year      = r->year - 1900;
+       tm.tm_wday      = r->day_of_week;
+       tm.tm_yday      = 0;
+       tm.tm_isdst     = -1;
+
+       t = mktime(&tm);
+
+       str = timestring(ndr, t);
+
+       ndr_print_struct(ndr, name, "spoolss_Time");
+       ndr->depth++;
+       ndr_print_string(ndr, "", str);
+       ndr->depth--;
+       talloc_free(str);
+}
index 2766abb1cd0ca5f85c331bd95815131c18b8b318..89dcb4617cbb38352aef56151a267c788753c6be 100644 (file)
@@ -51,6 +51,7 @@ size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t
 void ndr_print_spoolss_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r);
 enum ndr_err_code ndr_pull_spoolss_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r);
 enum ndr_err_code ndr_push_spoolss_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r);
+_PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, const struct spoolss_Time *r);
 
 #undef _PRINTF_ATTRIBUTE
 #define _PRINTF_ATTRIBUTE(a1, a2)