The branch, v3-6-test has been updated
       via  f1414d5 s3-printing: fix crash bug in print_spool_open().
       via  dc30e4b s3-spoolss: handle NTTIME(0) as "01/01/1601" REG_SZ in 
driver dates.
       via  d5c2f4b s4-smbtorture: always skip addprinter{ex} level 1 tests for 
now.
       via  04fb3c0 s4-smbtorture: fix expected driver date REG_SZ string.
       via  36394d3 s4-smbtorture: check the returned driver date is equal to 
the one we passed in.
       via  3e119eb s4-smbtorture: add torture_assert_nttime_equal macro.
       via  ac45b20 s4-smbtorture: interesting, DriverDate and DriverVersion 
are different in w2k3 and w2k8r2.
      from  6bfbf5f s4-smbtorture: run the winreg tests also against an added 
driver.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit f1414d5890df616a66796c7f9194f46b36558f57
Author: Günther Deschner <[email protected]>
Date:   Wed Dec 22 11:34:22 2010 +0100

    s3-printing: fix crash bug in print_spool_open().
    
    Guenther
    
    Autobuild-User: Günther Deschner <[email protected]>
    Autobuild-Date: Wed Dec 22 14:21:58 CET 2010 on sn-devel-104
    (cherry picked from commit 94e83e385e5ba66f1415164214f7afd5e4ad7536)

commit dc30e4b167b05180c3c3ccbd01aac05c98aef9cd
Author: Günther Deschner <[email protected]>
Date:   Wed Dec 22 11:32:24 2010 +0100

    s3-spoolss: handle NTTIME(0) as "01/01/1601" REG_SZ in driver dates.
    
    Guenther
    (cherry picked from commit d0e164458d33228f74b41023b11f234837cc9668)

commit d5c2f4b6e78b39a4b742348abb4d175eab5d8970
Author: Günther Deschner <[email protected]>
Date:   Wed Dec 22 11:30:51 2010 +0100

    s4-smbtorture: always skip addprinter{ex} level 1 tests for now.
    
    Guenther
    (cherry picked from commit a204c45e59c35a9c5bfcd85a96d99bc12d727d07)

commit 04fb3c0af2f27cd1092747a0a5cf9751c1ea2d9e
Author: Günther Deschner <[email protected]>
Date:   Tue Dec 21 17:00:33 2010 +0100

    s4-smbtorture: fix expected driver date REG_SZ string.
    
    This resolves the "WARNING!: ../torture/rpc/spoolss.c:4688: str was 
01/01/1601,
    expected 01/01/1970: "DriverDate" - driver_date mismatch" warnings.
    
    Guenther
    (cherry picked from commit 9626487a14c8dfd23f8743cb85a2bc12cf454887)

commit 36394d3867f112f0c66e9e79ee4a73c5e54ffaa3
Author: Günther Deschner <[email protected]>
Date:   Tue Dec 21 16:14:48 2010 +0100

    s4-smbtorture: check the returned driver date is equal to the one we passed 
in.
    
    Guenther
    (cherry picked from commit 3931d4aa65aa6edf75c6593e43d74441168ed299)

commit 3e119eb9d27e40d348e9d88b83f5d6d8c275b8b2
Author: Günther Deschner <[email protected]>
Date:   Tue Dec 21 16:14:20 2010 +0100

    s4-smbtorture: add torture_assert_nttime_equal macro.
    
    Guenther
    (cherry picked from commit 2e2cb8d96d786c0c9f1b45f41f0758ee07bebf4c)

commit ac45b2051226e94cd7b4b06792afbf6a7d654600
Author: Günther Deschner <[email protected]>
Date:   Mon Dec 20 16:02:02 2010 +0100

    s4-smbtorture: interesting, DriverDate and DriverVersion are different in 
w2k3 and w2k8r2.
    
    While in w2k8 they are REG_SZ date or numerical strings, they are 8 byte 
REG_BINARY blobs in w2k3.
    
    Guenther
    (cherry picked from commit 340d2df123813196247d3b1aff38048cfe93c1ec)

-----------------------------------------------------------------------

Summary of changes:
 lib/torture/torture.h                 |    8 +++++-
 source3/printing/printspoolss.c       |    4 ++-
 source3/rpc_server/srv_spoolss_util.c |   17 +++++++++---
 source4/torture/rpc/spoolss.c         |   46 ++++++++++++++++++++++++++++----
 4 files changed, 63 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index 39f83df..00de5e8 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -450,7 +450,13 @@ void torture_result(struct torture_context *test,
        } \
        } while(0)
 
