mirror of
https://github.com/samba-team/samba.git
synced 2025-09-09 01:44:21 +03:00
s3-spoolss: handle NTTIME(0) as "01/01/1601" REG_SZ in driver dates.
Guenther
This commit is contained in:
@@ -1219,10 +1219,14 @@ static WERROR winreg_printer_write_date(TALLOC_CTX *mem_ctx,
|
|||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
time_t t;
|
time_t t;
|
||||||
|
|
||||||
|
if (data == 0) {
|
||||||
|
str = talloc_strdup(mem_ctx, "01/01/1601");
|
||||||
|
} else {
|
||||||
t = nt_time_to_unix(data);
|
t = nt_time_to_unix(data);
|
||||||
tm = localtime(&t);
|
tm = localtime(&t);
|
||||||
str = talloc_asprintf(mem_ctx, "%02d/%02d/%04d",
|
str = talloc_asprintf(mem_ctx, "%02d/%02d/%04d",
|
||||||
tm->tm_mon + 1, tm->tm_mday, tm->tm_year + 1900);
|
tm->tm_mon + 1, tm->tm_mday, tm->tm_year + 1900);
|
||||||
|
}
|
||||||
if (!str) {
|
if (!str) {
|
||||||
return WERR_NOMEM;
|
return WERR_NOMEM;
|
||||||
}
|
}
|
||||||
@@ -1255,6 +1259,11 @@ static WERROR winreg_printer_date_to_NTTIME(const char *str, NTTIME *data)
|
|||||||
struct tm tm;
|
struct tm tm;
|
||||||
time_t t;
|
time_t t;
|
||||||
|
|
||||||
|
if (strequal(str, "01/01/1601")) {
|
||||||
|
*data = 0;
|
||||||
|
return WERR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
ZERO_STRUCT(tm);
|
ZERO_STRUCT(tm);
|
||||||
|
|
||||||
if (sscanf(str, "%d/%d/%d",
|
if (sscanf(str, "%d/%d/%d",
|
||||||
|
Reference in New Issue
Block a user