]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: Fix stack variable used out of scope in test_devicemode_full()
authorAndreas Schneider <asn@samba.org>
Fri, 2 Dec 2022 08:44:58 +0000 (09:44 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 20 Dec 2022 06:55:45 +0000 (06:55 +0000)
==17828==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffc37790230 at pc 0x7fc37e2a3a11 bp 0x7ffc3778fec0 sp 0x7ffc3778feb8
READ of size 16 at 0x7ffc37790230 thread T0
    #0 0x7fc37e2a3a10 in ndr_push_spoolss_GetPrinter librpc/gen_ndr/ndr_spoolss.c:27123
    #1 0x7fc380629b30 in dcerpc_binding_handle_call_send ../../librpc/rpc/binding_handle.c:416
    #2 0x7fc38062a132 in dcerpc_binding_handle_call ../../librpc/rpc/binding_handle.c:553
    #3 0x7fc37ed113c9 in dcerpc_spoolss_GetPrinter_r librpc/gen_ndr/ndr_spoolss_c.c:1947
    #4 0x5570ba6c4d03 in test_devicemode_full ../../source4/torture/rpc/spoolss.c:2249
    #5 0x5570ba6e61ea in test_PrinterInfo_DevModes ../../source4/torture/rpc/spoolss.c:2384
    #6 0x5570ba6e61ea in test_PrinterInfo_DevMode ../../source4/torture/rpc/spoolss.c:2488
    #7 0x5570ba6e61ea in test_printer_dm ../../source4/torture/rpc/spoolss.c:9082
    #8 0x7fc37fc7b67d in wrap_test_with_simple_test ../../lib/torture/torture.c:808
    #9 0x7fc37fc7d40b in internal_torture_run_test ../../lib/torture/torture.c:516
    #10 0x7fc37fc7d87c in torture_run_tcase_restricted ../../lib/torture/torture.c:581
    #11 0x7fc37fc7deb2 in torture_run_suite_restricted ../../lib/torture/torture.c:435
    #12 0x5570ba89a65d in run_matching ../../source4/torture/smbtorture.c:95
    #13 0x5570ba89a6e4 in run_matching ../../source4/torture/smbtorture.c:105
    #14 0x5570ba89a6e4 in run_matching ../../source4/torture/smbtorture.c:105
    #15 0x5570ba89b3e4 in torture_run_named_tests ../../source4/torture/smbtorture.c:172
    #16 0x5570ba89f3e0 in main ../../source4/torture/smbtorture.c:750
    #17 0x7fc37c62c5af in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #18 0x7fc37c62c678 in __libc_start_main_impl ../csu/libc-start.c:381
    #19 0x5570ba49e824 in _start ../sysdeps/x86_64/start.S:115

Address 0x7ffc37790230 is located in stack of thread T0 at offset 160 in frame
    #0 0x5570ba6c4562 in test_devicemode_full ../../source4/torture/rpc/spoolss.c:2186

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Dec 20 06:55:45 UTC 2022 on sn-devel-184

source4/torture/rpc/spoolss.c

index 2400d78a6a009287db53437f190f120f8e33420a..0c71ed0073beca4a0466b92d61ccb2978291b3ff 100644 (file)
@@ -1482,7 +1482,8 @@ static bool test_PrinterInfo(struct torture_context *tctx,
        union spoolss_PrinterInfo info;
        struct spoolss_DevmodeContainer devmode_ctr;
        struct sec_desc_buf secdesc_ctr;
-       uint32_t needed;
+       uint32_t needed = 0;
+       DATA_BLOB blob = data_blob_null;
        bool ret = true;
        int i;
 
@@ -1580,7 +1581,7 @@ static bool test_PrinterInfo(struct torture_context *tctx,
        q.out.info = &info;
        q0 = q;
 
-#define TESTGETCALL(call, r) \
+#define TESTGETCALL(call, r, needed, blob) \
                r.in.buffer = NULL; \
                r.in.offered = 0;\
                r.out.needed = &needed; \
@@ -1592,7 +1593,7 @@ static bool test_PrinterInfo(struct torture_context *tctx,
                        break; \
                }\
                if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {\
-                       DATA_BLOB blob = data_blob_talloc_zero(tctx, needed); \
+                       blob = data_blob_talloc_zero(tctx, needed); \
                        r.in.buffer = &blob; \
                        r.in.offered = needed; \
                }\
@@ -1670,79 +1671,79 @@ static bool test_PrinterInfo(struct torture_context *tctx,
                        break; \
                }
 
-#define TEST_PRINTERINFO_STRING_EXP_ERR(q, s, lvl1, field1, lvl2, field2, value, err) do { \
+#define TEST_PRINTERINFO_STRING_EXP_ERR(q, s, needed, blob, lvl1, field1, lvl2, field2, value, err) do { \
                void *p; \
                torture_comment(tctx, "field test %d/%s vs %d/%s\n", lvl1, #field1, lvl2, #field2); \
                q.in.level = lvl1; \
-               TESTGETCALL(GetPrinter, q) \
+               TESTGETCALL(GetPrinter, q, needed, blob) \
                info_ctr.level = lvl1; \
                p = (void *)&q.out.info->info ## lvl1; \
                info_ctr.info.info ## lvl1 = (struct spoolss_SetPrinterInfo ## lvl1 *)p; \
                info_ctr.info.info ## lvl1->field1 = value;\
                TESTSETCALL_EXP(SetPrinter, s, err) \
                info_ctr.info.info ## lvl1->field1 = ""; \
-               TESTGETCALL(GetPrinter, q) \
+               TESTGETCALL(GetPrinter, q, needed, blob) \
                info_ctr.info.info ## lvl1->field1 = value; \
                STRING_EQUAL(info_ctr.info.info ## lvl1->field1, value, field1); \
                q.in.level = lvl2; \
-               TESTGETCALL(GetPrinter, q) \
+               TESTGETCALL(GetPrinter, q, needed, blob) \
                p = (void *)&q.out.info->info ## lvl2; \
                info_ctr.info.info ## lvl2 = (struct spoolss_SetPrinterInfo ## lvl2 *)p; \
                STRING_EQUAL(info_ctr.info.info ## lvl2->field2, value, field2); \
        } while (0)
 
-#define TEST_PRINTERINFO_STRING(q, s, lvl1, field1, lvl2, field2, value) do { \
-       TEST_PRINTERINFO_STRING_EXP_ERR(q, s, lvl1, field1, lvl2, field2, value, WERR_OK); \
+#define TEST_PRINTERINFO_STRING(q, s, needed, blob, lvl1, field1, lvl2, field2, value) do { \
+       TEST_PRINTERINFO_STRING_EXP_ERR(q, s, needed, blob, lvl1, field1, lvl2, field2, value, WERR_OK); \
        } while (0);
 
-#define TEST_PRINTERINFO_INT_EXP(q, s, lvl1, field1, lvl2, field2, value, exp_value) do { \
+#define TEST_PRINTERINFO_INT_EXP(q, s, needed, blob, lvl1, field1, lvl2, field2, value, exp_value) do { \
                void *p; \
                torture_comment(tctx, "field test %d/%s vs %d/%s\n", lvl1, #field1, lvl2, #field2); \
                q.in.level = lvl1; \
-               TESTGETCALL(GetPrinter, q) \
+               TESTGETCALL(GetPrinter, q, needed, blob) \
                info_ctr.level = lvl1; \
                p = (void *)&q.out.info->info ## lvl1; \
                info_ctr.info.info ## lvl1 = (struct spoolss_SetPrinterInfo ## lvl1 *)p; \
                info_ctr.info.info ## lvl1->field1 = value; \
                TESTSETCALL(SetPrinter, s) \
                info_ctr.info.info ## lvl1->field1 = 0; \
-               TESTGETCALL(GetPrinter, q) \
+               TESTGETCALL(GetPrinter, q, needed, blob) \
                p = (void *)&q.out.info->info ## lvl1; \
                info_ctr.info.info ## lvl1 = (struct spoolss_SetPrinterInfo ## lvl1 *)p; \
                INT_EQUAL(info_ctr.info.info ## lvl1->field1, exp_value, field1); \
                q.in.level = lvl2; \
-               TESTGETCALL(GetPrinter, q) \
+               TESTGETCALL(GetPrinter, q, needed, blob) \
                p = (void *)&q.out.info->info ## lvl2; \
                info_ctr.info.info ## lvl2 = (struct spoolss_SetPrinterInfo ## lvl2 *)p; \
                INT_EQUAL(info_ctr.info.info ## lvl2->field2, exp_value, field1); \
        } while (0)
 
-#define TEST_PRINTERINFO_INT(q, s, lvl1, field1, lvl2, field2, value) do { \
-        TEST_PRINTERINFO_INT_EXP(q, s, lvl1, field1, lvl2, field2, value, value); \
+#define TEST_PRINTERINFO_INT(q, s, needed, blob, lvl1, field1, lvl2, field2, value) do { \
+        TEST_PRINTERINFO_INT_EXP(q, s, needed, blob, lvl1, field1, lvl2, field2, value, value); \
         } while (0)
 
        q0.in.level = 0;
-       do { TESTGETCALL(GetPrinter, q0) } while (0);
+       do { TESTGETCALL(GetPrinter, q0, needed, blob) } while (0);
 
-       TEST_PRINTERINFO_STRING(q, s, 2, comment,  1, comment, "xx2-1 comment");
-       TEST_PRINTERINFO_STRING(q, s, 2, comment,  2, comment, "xx2-2 comment");
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 2, comment,  1, comment, "xx2-1 comment");
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 2, comment,  2, comment, "xx2-2 comment");
 
        /* level 0 printername does not stick */
-/*     TEST_PRINTERINFO_STRING(q, s, 2, printername,  0, printername, "xx2-0 printer"); */
-       TEST_PRINTERINFO_STRING(q, s, 2, printername,  1, name,  "xx2-1 printer");
-       TEST_PRINTERINFO_STRING(q, s, 2, printername,  2, printername, "xx2-2 printer");
-       TEST_PRINTERINFO_STRING(q, s, 2, printername,  4, printername, "xx2-4 printer");
-       TEST_PRINTERINFO_STRING(q, s, 2, printername,  5, printername, "xx2-5 printer");
-/*     TEST_PRINTERINFO_STRING(q, s, 4, printername,  0, printername, "xx4-0 printer"); */
-       TEST_PRINTERINFO_STRING(q, s, 4, printername,  1, name,  "xx4-1 printer");
-       TEST_PRINTERINFO_STRING(q, s, 4, printername,  2, printername, "xx4-2 printer");
-       TEST_PRINTERINFO_STRING(q, s, 4, printername,  4, printername, "xx4-4 printer");
-       TEST_PRINTERINFO_STRING(q, s, 4, printername,  5, printername, "xx4-5 printer");
-/*     TEST_PRINTERINFO_STRING(q, s, 5, printername,  0, printername, "xx5-0 printer"); */
-       TEST_PRINTERINFO_STRING(q, s, 5, printername,  1, name,  "xx5-1 printer");
-       TEST_PRINTERINFO_STRING(q, s, 5, printername,  2, printername, "xx5-2 printer");
-       TEST_PRINTERINFO_STRING(q, s, 5, printername,  4, printername, "xx5-4 printer");
-       TEST_PRINTERINFO_STRING(q, s, 5, printername,  5, printername, "xx5-5 printer");
+/*     TEST_PRINTERINFO_STRING(q, s, needed, blob, 2, printername,  0, printername, "xx2-0 printer"); */
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 2, printername,  1, name,    "xx2-1 printer");
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 2, printername,  2, printername, "xx2-2 printer");
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 2, printername,  4, printername, "xx2-4 printer");
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 2, printername,  5, printername, "xx2-5 printer");
+/*     TEST_PRINTERINFO_STRING(q, s, needed, blob, 4, printername,  0, printername, "xx4-0 printer"); */
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 4, printername,  1, name,    "xx4-1 printer");
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 4, printername,  2, printername, "xx4-2 printer");
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 4, printername,  4, printername, "xx4-4 printer");
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 4, printername,  5, printername, "xx4-5 printer");
+/*     TEST_PRINTERINFO_STRING(q, s, needed, blob, 5, printername,  0, printername, "xx5-0 printer"); */
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 5, printername,  1, name,    "xx5-1 printer");
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 5, printername,  2, printername, "xx5-2 printer");
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 5, printername,  4, printername, "xx5-4 printer");
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 5, printername,  5, printername, "xx5-5 printer");
 
        /* servername can be set but does not stick
        TEST_PRINTERINFO_STRING(q, 2, servername,  0, servername, "xx2-0 servername");
@@ -1751,68 +1752,68 @@ static bool test_PrinterInfo(struct torture_context *tctx,
        */
 
        /* passing an invalid port will result in WERR_UNKNOWN_PORT */
