summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-12-22 11:32:24 +0100
committerGünther Deschner <gd@samba.org>2010-12-22 13:33:18 +0100
commitd0e164458d33228f74b41023b11f234837cc9668 (patch)
tree4f2ebb2ca20752e207faffe8d4e20267d222b198 /source3
parenta204c45e59c35a9c5bfcd85a96d99bc12d727d07 (diff)
downloadsamba-d0e164458d33228f74b41023b11f234837cc9668.tar.gz
samba-d0e164458d33228f74b41023b11f234837cc9668.tar.bz2
samba-d0e164458d33228f74b41023b11f234837cc9668.zip
s3-spoolss: handle NTTIME(0) as "01/01/1601" REG_SZ in driver dates.
Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_spoolss_util.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/source3/rpc_server/srv_spoolss_util.c b/source3/rpc_server/srv_spoolss_util.c
index 714567619d..18250333e1 100644
--- a/source3/rpc_server/srv_spoolss_util.c
+++ b/source3/rpc_server/srv_spoolss_util.c
@@ -1219,10 +1219,14 @@ static WERROR winreg_printer_write_date(TALLOC_CTX *mem_ctx,
struct tm *tm;
time_t t;
- t = nt_time_to_unix(data);
- tm = localtime(&t);
- str = talloc_asprintf(mem_ctx, "%02d/%02d/%04d",
- tm->tm_mon + 1, tm->tm_mday, tm->tm_year + 1900);
+ if (data == 0) {
+ str = talloc_strdup(mem_ctx, "01/01/1601");
+ } else {
+ t = nt_time_to_unix(data);
+ tm = localtime(&t);
+ str = talloc_asprintf(mem_ctx, "%02d/%02d/%04d",
+ tm->tm_mon + 1, tm->tm_mday, tm->tm_year + 1900);
+ }
if (!str) {
return WERR_NOMEM;
}
@@ -1255,6 +1259,11 @@ static WERROR winreg_printer_date_to_NTTIME(const char *str, NTTIME *data)
struct tm tm;
time_t t;
+ if (strequal(str, "01/01/1601")) {
+ *data = 0;
+ return WERR_OK;
+ }
+
ZERO_STRUCT(tm);
if (sscanf(str, "%d/%d/%d",