From 04d3e8046a6276ddf968728998c9a57054faff22 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 25 Feb 2005 06:16:13 +0000 Subject: r5553: Add idl and test for spoolss_AddPort(). It always seems to return WERR_NOT_SUPPORTED though. (This used to be commit ba4730a37838f45db1b77b777af8efdb45a06006) --- source4/librpc/idl/spoolss.idl | 3 +++ source4/torture/rpc/spoolss.c | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/source4/librpc/idl/spoolss.idl b/source4/librpc/idl/spoolss.idl index 85c49566b0..7f52c6442e 100644 --- a/source4/librpc/idl/spoolss.idl +++ b/source4/librpc/idl/spoolss.idl @@ -712,6 +712,9 @@ /******************/ /* Function: 0x25 */ WERROR spoolss_AddPort( + [in] unistr *server_name, + [in] uint32 unknown, + [in] unistr monitor_name ); /******************/ diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index 7ca8db5a10..94ced04a98 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -303,7 +303,7 @@ static BOOL test_EnumPorts(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) status = dcerpc_spoolss_EnumPorts(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { - printf("EnumPorts failed -- %s\n", nt_errstr(status)); + printf("EnumPorts failed - %s\n", nt_errstr(status)); return False; } @@ -316,7 +316,7 @@ static BOOL test_EnumPorts(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) status = dcerpc_spoolss_EnumPorts(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { - printf("EnumPorts failed -- %s\n", nt_errstr(status)); + printf("EnumPorts failed - %s\n", nt_errstr(status)); return False; } @@ -329,6 +329,39 @@ static BOOL test_EnumPorts(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) return True; } +static BOOL test_AddPort(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +{ + NTSTATUS status; + struct spoolss_AddPort r; + + r.in.server_name = talloc_asprintf(mem_ctx, "\\\\%s", + dcerpc_server_name(p)); + r.in.unknown = 0; + r.in.monitor_name = "foo"; + + printf ("Testing AddPort\n"); + + status = dcerpc_spoolss_AddPort(p, mem_ctx, &r); + + if (!NT_STATUS_IS_OK(status)) { + printf("AddPort failed - %s\n", nt_errstr(status)); + return False; + } + + /* win2k3 returns WERR_NOT_SUPPORTED */ + +#if 0 + + if (!W_ERROR_IS_OK(r.out.result)) { + printf("AddPort failed - %s\n", win_errstr(r.out.result)); + return False; + } + +#endif + + return True; +} + static BOOL test_GetJob(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t job_id) { @@ -1095,6 +1128,8 @@ BOOL torture_rpc_spoolss(void) ret &= test_OpenPrinter_badnames(p, mem_ctx); + ret &= test_AddPort(p, mem_ctx); + ret &= test_EnumPorts(p, mem_ctx); ret &= test_EnumPrinters(p, mem_ctx); -- cgit