From bf48b6e69a638dc78ab119424e27adc0ccc6c610 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 17 Nov 2003 03:38:13 +0000 Subject: added OpenPrinter and a test function. Note that the Samba3 structure for OpenPrinter was wrong. (This used to be commit 186ddbbf8774d0960852ea9186c8e4e6f7be7a0f) --- source4/torture/rpc/spoolss.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'source4/torture/rpc') diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index 13e2b2642f..0f104491b6 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -21,6 +21,35 @@ #include "includes.h" +static BOOL test_OpenPrinter(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct spoolss_PrinterInfo1 *info1) +{ + NTSTATUS status; + struct spoolss_OpenPrinter r; + struct policy_handle handle; + DATA_BLOB blob; + + blob = data_blob(NULL, 0); + + r.in.server = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); + r.in.printer = info1->name; + r.in.buffer = &blob; + r.in.access_mask = SEC_RIGHT_MAXIMUM_ALLOWED; + r.out.handle = &handle; + + printf("Testing OpenPrinter(\\\\%s\\%s)\n", r.in.server, r.in.printer); + + status = dcerpc_spoolss_OpenPrinter(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) { + printf("OpenPrinter failed - %s/%s\n", + nt_errstr(status), win_errstr(r.out.result)); + return False; + } + + + return True; +} + static BOOL test_EnumPrinters(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { struct spoolss_EnumPrinters r; @@ -74,6 +103,13 @@ static BOOL test_EnumPrinters(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) printf("Printer %d\n", j); NDR_PRINT_UNION_DEBUG(spoolss_PrinterEnum, r.in.level, &info[j]); } + + for (j=0;j