diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-17 03:38:13 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-17 03:38:13 +0000 |
commit | bf48b6e69a638dc78ab119424e27adc0ccc6c610 (patch) | |
tree | 60b76902359884ad7c708cec467bee0baf6e2898 /source4/torture/rpc | |
parent | 90916de4a5303601a59938237a551d976cde0589 (diff) | |
download | samba-bf48b6e69a638dc78ab119424e27adc0ccc6c610.tar.gz samba-bf48b6e69a638dc78ab119424e27adc0ccc6c610.tar.bz2 samba-bf48b6e69a638dc78ab119424e27adc0ccc6c610.zip |
added OpenPrinter and a test function. Note that the Samba3 structure
for OpenPrinter was wrong.
(This used to be commit 186ddbbf8774d0960852ea9186c8e4e6f7be7a0f)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r-- | source4/torture/rpc/spoolss.c | 36 |
1 files changed, 36 insertions, 0 deletions
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<r.out.count;j++) { + if (r.in.level == 1 && + !test_OpenPrinter(p, mem_ctx, &info[j].info1)) { + ret = False; + } + } } return ret; |