summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-06-30 13:11:16 +0200
committerGünther Deschner <gd@samba.org>2009-06-30 13:34:41 +0200
commite7d72b585a09f6b43df0f38ff20c74050069fb60 (patch)
tree3042edafa3057088183689796345085983fdf162 /source4/torture/rpc
parent66780e016b13db8b88eb209f568aedac6e6cf740 (diff)
downloadsamba-e7d72b585a09f6b43df0f38ff20c74050069fb60.tar.gz
samba-e7d72b585a09f6b43df0f38ff20c74050069fb60.tar.bz2
samba-e7d72b585a09f6b43df0f38ff20c74050069fb60.zip
s4-smbtorture: Test for newly added form with enum call in RPC-SPOOLSS.
Guenther
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/spoolss.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index ad86df6baa..1c4b8ed0d0 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -5,6 +5,7 @@
Copyright (C) Tim Potter 2003
Copyright (C) Stefan Metzmacher 2005
Copyright (C) Jelmer Vernooij 2007
+ Copyright (C) Guenther Deschner 2009
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1003,6 +1004,50 @@ static bool test_AddForm(struct torture_context *tctx,
if (!print_server) ret &= test_GetForm(tctx, p, handle, form_name, 1);
+ {
+ struct spoolss_EnumForms e;
+ union spoolss_FormInfo *info;
+ uint32_t needed;
+ uint32_t count;
+ bool found = false;
+
+ e.in.handle = handle;
+ e.in.level = 1;
+ e.in.buffer = NULL;
+ e.in.offered = 0;
+ e.out.needed = &needed;
+ e.out.count = &count;
+ e.out.info = &info;
+
+ torture_comment(tctx, "Testing EnumForms level 1\n");
+
+ status = dcerpc_spoolss_EnumForms(p, tctx, &e);
+ torture_assert_ntstatus_ok(tctx, status, "EnumForms failed");
+
+ if (print_server && W_ERROR_EQUAL(e.out.result, WERR_BADFID))
+ torture_fail(tctx, "EnumForms on the PrintServer isn't supported by test server (NT4)");
+
+ if (W_ERROR_EQUAL(e.out.result, WERR_INSUFFICIENT_BUFFER)) {
+ int j;
+ DATA_BLOB blob = data_blob_talloc(tctx, NULL, needed);
+ data_blob_clear(&blob);
+ e.in.buffer = &blob;
+ e.in.offered = needed;
+
+ status = dcerpc_spoolss_EnumForms(p, tctx, &e);
+
+ torture_assert(tctx, info, "No forms returned");
+
+ for (j = 0; j < count; j++) {
+ if (strequal(form_name, info[j].info1.form_name)) {
+ found = true;
+ break;
+ }
+ }
+ }
+ torture_assert(tctx, found, "Newly added form not found in enum call");
+ }
+
if (!test_DeleteForm(tctx, p, handle, form_name)) {
ret = false;
}