diff options
author | Günther Deschner <gd@samba.org> | 2009-02-25 21:10:44 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-02-25 21:17:19 +0100 |
commit | 6cd30a351a13822a557f20de3abe04bd8b2e3112 (patch) | |
tree | d00c84b8a7821e6a439484810c1fbd1a3f267917 /source4/torture | |
parent | 666cc916ebea618fbf7bfed99dbfff38326189fa (diff) | |
download | samba-6cd30a351a13822a557f20de3abe04bd8b2e3112.tar.gz samba-6cd30a351a13822a557f20de3abe04bd8b2e3112.tar.bz2 samba-6cd30a351a13822a557f20de3abe04bd8b2e3112.zip |
s4-smbtorture: expand RPC-SPOOLSS enumform and getform tests for level 2 forms.
Guenther
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/rpc/spoolss.c | 74 |
1 files changed, 42 insertions, 32 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index f8a66e7753..04c9768ea8 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -742,7 +742,8 @@ static bool test_ClosePrinter(struct torture_context *tctx, static bool test_GetForm(struct torture_context *tctx, struct dcerpc_pipe *p, struct policy_handle *handle, - const char *form_name) + const char *form_name, + uint32_t level) { NTSTATUS status; struct spoolss_GetForm r; @@ -750,12 +751,12 @@ static bool test_GetForm(struct torture_context *tctx, r.in.handle = handle; r.in.form_name = form_name; - r.in.level = 1; + r.in.level = level; r.in.buffer = NULL; r.in.offered = 0; r.out.needed = &needed; - torture_comment(tctx, "Testing GetForm\n"); + torture_comment(tctx, "Testing GetForm level %d\n", r.in.level); status = dcerpc_spoolss_GetForm(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "GetForm failed"); @@ -787,45 +788,54 @@ static bool test_EnumForms(struct torture_context *tctx, bool ret = true; uint32_t needed; uint32_t count; + uint32_t levels[] = { 1, 2 }; + int i; - r.in.handle = handle; - r.in.level = 1; - r.in.buffer = NULL; - r.in.offered = 0; - r.out.needed = &needed; - r.out.count = &count; + for (i=0; i<ARRAY_SIZE(levels); i++) { - torture_comment(tctx, "Testing EnumForms\n"); + r.in.handle = handle; + r.in.level = levels[i]; + r.in.buffer = NULL; + r.in.offered = 0; + r.out.needed = &needed; + r.out.count = &count; - status = dcerpc_spoolss_EnumForms(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, "EnumForms failed"); + torture_comment(tctx, "Testing EnumForms level %d\n", levels[i]); - if (print_server && W_ERROR_EQUAL(r.out.result, WERR_BADFID)) - torture_fail(tctx, "EnumForms on the PrintServer isn't supported by test server (NT4)"); + status = dcerpc_spoolss_EnumForms(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, "EnumForms failed"); - if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) { - union spoolss_FormInfo *info; - int j; - DATA_BLOB blob = data_blob_talloc(tctx, NULL, needed); - data_blob_clear(&blob); - r.in.buffer = &blob; - r.in.offered = needed; + if ((r.in.level == 2) && (W_ERROR_EQUAL(r.out.result, WERR_UNKNOWN_LEVEL))) { + break; + } - status = dcerpc_spoolss_EnumForms(p, tctx, &r); + if (print_server && W_ERROR_EQUAL(r.out.result, WERR_BADFID)) + torture_fail(tctx, "EnumForms on the PrintServer isn't supported by test server (NT4)"); + + if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) { + union spoolss_FormInfo *info; + int j; + DATA_BLOB blob = data_blob_talloc(tctx, NULL, needed); + data_blob_clear(&blob); + r.in.buffer = &blob; + r.in.offered = needed; - torture_assert(tctx, r.out.info, "No forms returned"); + status = dcerpc_spoolss_EnumForms(p, tctx, &r); - info = r.out.info; + torture_assert(tctx, r.out.info, "No forms returned"); - for (j = 0; j < count; j++) { - if (!print_server) - ret &= test_GetForm(tctx, p, handle, info[j].info1.form_name); + info = r.out.info; + + for (j = 0; j < count; j++) { + if (!print_server) + ret &= test_GetForm(tctx, p, handle, info[j].info1.form_name, levels[i]); + } } - } - torture_assert_ntstatus_ok(tctx, status, "EnumForms failed"); + torture_assert_ntstatus_ok(tctx, status, "EnumForms failed"); - torture_assert_werr_ok(tctx, r.out.result, "EnumForms failed"); + torture_assert_werr_ok(tctx, r.out.result, "EnumForms failed"); + } return true; } @@ -878,7 +888,7 @@ static bool test_AddForm(struct torture_context *tctx, torture_assert_werr_ok(tctx, r.out.result, "AddForm failed"); - if (!print_server) ret &= test_GetForm(tctx, p, handle, form_name); + if (!print_server) ret &= test_GetForm(tctx, p, handle, form_name, 1); { struct spoolss_SetForm sf; @@ -902,7 +912,7 @@ static bool test_AddForm(struct torture_context *tctx, torture_assert_werr_ok(tctx, r.out.result, "SetForm failed"); } - if (!print_server) ret &= test_GetForm(tctx, p, handle, form_name); + if (!print_server) ret &= test_GetForm(tctx, p, handle, form_name, 1); if (!test_DeleteForm(tctx, p, handle, form_name)) { ret = false; |