From fe94ba6e71eb8d3273d593763f6b6d03fa90113d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 1 Jul 2005 09:05:10 +0000 Subject: r8046: - add somemore failure checks in the RPC-SPOOLSS test - test AddForm on the PrintServer object - GetForm() isn't allowed on the PrintServer object so remove NTPTR function for it - accept the dns name as servername in the spoolss server metze (This used to be commit d8c308a4653d59514915021607fe55c5f2b38749) --- source4/torture/rpc/spoolss.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'source4/torture/rpc/spoolss.c') diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index f7bb454335..fcbec4e561 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -838,6 +838,17 @@ static BOOL test_GetForm(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.in.buffer = &blob; r.in.offered = r.out.needed; status = dcerpc_spoolss_GetForm(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("GetForm failed - %s\n", + nt_errstr(status)); + return False; + } + + if (!W_ERROR_IS_OK(r.out.result)) { + printf("GetForm failed - %s\n", + win_errstr(r.out.result)); + return False; + } if (!r.out.info) { printf("No form info returned\n"); @@ -845,6 +856,13 @@ static BOOL test_GetForm(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } } + + if (!W_ERROR_IS_OK(r.out.result)) { + printf("GetForm failed - %s\n", + win_errstr(r.out.result)); + return False; + } + return True; } @@ -853,6 +871,7 @@ static BOOL test_EnumForms(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, { NTSTATUS status; struct spoolss_EnumForms r; + BOOL ret = True; r.in.handle = handle; r.in.level = 1; @@ -890,7 +909,7 @@ static BOOL test_EnumForms(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, info = r.out.info; for (j = 0; j < r.out.count; j++) { - test_GetForm(p, mem_ctx, handle, info[j].info1.form_name); + if (!print_server) ret &= test_GetForm(p, mem_ctx, handle, info[j].info1.form_name); } } @@ -933,7 +952,7 @@ static BOOL test_DeleteForm(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } static BOOL test_AddForm(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, - struct policy_handle *handle) + struct policy_handle *handle, BOOL print_server) { struct spoolss_AddForm r; struct spoolss_AddFormInfo1 addform; @@ -961,10 +980,12 @@ static BOOL test_AddForm(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } if (!W_ERROR_IS_OK(r.out.result)) { - printf("AddForm failed - %s\n", nt_errstr(status)); + printf("AddForm failed - %s\n", win_errstr(r.out.result)); goto done; } + if (!print_server) ret &= test_GetForm(p, mem_ctx, handle, form_name); + { struct spoolss_SetForm sf; struct spoolss_AddFormInfo1 setform; @@ -996,6 +1017,8 @@ static BOOL test_AddForm(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } } + if (!print_server) ret &= test_GetForm(p, mem_ctx, handle, form_name); + done: if (!test_DeleteForm(p, mem_ctx, handle, form_name)) { printf("DeleteForm failed\n"); @@ -1821,7 +1844,7 @@ static BOOL test_OpenPrinterEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } - if (!test_AddForm(p, mem_ctx, &handle)) { + if (!test_AddForm(p, mem_ctx, &handle, False)) { ret = False; } @@ -2074,6 +2097,8 @@ BOOL torture_rpc_spoolss(void) ret &= test_EnumForms(ctx->p, ctx, &ctx->server_handle, True); + ret &= test_AddForm(ctx->p, ctx, &ctx->server_handle, True); + ret &= test_EnumPorts(ctx); ret &= test_GetPrinterDriverDirectory(ctx); -- cgit