summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-12-02 23:38:05 +0100
committerGünther Deschner <gd@samba.org>2009-12-03 01:04:02 +0100
commit450211b61016a4fed71eb116c1b526af0f365f13 (patch)
tree1c1c114d85ae076d877befa091256d4e5d028ad8 /source4/torture/rpc
parentf32ccc321a5467401781a0e2d4621175b6256368 (diff)
downloadsamba-450211b61016a4fed71eb116c1b526af0f365f13.tar.gz
samba-450211b61016a4fed71eb116c1b526af0f365f13.tar.bz2
samba-450211b61016a4fed71eb116c1b526af0f365f13.zip
s4-smbtorture: be very strict in checking spools_EnumPrinterKey results.
Guenther
Diffstat (limited to 'source4/torture/rpc')
-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],