-       TEST_PRINTERINFO_STRING_EXP_ERR(q, s, 2, portname,  2, portname, "xx2-2 portname", WERR_UNKNOWN_PORT);
-       TEST_PRINTERINFO_STRING_EXP_ERR(q, s, 2, portname,  5, portname, "xx2-5 portname", WERR_UNKNOWN_PORT);
-       TEST_PRINTERINFO_STRING_EXP_ERR(q, s, 5, portname,  2, portname, "xx5-2 portname", WERR_UNKNOWN_PORT);
-       TEST_PRINTERINFO_STRING_EXP_ERR(q, s, 5, portname,  5, portname, "xx5-5 portname", WERR_UNKNOWN_PORT);
+       TEST_PRINTERINFO_STRING_EXP_ERR(q, s, needed, blob, 2, portname,  2, portname, "xx2-2 portname", WERR_UNKNOWN_PORT);
+       TEST_PRINTERINFO_STRING_EXP_ERR(q, s, needed, blob, 2, portname,  5, portname, "xx2-5 portname", WERR_UNKNOWN_PORT);
+       TEST_PRINTERINFO_STRING_EXP_ERR(q, s, needed, blob, 5, portname,  2, portname, "xx5-2 portname", WERR_UNKNOWN_PORT);
+       TEST_PRINTERINFO_STRING_EXP_ERR(q, s, needed, blob, 5, portname,  5, portname, "xx5-5 portname", WERR_UNKNOWN_PORT);
 
