diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-06-14 18:44:22 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:18:11 -0500 |
commit | 056d63c62f3793fda0d3049a2f98cef435c9003e (patch) | |
tree | e1eba1842051b0f84ab7c309e6822f840110a234 /source4/torture/rpc | |
parent | bc1f32b8ad644dbe8fb7b5405d4f11c0e06f4193 (diff) | |
download | samba-056d63c62f3793fda0d3049a2f98cef435c9003e.tar.gz samba-056d63c62f3793fda0d3049a2f98cef435c9003e.tar.bz2 samba-056d63c62f3793fda0d3049a2f98cef435c9003e.zip |
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)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r-- | source4/torture/rpc/spoolss.c | 84 |
1 files changed, 79 insertions, 5 deletions
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;i<ARRAY_SIZE(levels);i++) { + int level = levels[i].level; + DATA_BLOB blob; + + r.in.server = levels[i].server; + r.in.environment = SPOOLSS_ARCHITECTURE_NT_X86; + r.in.level = level; + r.in.buffer = NULL; + r.in.offered = 0; + + printf("Testing GetPrinterDriverDirectory level %u\n", r.in.level); + + 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_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); |