The branch, master has been updated
via 57ff5a33e9f s4:torture: Fix stack variable used out of scope in
test_devicemode_full()
via e3c9bea002d s4:torture: Pass the dcerpc struct 's' for SetPrinter
down to the macro
via 34ae731b89f s4:torture: Pass the dcerpc struct 'q' for GetPrinter
down to the macro
via 0dc5f807690 s4:torture: Fix stack variable used out of scope in
test_devmode_set_level()
from 5c25e262e7d tests: add a Python test for case insensitive access
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 57ff5a33e9f4f1ff9677e44e75005e713b0a5607
Author: Andreas Schneider <[email protected]>
Date: Fri Dec 2 09:44:58 2022 +0100
s4:torture: Fix stack variable used out of scope in test_devicemode_full()
==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 <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
Autobuild-User(master): Jeremy Allison <[email protected]>
Autobuild-Date(master): Tue Dec 20 06:55:45 UTC 2022 on sn-devel-184
commit e3c9bea002d6ea94bcd4dd37670f07f7e4098aff
Author: Andreas Schneider <[email protected]>
Date: Fri Dec 2 10:44:16 2022 +0100
s4:torture: Pass the dcerpc struct 's' for SetPrinter down to the macro
Signed-off-by: Andreas Schneider <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 34ae731b89f79998b6f3c21965d35b41e4e513da
Author: Andreas Schneider <[email protected]>
Date: Fri Dec 2 09:44:58 2022 +0100
s4:torture: Pass the dcerpc struct 'q' for GetPrinter down to the macro
Signed-off-by: Andreas Schneider <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 0dc5f807690baae002f5c35c920663cc6c3617e0
Author: Andreas Schneider <[email protected]>
Date: Thu Dec 1 10:32:00 2022 +0100
s4:torture: Fix stack variable used out of scope in test_devmode_set_level()
==12122==ERROR: AddressSanitizer: stack-use-after-scope on address
0x7fff494dd900 at pc 0x7fdaebea71e3 bp 0x7fff494dd430 sp 0x7fff494dd428
READ of size 4 at 0x7fff494dd900 thread T0
#0 0x7fdaebea71e2 in ndr_push_spoolss_SetPrinterInfo8
librpc/gen_ndr/ndr_spoolss.c:8618
#1 0x7fdaebea71e2 in ndr_push_spoolss_SetPrinterInfo
librpc/gen_ndr/ndr_spoolss.c:8796
#2 0x7fdaebea7482 in ndr_push_spoolss_SetPrinterInfoCtr
librpc/gen_ndr/ndr_spoolss.c:9163
#3 0x7fdaebea7580 in ndr_push_spoolss_SetPrinter
librpc/gen_ndr/ndr_spoolss.c:27000
#4 0x7fdaee3e1b30 in dcerpc_binding_handle_call_send
../../librpc/rpc/binding_handle.c:416
#5 0x7fdaee3e2132 in dcerpc_binding_handle_call
../../librpc/rpc/binding_handle.c:553
#6 0x7fdaecb103fd in dcerpc_spoolss_SetPrinter_r
librpc/gen_ndr/ndr_spoolss_c.c:1722
#7 0x559a7294c2f1 in test_SetPrinter
../../source4/torture/rpc/spoolss.c:1293
#8 0x559a7297b4d4 in test_devmode_set_level
../../source4/torture/rpc/spoolss.c:2126
#9 0x559a7299cfa1 in test_PrinterInfo_DevModes
../../source4/torture/rpc/spoolss.c:2344
#10 0x559a7299cfa1 in test_PrinterInfo_DevMode
../../source4/torture/rpc/spoolss.c:2489
#11 0x559a7299cfa1 in test_printer_dm
../../source4/torture/rpc/spoolss.c:9083
#12 0x7fdaeda9867d in wrap_test_with_simple_test
../../lib/torture/torture.c:808
#13 0x7fdaeda9a40b in internal_torture_run_test
../../lib/torture/torture.c:516
#14 0x7fdaeda9a87c in torture_run_tcase_restricted
../../lib/torture/torture.c:581
#15 0x7fdaeda9aeb2 in torture_run_suite_restricted
../../lib/torture/torture.c:435
#16 0x559a72b51668 in run_matching ../../source4/torture/smbtorture.c:95
#17 0x559a72b516ef in run_matching
../../source4/torture/smbtorture.c:105
#18 0x559a72b516ef in run_matching
../../source4/torture/smbtorture.c:105
#19 0x559a72b523ef in torture_run_named_tests
../../source4/torture/smbtorture.c:172
#20 0x559a72b563eb in main ../../source4/torture/smbtorture.c:750
#21 0x7fdaea42c5af in __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
#22 0x7fdaea42c678 in __libc_start_main_impl ../csu/libc-start.c:381
#23 0x559a72755824 in _start ../sysdeps/x86_64/start.S:115
Address 0x7fff494dd900 is located in stack of thread T0 at offset 32 in
frame
#0 0x559a7297b111 in test_devmode_set_level
../../source4/torture/rpc/spoolss.c:2090
Signed-off-by: Andreas Schneider <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
-----------------------------------------------------------------------
Summary of changes:
source4/torture/rpc/spoolss.c | 257 +++++++++++++++++++++---------------------
1 file changed, 129 insertions(+), 128 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index dd0d4587903..0c71ed0073b 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -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,149 +1671,149 @@ static bool test_PrinterInfo(struct torture_context
*tctx,
break; \
}
-#define TEST_PRINTERINFO_STRING_EXP_ERR(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(lvl1, field1, lvl2, field2, value) do { \
- TEST_PRINTERINFO_STRING_EXP_ERR(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(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(lvl1, field1, lvl2, field2, value) do { \
- TEST_PRINTERINFO_INT_EXP(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(2, comment, 1, comment, "xx2-1 comment");
- TEST_PRINTERINFO_STRING(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(2, printername, 0, printername, "xx2-0
printer"); */
- TEST_PRINTERINFO_STRING(2, printername, 1, name, "xx2-1
printer");
- TEST_PRINTERINFO_STRING(2, printername, 2, printername, "xx2-2
printer");
- TEST_PRINTERINFO_STRING(2, printername, 4, printername, "xx2-4
printer");
- TEST_PRINTERINFO_STRING(2, printername, 5, printername, "xx2-5
printer");
-/* TEST_PRINTERINFO_STRING(4, printername, 0, printername, "xx4-0
printer"); */
- TEST_PRINTERINFO_STRING(4, printername, 1, name, "xx4-1
printer");
- TEST_PRINTERINFO_STRING(4, printername, 2, printername, "xx4-2
printer");
- TEST_PRINTERINFO_STRING(4, printername, 4, printername, "xx4-4
printer");
- TEST_PRINTERINFO_STRING(4, printername, 5, printername, "xx4-5
printer");
-/* TEST_PRINTERINFO_STRING(5, printername, 0, printername, "xx5-0
printer"); */
- TEST_PRINTERINFO_STRING(5, printername, 1, name, "xx5-1
printer");
- TEST_PRINTERINFO_STRING(5, printername, 2, printername, "xx5-2
printer");
- TEST_PRINTERINFO_STRING(5, printername, 4, printername, "xx5-4
printer");
- TEST_PRINTERINFO_STRING(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(2, servername, 0, servername, "xx2-0
servername");
- TEST_PRINTERINFO_STRING(2, servername, 2, servername, "xx2-2
servername");
- TEST_PRINTERINFO_STRING(2, servername, 4, servername, "xx2-4
servername");
+ TEST_PRINTERINFO_STRING(q, 2, servername, 0, servername, "xx2-0
servername");
+ TEST_PRINTERINFO_STRING(q, 2, servername, 2, servername, "xx2-2
servername");
+ TEST_PRINTERINFO_STRING(q, 2, servername, 4, servername, "xx2-4
servername");
*/
/* passing an invalid port will result in WERR_UNKNOWN_PORT */
- TEST_PRINTERINFO_STRING_EXP_ERR(2, portname, 2, portname, "xx2-2
portname", WERR_UNKNOWN_PORT);
- TEST_PRINTERINFO_STRING_EXP_ERR(2, portname, 5, portname, "xx2-5
portname", WERR_UNKNOWN_PORT);
- TEST_PRINTERINFO_STRING_EXP_ERR(5, portname, 2, portname, "xx5-2
portname", WERR_UNKNOWN_PORT);
- TEST_PRINTERINFO_STRING_EXP_ERR(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(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(2, drivername, 2, drivername, "xx2-2
drivername", WERR_UNKNOWN_PRINTER_DRIVER);
- TEST_PRINTERINFO_STRING(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(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(2, printprocessor, 2, printprocessor,
"xx2-2 printprocessor", WERR_UNKNOWN_PRINTPROCESSOR);
- TEST_PRINTERINFO_STRING(2, datatype, 2, datatype, "xx2-2
datatype");
- TEST_PRINTERINFO_STRING(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(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(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(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(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(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(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(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(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(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(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(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(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(2, status, 0, status, status_list[i]);
- TEST_PRINTERINFO_INT(2, status, 2, status, status_list[i]);
- TEST_PRINTERINFO_INT(2, status, 6, status, status_list[i]); */
- TEST_PRINTERINFO_INT(6, status, 0, status, status_list[i]);
- TEST_PRINTERINFO_INT(6, status, 2, status, status_list[i]);
- TEST_PRINTERINFO_INT(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(2, priority, 2, priority, 0);
- TEST_PRINTERINFO_INT(2, priority, 2, priority, 1);
- TEST_PRINTERINFO_INT(2, priority, 2, priority, 99);
- /* TEST_PRINTERINFO_INT(2, priority, 2, priority, 100); */
- TEST_PRINTERINFO_INT(2, defaultpriority,2, defaultpriority, 0);
- TEST_PRINTERINFO_INT(2, defaultpriority,2, defaultpriority, 1);
- TEST_PRINTERINFO_INT(2, defaultpriority,2, defaultpriority, 99);
- /* TEST_PRINTERINFO_INT(2, defaultpriority,2, defaultpriority, 100); */
-
- TEST_PRINTERINFO_INT(2, starttime, 2, starttime, __LINE__);
- TEST_PRINTERINFO_INT(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(2, cjobs, 2, cjobs, __LINE__);
- TEST_PRINTERINFO_INT(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(5, device_not_selected_timeout, 5,
device_not_selected_timeout, __LINE__);
- TEST_PRINTERINFO_INT(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,
@@ -2088,6 +2089,7 @@ static bool test_devmode_set_level(struct torture_context
*tctx,
uint32_t level,
struct spoolss_DeviceMode *devmode)
{
+ struct spoolss_SetPrinterInfo8 info8;
struct spoolss_SetPrinterInfoCtr info_ctr;
struct spoolss_DevmodeContainer devmode_ctr;
struct sec_desc_buf secdesc_ctr;
@@ -2108,8 +2110,6 @@ static bool test_devmode_set_level(struct torture_context
*tctx,
break;
}
case 8: {
- struct spoolss_SetPrinterInfo8 info8;
-
info8.devmode_ptr = 0;
info_ctr.level = 8;
@@ -2192,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(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; \
@@ -2211,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(lvl1, field1, lvl2, field2, value,
expected_result) do { \
- TEST_DEVMODE_INT_EXP_RESULT(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(lvl1, field1, lvl2, field2, value) do { \
- TEST_DEVMODE_INT_EXP_RESULT(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);
@@ -2247,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(8, size, 8, size, __LINE__,
WERR_INVALID_PARAMETER);
- TEST_DEVMODE_INT_EXP(8, size, 8, size, 0,
WERR_INVALID_PARAMETER);
- TEST_DEVMODE_INT_EXP(8, size, 8, size, 0xffff,
WERR_INVALID_PARAMETER);
- TEST_DEVMODE_INT_EXP(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(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(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(8, size, 8, size,
ndr_size_spoolss_DeviceMode(devmode_ctr.devmode, 0) -
devmode_ctr.devmode->__driverextra_length);
-
- TEST_DEVMODE_INT(8, orientation, 8, orientation, __LINE__);
- TEST_DEVMODE_INT(8, papersize, 8, papersize, __LINE__);
- TEST_DEVMODE_INT(8, paperlength, 8, paperlength, __LINE__);
- TEST_DEVMODE_INT(8, paperwidth, 8, paperwidth, __LINE__);
- TEST_DEVMODE_INT(8, scale, 8, scale, __LINE__);
- TEST_DEVMODE_INT(8, copies, 8, copies, __LINE__);
- TEST_DEVMODE_INT(8, defaultsource, 8, defaultsource, __LINE__);
- TEST_DEVMODE_INT(8, printquality, 8, printquality, __LINE__);
- TEST_DEVMODE_INT(8, color, 8, color, __LINE__);
- TEST_DEVMODE_INT(8, duplex, 8, duplex, __LINE__);
- TEST_DEVMODE_INT(8, yresolution, 8, yresolution, __LINE__);
- TEST_DEVMODE_INT(8, ttoption, 8, ttoption, __LINE__);
- TEST_DEVMODE_INT(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(8, logpixels, 8, logpixels, __LINE__);
- TEST_DEVMODE_INT(8, bitsperpel, 8, bitsperpel, __LINE__);
- TEST_DEVMODE_INT(8, pelswidth, 8, pelswidth, __LINE__);
- TEST_DEVMODE_INT(8, pelsheight, 8, pelsheight, __LINE__);
- TEST_DEVMODE_INT(8, displayflags, 8, displayflags, __LINE__);
- TEST_DEVMODE_INT(8, displayfrequency, 8, displayfrequency, __LINE__);
- TEST_DEVMODE_INT(8, icmmethod, 8, icmmethod, __LINE__);
- TEST_DEVMODE_INT(8, icmintent, 8, icmintent, __LINE__);
- TEST_DEVMODE_INT(8, mediatype, 8, mediatype, __LINE__);
- TEST_DEVMODE_INT(8, dithertype, 8, dithertype, __LINE__);
- TEST_DEVMODE_INT(8, reserved1, 8, reserved1, __LINE__);
- TEST_DEVMODE_INT(8, reserved2, 8, reserved2, __LINE__);
- TEST_DEVMODE_INT(8, panningwidth, 8, panningwidth, __LINE__);
- TEST_DEVMODE_INT(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;
}
--
Samba Shared Repository