diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-16 13:49:14 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-16 13:49:14 +0000 |
commit | ae4cb40100a5c04a4604acfde989ce96ef1801bd (patch) | |
tree | 48baadf0d3f5076475025e1f4f52abb4fe62290e /source4/torture | |
parent | c4b7585288095cb9459feb237a9581ba30b850d0 (diff) | |
download | samba-ae4cb40100a5c04a4604acfde989ce96ef1801bd.tar.gz samba-ae4cb40100a5c04a4604acfde989ce96ef1801bd.tar.bz2 samba-ae4cb40100a5c04a4604acfde989ce96ef1801bd.zip |
use nstring and [relative] to support levels 1 and 2 of EnumPrinters
fully
(This used to be commit 69c6017c945bdd7d1945f22fcad49112ba6a2d2d)
Diffstat (limited to 'source4/torture')
-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, |