-       TEST_PRINTERINFO_STRING(q, s, 2, sharename,     2, sharename,   "xx2-2 sharename");
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 2, sharename,       2, sharename,   "xx2-2 sharename");
        /* passing an invalid driver will result in WERR_UNKNOWN_PRINTER_DRIVER */
-       TEST_PRINTERINFO_STRING_EXP_ERR(q, s, 2, drivername,    2, drivername,  "xx2-2 drivername", WERR_UNKNOWN_PRINTER_DRIVER);
-       TEST_PRINTERINFO_STRING(q, s, 2, location,      2, location,    "xx2-2 location");
+       TEST_PRINTERINFO_STRING_EXP_ERR(q, s, needed, blob, 2, drivername,      2, drivername,  "xx2-2 drivername", WERR_UNKNOWN_PRINTER_DRIVER);
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 2, location,        2, location,    "xx2-2 location");
        /* passing an invalid sepfile will result in WERR_INVALID_SEPARATOR_FILE */
-       TEST_PRINTERINFO_STRING_EXP_ERR(q, s, 2, sepfile,       2, sepfile,     "xx2-2 sepfile", WERR_INVALID_SEPARATOR_FILE);
+       TEST_PRINTERINFO_STRING_EXP_ERR(q, s, needed, blob, 2, sepfile, 2, sepfile,     "xx2-2 sepfile", WERR_INVALID_SEPARATOR_FILE);
        /* passing an invalid printprocessor will result in WERR_UNKNOWN_PRINTPROCESSOR */
