From 056d63c62f3793fda0d3049a2f98cef435c9003e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 14 Jun 2005 18:44:22 +0000 Subject: r7580: - add GetPrinterDriverDirectory() idl, torture test and server code - add EnumMonitors() server code and return "Standard TCP/IP Port" - add parsing for opening Ports and Monitors with OpenPrinterEx() metze (This used to be commit 08e6de37bc293e2f000d03b51642964d92d6e95e) --- source4/torture/rpc/spoolss.c | 84 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 79 insertions(+), 5 deletions(-) (limited to 'source4/torture/rpc/spoolss.c') diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index 7ae9291cf0..86a8c7155f 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -211,6 +211,78 @@ static BOOL test_EnumPorts(struct test_spoolss_context *ctx) return True; } +static BOOL test_GetPrinterDriverDirectory(struct test_spoolss_context *ctx) +{ + NTSTATUS status; + struct spoolss_GetPrinterDriverDirectory r; + struct { + uint16_t level; + const char *server; + } levels[] = {{ + .level = 1, + .server = "" + },{ + .level = 78, + .server = "" + },{ + .level = 1, + .server = talloc_asprintf(ctx, "\\\\%s", dcerpc_server_name(ctx->p)) + },{ + .level = 1024, + .server = talloc_asprintf(ctx, "\\\\%s", dcerpc_server_name(ctx->p)) + } + }; + int i; + BOOL ret = True; + + for (i=0;ip, ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("dcerpc_spoolss_GetPrinterDriverDirectory failed - %s\n", nt_errstr(status)); + ret = False; + continue; + } + if (!W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) { + printf("GetPrinterDriverDirectory unexspected return code %s, should be WERR_INSUFFICIENT_BUFFER\n", + win_errstr(r.out.result)); + ret = False; + continue; + } + + blob = data_blob_talloc(ctx, NULL, r.out.needed); + data_blob_clear(&blob); + r.in.buffer = &blob; + r.in.offered = r.out.needed; + + status = dcerpc_spoolss_GetPrinterDriverDirectory(ctx->p, ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("dcerpc_spoolss_GetPrinterDriverDirectory failed - %s\n", nt_errstr(status)); + ret = False; + continue; + } + + if (!W_ERROR_IS_OK(r.out.result)) { + printf("GetPrinterDriverDirectory failed - %s\n", + win_errstr(r.out.result)); + ret = False; + continue; + } + } + + return True; +} + static BOOL test_EnumPrinterDrivers(struct test_spoolss_context *ctx) { NTSTATUS status; @@ -223,11 +295,11 @@ static BOOL test_EnumPrinterDrivers(struct test_spoolss_context *ctx) int level = levels[i]; DATA_BLOB blob; - r.in.server = ""; - r.in.environment = "Windows NT x86"; - r.in.level = level; - r.in.buffer = NULL; - r.in.offered = 0; + r.in.server = ""; + r.in.environment = SPOOLSS_ARCHITECTURE_NT_X86; + r.in.level = level; + r.in.buffer = NULL; + r.in.offered = 0; printf("Testing EnumPrinterDrivers level %u\n", r.in.level); @@ -1994,6 +2066,8 @@ BOOL torture_rpc_spoolss(void) ret &= test_EnumPorts(ctx); + ret &= test_GetPrinterDriverDirectory(ctx); + ret &= test_EnumPrinterDrivers(ctx); ret &= test_EnumMonitors(ctx); -- cgit