diff options
Diffstat (limited to 'source4/torture/rpc/spoolss.c')
-rw-r--r-- | source4/torture/rpc/spoolss.c | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index e0aa429ae7..e7e35659d7 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -25,40 +25,50 @@ static BOOL test_EnumPrinters(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { struct spoolss_EnumPrinters r; NTSTATUS status; - uint32 needed = 0; + uint16 levels[] = {1, 2}; + int i; + BOOL ret = True; - r.in.flags = 0x02; - r.in.server = ""; - r.in.level = 1; - r.in.buf = NULL; - r.in.offered = needed; - r.out.needed = &needed; + for (i=0;i<ARRAY_SIZE(levels);i++) { + uint32 needed = 0; + + r.in.flags = 0x02; + r.in.server = ""; + r.in.level = levels[i]; + r.in.buf = NULL; + r.in.offered = needed; + r.out.needed = &needed; - status = dcerpc_spoolss_EnumPrinters(p, mem_ctx, &r); - if (NT_STATUS_IS_ERR(status)) { - printf("EnumPrinters failed - %s\n", nt_errstr(status)); - return False; - } + printf("\nTesting EnumPrinters level %u\n", r.in.level); - if (NT_STATUS_V(status) == 0x0000007a) { - r.in.buf = talloc(mem_ctx, needed); - if (!r.in.buf) { - return False; - } - memset(r.in.buf, 0xfe, needed); - r.in.offered = needed; status = dcerpc_spoolss_EnumPrinters(p, mem_ctx, &r); - } - - if (!NT_STATUS_IS_OK(status)) { - printf("EnumPrinters failed - %s\n", nt_errstr(status)); - } + if (NT_STATUS_IS_ERR(status)) { + printf("EnumPrinters failed - %s\n", nt_errstr(status)); + ret = False; + continue; + } + + if (NT_STATUS_V(status) == 0x0000007a) { + r.in.buf = talloc(mem_ctx, needed); + if (!r.in.buf) { + ret = False; + continue; + } + memset(r.in.buf, 0xfe, needed); + r.in.offered = needed; + status = dcerpc_spoolss_EnumPrinters(p, mem_ctx, &r); + } + + if (!NT_STATUS_IS_OK(status)) { + printf("EnumPrinters failed - %s\n", nt_errstr(status)); + } - if (r.out.info) { - NDR_PRINT_UNION_DEBUG(spoolss_PrinterEnum, r.in.level, r.out.info); + if (r.out.info) { + NDR_PRINT_UNION_DEBUG(spoolss_PrinterEnum, r.in.level, r.out.info); + } } - return True; + return ret; } static BOOL test_OpenPrinterEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, |