-       TEST_PRINTERINFO_STRING_EXP_ERR(q, s, 2, printprocessor, 2, printprocessor, "xx2-2 printprocessor", WERR_UNKNOWN_PRINTPROCESSOR);
-       TEST_PRINTERINFO_STRING(q, s, 2, datatype,      2, datatype,    "xx2-2 datatype");
-       TEST_PRINTERINFO_STRING(q, s, 2, parameters,    2, parameters,  "xx2-2 parameters");
+       TEST_PRINTERINFO_STRING_EXP_ERR(q, s, needed, blob, 2, printprocessor, 2, printprocessor, "xx2-2 printprocessor", WERR_UNKNOWN_PRINTPROCESSOR);
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 2, datatype,        2, datatype,    "xx2-2 datatype");
+       TEST_PRINTERINFO_STRING(q, s, needed, blob, 2, parameters,      2, parameters,  "xx2-2 parameters");
 
        for (i=0; i < ARRAY_SIZE(attribute_list); i++) {
-/*             TEST_PRINTERINFO_INT_EXP(q, s, 2, attributes, 1, flags,
+/*             TEST_PRINTERINFO_INT_EXP(q, s, needed, blob, 2, attributes, 1, flags,
                        attribute_list[i],
                        (attribute_list[i] | default_attribute)
                        ); */
-               TEST_PRINTERINFO_INT_EXP(q, s, 2, attributes, 2, attributes,
+               TEST_PRINTERINFO_INT_EXP(q, s, needed, blob, 2, attributes, 2, attributes,
                        attribute_list[i],
                        (attribute_list[i] | default_attribute)
                        );
-               TEST_PRINTERINFO_INT_EXP(q, s, 2, attributes, 4, attributes,
+               TEST_PRINTERINFO_INT_EXP(q, s, needed, blob, 2, attributes, 4, attributes,
                        attribute_list[i],
                        (attribute_list[i] | default_attribute)
                        );
-               TEST_PRINTERINFO_INT_EXP(q, s, 2, attributes, 5, attributes,
+               TEST_PRINTERINFO_INT_EXP(q, s, needed, blob, 2, attributes, 5, attributes,
                        attribute_list[i],
                        (attribute_list[i] | default_attribute)
                        );
-/*             TEST_PRINTERINFO_INT_EXP(q, s, 4, attributes, 1, flags,
+/*             TEST_PRINTERINFO_INT_EXP(q, s, needed, blob, 4, attributes, 1, flags,
                        attribute_list[i],
                        (attribute_list[i] | default_attribute)
                        ); */
-               TEST_PRINTERINFO_INT_EXP(q, s, 4, attributes, 2, attributes,
+               TEST_PRINTERINFO_INT_EXP(q, s, needed, blob, 4, attributes, 2, attributes,
                        attribute_list[i],
                        (attribute_list[i] | default_attribute)
                        );
-               TEST_PRINTERINFO_INT_EXP(q, s, 4, attributes, 4, attributes,
+               TEST_PRINTERINFO_INT_EXP(q, s, needed, blob, 4, attributes, 4, attributes,
                        attribute_list[i],
                        (attribute_list[i] | default_attribute)
                        );
-               TEST_PRINTERINFO_INT_EXP(q, s, 4, attributes, 5, attributes,
+               TEST_PRINTERINFO_INT_EXP(q, s, needed, blob, 4, attributes, 5, attributes,
                        attribute_list[i],
                        (attribute_list[i] | default_attribute)
                        );
-/*             TEST_PRINTERINFO_INT_EXP(q, s, 5, attributes, 1, flags,
+/*             TEST_PRINTERINFO_INT_EXP(q, s, needed, blob, 5, attributes, 1, flags,
                        attribute_list[i],
                        (attribute_list[i] | default_attribute)
                        ); */
-               TEST_PRINTERINFO_INT_EXP(q, s, 5, attributes, 2, attributes,
+               TEST_PRINTERINFO_INT_EXP(q, s, needed, blob, 5, attributes, 2, attributes,
                        attribute_list[i],
                        (attribute_list[i] | default_attribute)
                        );
-               TEST_PRINTERINFO_INT_EXP(q, s, 5, attributes, 4, attributes,
+               TEST_PRINTERINFO_INT_EXP(q, s, needed, blob, 5, attributes, 4, attributes,
                        attribute_list[i],
                        (attribute_list[i] | default_attribute)
                        );
-               TEST_PRINTERINFO_INT_EXP(q, s, 5, attributes, 5, attributes,
+               TEST_PRINTERINFO_INT_EXP(q, s, needed, blob, 5, attributes, 5, attributes,
                        attribute_list[i],
                        (attribute_list[i] | default_attribute)
                        );
@@ -1820,35 +1821,35 @@ static bool test_PrinterInfo(struct torture_context *tctx,
 
        for (i=0; i < ARRAY_SIZE(status_list); i++) {
                /* level 2 sets do not stick
-               TEST_PRINTERINFO_INT(q, s, 2, status,   0, status, status_list[i]);
-               TEST_PRINTERINFO_INT(q, s, 2, status,   2, status, status_list[i]);
-               TEST_PRINTERINFO_INT(q, s, 2, status,   6, status, status_list[i]); */
-               TEST_PRINTERINFO_INT(q, s, 6, status,   0, status, status_list[i]);
-               TEST_PRINTERINFO_INT(q, s, 6, status,   2, status, status_list[i]);
-               TEST_PRINTERINFO_INT(q, s, 6, status,   6, status, status_list[i]);
+               TEST_PRINTERINFO_INT(q, s, needed, blob, 2, status,     0, status, status_list[i]);
+               TEST_PRINTERINFO_INT(q, s, needed, blob, 2, status,     2, status, status_list[i]);
+               TEST_PRINTERINFO_INT(q, s, needed, blob, 2, status,     6, status, status_list[i]); */
+               TEST_PRINTERINFO_INT(q, s, needed, blob, 6, status,     0, status, status_list[i]);
+               TEST_PRINTERINFO_INT(q, s, needed, blob, 6, status,     2, status, status_list[i]);
+               TEST_PRINTERINFO_INT(q, s, needed, blob, 6, status,     6, status, status_list[i]);
        }
 
        /* priorities need to be between 0 and 99
           passing an invalid priority will result in WERR_INVALID_PRIORITY */
-       TEST_PRINTERINFO_INT(q, s, 2, priority, 2, priority, 0);
-       TEST_PRINTERINFO_INT(q, s, 2, priority, 2, priority, 1);
-       TEST_PRINTERINFO_INT(q, s, 2, priority, 2, priority, 99);
-       /* TEST_PRINTERINFO_INT(q, s, 2, priority,      2, priority, 100); */
-       TEST_PRINTERINFO_INT(q, s, 2, defaultpriority,2, defaultpriority, 0);
-       TEST_PRINTERINFO_INT(q, s, 2, defaultpriority,2, defaultpriority, 1);
-       TEST_PRINTERINFO_INT(q, s, 2, defaultpriority,2, defaultpriority, 99);
-       /* TEST_PRINTERINFO_INT(q, s, 2, defaultpriority,2, defaultpriority, 100); */
-
-       TEST_PRINTERINFO_INT(q, s, 2, starttime,        2, starttime, __LINE__);
-       TEST_PRINTERINFO_INT(q, s, 2, untiltime,        2, untiltime, __LINE__);
+       TEST_PRINTERINFO_INT(q, s, needed, blob, 2, priority,   2, priority, 0);
+       TEST_PRINTERINFO_INT(q, s, needed, blob, 2, priority,   2, priority, 1);
+       TEST_PRINTERINFO_INT(q, s, needed, blob, 2, priority,   2, priority, 99);
+       /* TEST_PRINTERINFO_INT(q, s, needed, blob, 2, priority,        2, priority, 100); */
+       TEST_PRINTERINFO_INT(q, s, needed, blob, 2, defaultpriority,2, defaultpriority, 0);
+       TEST_PRINTERINFO_INT(q, s, needed, blob, 2, defaultpriority,2, defaultpriority, 1);
+       TEST_PRINTERINFO_INT(q, s, needed, blob, 2, defaultpriority,2, defaultpriority, 99);
+       /* TEST_PRINTERINFO_INT(q, s, needed, blob, 2, defaultpriority,2, defaultpriority, 100); */
+
+       TEST_PRINTERINFO_INT(q, s, needed, blob, 2, starttime,  2, starttime, __LINE__);
+       TEST_PRINTERINFO_INT(q, s, needed, blob, 2, untiltime,  2, untiltime, __LINE__);
 
        /* does not stick
-       TEST_PRINTERINFO_INT(q, s, 2, cjobs,            2, cjobs, __LINE__);
-       TEST_PRINTERINFO_INT(q, s, 2, averageppm,       2, averageppm, __LINE__); */
+       TEST_PRINTERINFO_INT(q, s, needed, blob, 2, cjobs,              2, cjobs, __LINE__);
+       TEST_PRINTERINFO_INT(q, s, needed, blob, 2, averageppm, 2, averageppm, __LINE__); */
 
        /* does not stick
-       TEST_PRINTERINFO_INT(q, s, 5, device_not_selected_timeout, 5, device_not_selected_timeout, __LINE__);
-       TEST_PRINTERINFO_INT(q, s, 5, transmission_retry_timeout, 5, transmission_retry_timeout, __LINE__); */
+       TEST_PRINTERINFO_INT(q, s, needed, blob, 5, device_not_selected_timeout, 5, device_not_selected_timeout, __LINE__);
+       TEST_PRINTERINFO_INT(q, s, needed, blob, 5, transmission_retry_timeout, 5, transmission_retry_timeout, __LINE__); */
 
        /* FIXME: gd also test devmode and secdesc behavior */
 
@@ -1858,12 +1859,12 @@ static bool test_PrinterInfo(struct torture_context *tctx,
                const char *tmp;
 
                q0.in.level = 1;
-               do { TESTGETCALL(GetPrinter, q0) } while (0);
+               do { TESTGETCALL(GetPrinter, q0, needed, blob) } while (0);
 
                description = talloc_strdup(tctx, q0.out.info->info1.description);
 
                q0.in.level = 2;
-               do { TESTGETCALL(GetPrinter, q0) } while (0);
+               do { TESTGETCALL(GetPrinter, q0, needed, blob) } while (0);
 
                tmp = talloc_asprintf(tctx, "%s,%s,%s",
                        q0.out.info->info2.printername,
@@ -2191,14 +2192,15 @@ static bool test_devicemode_full(struct torture_context *tctx,
        union spoolss_PrinterInfo info;
        struct spoolss_DevmodeContainer devmode_ctr;
        struct sec_desc_buf secdesc_ctr;
-       uint32_t needed;
+       uint32_t needed = 0;
+       DATA_BLOB blob = data_blob_null;
        bool ret = true;
        NTSTATUS status;
 
-#define TEST_DEVMODE_INT_EXP_RESULT(q, s, lvl1, field1, lvl2, field2, value, exp_value, expected_result) do { \
+#define TEST_DEVMODE_INT_EXP_RESULT(q, s, needed, blob, lvl1, field1, lvl2, field2, value, exp_value, expected_result) do { \
                torture_comment(tctx, "field test %d/%s vs %d/%s\n", lvl1, #field1, lvl2, #field2); \
                q.in.level = lvl1; \
-               TESTGETCALL(GetPrinter, q) \
+               TESTGETCALL(GetPrinter, q, needed, blob) \
                info_ctr.level = lvl1; \
                if (lvl1 == 2) {\
                        void *p = (void *)&q.out.info->info ## lvl1; \
@@ -2210,20 +2212,20 @@ static bool test_devicemode_full(struct torture_context *tctx,
                devmode_ctr.devmode->field1 = value; \
                TESTSETCALL_EXP(SetPrinter, s, expected_result) \
                if (W_ERROR_IS_OK(expected_result)) { \
-                       TESTGETCALL(GetPrinter, q) \
+                       TESTGETCALL(GetPrinter, q, needed, blob) \
                        INT_EQUAL(q.out.info->info ## lvl1.devmode->field1, exp_value, field1); \
                        q.in.level = lvl2; \
-                       TESTGETCALL(GetPrinter, q) \
+                       TESTGETCALL(GetPrinter, q, needed, blob) \
                        INT_EQUAL(q.out.info->info ## lvl2.devmode->field2, exp_value, field1); \
                }\
        } while (0)
 
-#define TEST_DEVMODE_INT_EXP(q, s, lvl1, field1, lvl2, field2, value, expected_result) do { \
-        TEST_DEVMODE_INT_EXP_RESULT(q, s, lvl1, field1, lvl2, field2, value, value, expected_result); \
+#define TEST_DEVMODE_INT_EXP(q, s, needed, blob, lvl1, field1, lvl2, field2, value, expected_result) do { \
+        TEST_DEVMODE_INT_EXP_RESULT(q, s, needed, blob, lvl1, field1, lvl2, field2, value, value, expected_result); \
         } while (0)
 
-#define TEST_DEVMODE_INT(q, s, lvl1, field1, lvl2, field2, value) do { \
-        TEST_DEVMODE_INT_EXP_RESULT(q, s, lvl1, field1, lvl2, field2, value, value, WERR_OK); \
+#define TEST_DEVMODE_INT(q, s, needed, blob, lvl1, field1, lvl2, field2, value) do { \
+        TEST_DEVMODE_INT_EXP_RESULT(q, s, needed, blob, lvl1, field1, lvl2, field2, value, value, WERR_OK); \
         } while (0)
 
        ZERO_STRUCT(devmode_ctr);
@@ -2246,50 +2248,50 @@ static bool test_devicemode_full(struct torture_context *tctx,
        uint16_t __driverextra_length;/* [value(r->driverextra_data.length)] */
        uint32_t fields;
 #endif
-       TEST_DEVMODE_INT_EXP(q, s, 8, size,             8, size, __LINE__, WERR_INVALID_PARAMETER);
-       TEST_DEVMODE_INT_EXP(q, s, 8, size,             8, size, 0, WERR_INVALID_PARAMETER);
-       TEST_DEVMODE_INT_EXP(q, s, 8, size,             8, size, 0xffff, WERR_INVALID_PARAMETER);
-       TEST_DEVMODE_INT_EXP(q, s, 8, size,             8, size, ndr_size_spoolss_DeviceMode(devmode_ctr.devmode, 0), (devmode_ctr.devmode->__driverextra_length > 0 ) ? WERR_INVALID_PARAMETER : WERR_OK);
-       TEST_DEVMODE_INT(q, s, 8, size,         8, size, ndr_size_spoolss_DeviceMode(devmode_ctr.devmode, 0) - devmode_ctr.devmode->__driverextra_length);
+       TEST_DEVMODE_INT_EXP(q, s, needed, blob, 8, size,               8, size, __LINE__, WERR_INVALID_PARAMETER);
+       TEST_DEVMODE_INT_EXP(q, s, needed, blob, 8, size,               8, size, 0, WERR_INVALID_PARAMETER);
+       TEST_DEVMODE_INT_EXP(q, s, needed, blob, 8, size,               8, size, 0xffff, WERR_INVALID_PARAMETER);
+       TEST_DEVMODE_INT_EXP(q, s, needed, blob, 8, size,               8, size, ndr_size_spoolss_DeviceMode(devmode_ctr.devmode, 0), (devmode_ctr.devmode->__driverextra_length > 0 ) ? WERR_INVALID_PARAMETER : WERR_OK);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, size,           8, size, ndr_size_spoolss_DeviceMode(devmode_ctr.devmode, 0) - devmode_ctr.devmode->__driverextra_length);
 
        devmode_ctr.devmode->driverextra_data = data_blob_string_const("foobar");
        torture_assert(tctx,
                test_devmode_set_level(tctx, b, handle, 8, devmode_ctr.devmode),
                "failed to set devmode");
 
-       TEST_DEVMODE_INT_EXP(q, s, 8, size,             8, size, ndr_size_spoolss_DeviceMode(devmode_ctr.devmode, 0), (devmode_ctr.devmode->__driverextra_length > 0 ) ? WERR_INVALID_PARAMETER : WERR_OK);
-       TEST_DEVMODE_INT(q, s, 8, size,         8, size, ndr_size_spoolss_DeviceMode(devmode_ctr.devmode, 0) - devmode_ctr.devmode->__driverextra_length);
-
-       TEST_DEVMODE_INT(q, s, 8, orientation,  8, orientation, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, papersize,            8, papersize, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, paperlength,  8, paperlength, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, paperwidth,           8, paperwidth, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, scale,                8, scale, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, copies,               8, copies, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, defaultsource,        8, defaultsource, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, printquality, 8, printquality, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, color,                8, color, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, duplex,               8, duplex, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, yresolution,  8, yresolution, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, ttoption,             8, ttoption, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, collate,              8, collate, __LINE__);
+       TEST_DEVMODE_INT_EXP(q, s, needed, blob, 8, size,               8, size, ndr_size_spoolss_DeviceMode(devmode_ctr.devmode, 0), (devmode_ctr.devmode->__driverextra_length > 0 ) ? WERR_INVALID_PARAMETER : WERR_OK);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, size,           8, size, ndr_size_spoolss_DeviceMode(devmode_ctr.devmode, 0) - devmode_ctr.devmode->__driverextra_length);
+
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, orientation,    8, orientation, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, papersize,              8, papersize, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, paperlength,    8, paperlength, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, paperwidth,             8, paperwidth, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, scale,          8, scale, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, copies,         8, copies, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, defaultsource,  8, defaultsource, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, printquality,   8, printquality, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, color,          8, color, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, duplex,         8, duplex, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, yresolution,    8, yresolution, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, ttoption,               8, ttoption, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, collate,                8, collate, __LINE__);
 #if 0
        const char *formname;/* [charset(UTF16)] */
 #endif
-       TEST_DEVMODE_INT(q, s, 8, logpixels,            8, logpixels, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, bitsperpel,           8, bitsperpel, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, pelswidth,            8, pelswidth, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, pelsheight,           8, pelsheight, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, displayflags, 8, displayflags, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, displayfrequency,     8, displayfrequency, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, icmmethod,            8, icmmethod, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, icmintent,            8, icmintent, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, mediatype,            8, mediatype, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, dithertype,           8, dithertype, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, reserved1,            8, reserved1, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, reserved2,            8, reserved2, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, panningwidth, 8, panningwidth, __LINE__);
-       TEST_DEVMODE_INT(q, s, 8, panningheight,        8, panningheight, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, logpixels,              8, logpixels, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, bitsperpel,             8, bitsperpel, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, pelswidth,              8, pelswidth, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, pelsheight,             8, pelsheight, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, displayflags,   8, displayflags, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, displayfrequency,       8, displayfrequency, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, icmmethod,              8, icmmethod, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, icmintent,              8, icmintent, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, mediatype,              8, mediatype, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, dithertype,             8, dithertype, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, reserved1,              8, reserved1, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, reserved2,              8, reserved2, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, panningwidth,   8, panningwidth, __LINE__);
+       TEST_DEVMODE_INT(q, s, needed, blob, 8, panningheight,  8, panningheight, __LINE__);
 
        return ret;
 }