summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-12-09 15:31:51 +0100
committerKarolin Seeger <kseeger@samba.org>2009-12-23 12:08:01 +0100
commit1edc7e36c98a7ef896d7a9095282e41a63ab5c7b (patch)
treede63f8900fc32dfb7cc32f66b6ea7a35bce70872 /source4
parente9d5a70d67f4fcaccbe991af35d12d954d86cae4 (diff)
downloadsamba-1edc7e36c98a7ef896d7a9095282e41a63ab5c7b.tar.gz
s4-smbtorture: enhance spoolss_EnumPrinterKey torture test.
This demonstrates that s3 still does not have that call implemented correctly. Guenther (cherry picked from commit 532376914d0852ab599a6275910ab315935f37d0)
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/rpc/spoolss.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 6f9d7d23e41..3593ea70bd6 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -2002,6 +2002,59 @@ static bool test_EnumPrinterDrivers_old(struct torture_context *tctx,
return true;
}
+static bool test_EnumPrinterKey(struct torture_context *tctx,
+ struct dcerpc_pipe *p,
+ struct policy_handle *handle,
+ const char *key_name,
+ const char ***array)
+{
+ struct spoolss_EnumPrinterKey r;
+ uint32_t needed;
+ struct spoolss_StringArray2 key_buffer;
+ uint32_t offered[] = { 0, 512, 1024, 2048 };
+ int i;
+
+ r.in.handle = handle;
+ r.in.key_name = key_name;
+ r.out.key_buffer = &key_buffer;
+ r.out.needed = &needed;
+
+ for (i=0; i < ARRAY_SIZE(offered); i++) {
+ r.in.offered = offered[i];
+
+ torture_comment(tctx, "Testing EnumPrinterKey(%s) with %d offered\n", r.in.key_name, r.in.offered);
+
+ 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");
+ }
+ torture_assert_werr_ok(tctx, r.out.result,
+ "failed to call EnumPrinterKey");
+
+ torture_assert(tctx, (key_buffer._ndr_size * 2 == r.in.offered),
+ talloc_asprintf(tctx, "EnumPrinterKey size mismatch, _ndr_size %d (expected %d)",
+ key_buffer._ndr_size, r.in.offered/2));
+
+ torture_assert(tctx, (*r.out.needed <= r.in.offered),
+ talloc_asprintf(tctx, "EnumPrinterKey size mismatch: needed %d is not <= offered %d", *r.out.needed, r.in.offered));
+
+ torture_assert(tctx, (*r.out.needed <= key_buffer._ndr_size * 2),
+ talloc_asprintf(tctx, "EnumPrinterKey size mismatch: needed %d is not <= _ndr_size %d * 2", *r.out.needed, key_buffer._ndr_size));
+
+ }
+
+ if (array) {
+ *array = key_buffer.string;
+ }
+
+ return true;
+}
+
bool test_printer_keys(struct torture_context *tctx,
struct dcerpc_pipe *p,
struct policy_handle *handle)