-
+#define torture_assert_nttime_equal(torture_ctx,got,expected,cmt) \
+       do { NTTIME __got = got, __expected = expected; \
+       if (!nt_time_equal(&__got, &__expected)) { \
+               torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" 
was %s, expected %s: %s", nt_time_string(tctx, __got), nt_time_string(tctx, 
__expected), cmt); \
+               return false; \
+       }\
+       } while(0)
 
 #define torture_skip(torture_ctx,cmt) do {\
                torture_result(torture_ctx, TORTURE_SKIP, __location__": %s", 
cmt);\
diff --git a/source3/printing/printspoolss.c b/source3/printing/printspoolss.c
index 8426b84..8effb6e 100644
--- a/source3/printing/printspoolss.c
+++ b/source3/printing/printspoolss.c
@@ -208,7 +208,9 @@ done:
        if (!NT_STATUS_IS_OK(status)) {
                if (fd != -1) {
                        close(fd);
-                       unlink(fsp->print_file->filename);
+                       if (fsp->print_file) {
+                               unlink(fsp->print_file->filename);
+                       }
                }
                /* We need to delete the job from spoolss too */
                if (pf->jobid) {
diff --git a/source3/rpc_server/srv_spoolss_util.c 
b/source3/rpc_server/srv_spoolss_util.c
index 7145676..1825033 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",
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 630694d..6ff2414 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -4369,6 +4369,23 @@ do {\
                talloc_asprintf(tctx, "%s - %s mismatch", #wname, #iname));\
 } while(0);
 
+#define test_binary(wname, iname) \
+do {\
+       enum winreg_Type w_type;\
+       uint32_t w_size;\
+       uint32_t w_length;\
+       uint8_t *w_data;\
+       torture_assert(tctx,\
+               test_winreg_QueryValue(tctx, winreg_handle, &key_handle, wname,\
+                                      &w_type, &w_size, &w_length, &w_data),\
+               "failed to query winreg");\
+       torture_assert_int_equal(tctx, w_type, REG_BINARY, "unexpected type");\
+       torture_assert_int_equal(tctx, w_size, iname.length, "unexpected 
length");\
+       torture_assert_mem_equal(tctx, w_data, iname.data, w_size, \
+               "binary unequal");\
+} while(0);
+
+
 #define test_dm(wname, iname) \
 do {\
        DATA_BLOB blob;\
@@ -4575,6 +4592,11 @@ static const char *driver_winreg_date(TALLOC_CTX 
*mem_ctx, NTTIME nt)
 {
        time_t t;
        struct tm *tm;
+
+       if (nt == 0) {
+               return talloc_strdup(mem_ctx, "01/01/1601");
+       }
+
        t = nt_time_to_unix(nt);
        tm = localtime(&t);
 
@@ -4717,8 +4739,14 @@ static bool test_GetDriverInfo_winreg(struct 
torture_context *tctx,
        test_sz("Data File",                    data_file);
        test_sz("Datatype",                     info.info6.default_datatype);
        test_sz("Driver",                       driver_path);
-       test_sz("DriverDate",                   driver_date);
-       test_sz("DriverVersion",                driver_version);
+       if (torture_setting_bool(tctx, "w2k3", false)) {
+               DATA_BLOB blob = data_blob_talloc_zero(tctx, 8);
+               test_binary("DriverDate",       blob);
+               test_binary("DriverVersion",    blob);
+       } else {
+               test_sz("DriverDate",           driver_date);
+               test_sz("DriverVersion",        driver_version);
+       }
        test_sz("HardwareID",                   info.info6.hardware_id);
        test_sz("Help File",                    help_file);
        test_sz("Manufacturer",                 info.info6.manufacturer_name);
@@ -7525,8 +7553,9 @@ static bool torture_rpc_spoolss_printerwkn_setup(struct 
torture_context *tctx, v
        t->info2.printername    = TORTURE_WELLKNOWN_PRINTER;
        t->devmode              = NULL;
 
-       if (t->wellknown && torture_setting_bool(tctx, "samba3", false)) {
-               torture_skip(tctx, "skipping AddPrinter level 1 against samba");
+       /* FIXME */
+       if (t->wellknown) {
+               torture_skip(tctx, "skipping AddPrinter level 1");
        }
 
        return torture_rpc_spoolss_printer_setup_common(tctx, t);
@@ -7543,8 +7572,9 @@ static bool torture_rpc_spoolss_printerexwkn_setup(struct 
torture_context *tctx,
        t->info2.printername    = TORTURE_WELLKNOWN_PRINTER_EX;
        t->devmode              = NULL;
 
-       if (t->wellknown && torture_setting_bool(tctx, "samba3", false)) {
-               torture_skip(tctx, "skipping AddPrinter level 1 against samba");
+       /* FIXME */
+       if (t->wellknown) {
+               torture_skip(tctx, "skipping AddPrinterEx level 1");
        }
 
        return torture_rpc_spoolss_printer_setup_common(tctx, t);
@@ -8421,6 +8451,8 @@ static bool test_AddPrinterDriver_args_level_6(struct 
torture_context *tctx,
                }
        }
 
+       torture_assert_nttime_equal(tctx, info.info6.driver_date, 
info6.driver_date, "driverdate mismatch");
+
        return true;
 }
 
@@ -8469,6 +8501,8 @@ static bool test_AddPrinterDriver_args_level_8(struct 
torture_context *tctx,
                }
        }
 
+       torture_assert_nttime_equal(tctx, info.info8.driver_date, 
r->driver_date, "driverdate mismatch");
+
        return true;
 }
 


-- 
Samba Shared Repository

Reply via email to