summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/torture/rpc/spoolss.c9
-rw-r--r--source4/torture/rpc/spoolss_win.c9
2 files changed, 15 insertions, 3 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index e341b71307..bd5c4555bd 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -3060,6 +3060,9 @@ bool test_printer_keys(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_EnumPrinterKey(p, tctx, &r),
"failed to call EnumPrinterKey");
if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) {
+ torture_assert(tctx, (key_buffer._ndr_size == 0),
+ talloc_asprintf(tctx, "EnumPrinterKey did not return 0 _ndr_size (but %d), windows clients would abort here!", key_buffer._ndr_size));
+
r.in.offered = needed;
torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_EnumPrinterKey(p, tctx, &r),
"failed to call EnumPrinterKey");
@@ -3067,10 +3070,14 @@ bool test_printer_keys(struct torture_context *tctx,
torture_assert_werr_ok(tctx, r.out.result,
"failed to call EnumPrinterKey");
+ torture_assert(tctx, (key_buffer._ndr_size * 2 == needed),
+ talloc_asprintf(tctx, "EnumPrinterKey size mismatch, _ndr_size %d (expected %d)",
+ key_buffer._ndr_size, needed/2));
+
key_array = key_buffer.string;
}
- for (i=0; key_array[i]; i++) {
+ for (i=0; key_array && key_array[i]; i++) {
struct spoolss_EnumPrinterDataEx r;
uint32_t count;
struct spoolss_PrinterEnumValues *info;
diff --git a/source4/torture/rpc/spoolss_win.c b/source4/torture/rpc/spoolss_win.c
index d2851cfea1..8856729adc 100644
--- a/source4/torture/rpc/spoolss_win.c
+++ b/source4/torture/rpc/spoolss_win.c
@@ -397,8 +397,9 @@ static bool test_EnumPrinterKey(struct torture_context *tctx,
status = dcerpc_spoolss_EnumPrinterKey(p, tctx, &epk);
torture_assert_ntstatus_ok(tctx, status, "EnumPrinterKey failed");
-
if (W_ERROR_EQUAL(epk.out.result, WERR_MORE_DATA)) {
+ torture_assert(tctx, (key_buffer._ndr_size == 0),
+ talloc_asprintf(tctx, "EnumPrinterKey did not return 0 _ndr_size (but %d), windows clients would abort here!", key_buffer._ndr_size));
epk.in.offered = needed;
status = dcerpc_spoolss_EnumPrinterKey(p, tctx, &epk);
torture_assert_ntstatus_ok(tctx, status,
@@ -407,6 +408,10 @@ static bool test_EnumPrinterKey(struct torture_context *tctx,
torture_assert_werr_ok(tctx, epk.out.result, "EnumPrinterKey failed");
+ torture_assert(tctx, (key_buffer._ndr_size * 2 == needed),
+ talloc_asprintf(tctx, "EnumPrinterKey size mismatch, _ndr_size %d (expected %d)",
+ key_buffer._ndr_size, needed/2));
+
ctx->printer_keys = key_buffer.string;
return true;
@@ -550,7 +555,7 @@ static bool test_WinXP(struct torture_context *tctx, struct dcerpc_pipe *p)
ret &= test_EnumPrinterKey(tctx, p, &handle03, "", ctx);
- for (i=0; ctx->printer_keys[i] != NULL; i++) {
+ for (i=0; ctx->printer_keys && ctx->printer_keys[i] != NULL; i++) {
ret &= test_EnumPrinterKey(tctx, p, &handle03,
ctx->printer_keys[i],