From: Volker Lendecke Date: Fri, 6 Oct 2006 18:50:48 +0000 (+0000) Subject: r19152: A simple consistency check for enumprinters X-Git-Tag: samba-4.0.0alpha6~801^3~4557 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84a5b728472b9cc7b942d521bc41afff66aa9141;p=thirdparty%2Fsamba.git r19152: A simple consistency check for enumprinters (This used to be commit 593b17c8e5678949d8b41d241f522ffb20c6640f) --- diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index 1e859e1ff84..8bfbad22e53 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -2230,7 +2230,7 @@ static NTSTATUS find_printers(TALLOC_CTX *ctx, struct smbcli_tree *tree, } static BOOL enumprinters(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *pipe, - int level) + int level, int *num_printers) { struct spoolss_EnumPrinters r; NTSTATUS status; @@ -2273,6 +2273,8 @@ static BOOL enumprinters(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *pipe, return False; } + *num_printers = r.out.count; + return True; } @@ -2506,10 +2508,20 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) } } - if (!enumprinters(mem_ctx, p, 1)) { - d_printf("(%s) enumprinters failed\n", __location__); - talloc_free(mem_ctx); - return False; + { + int num_enumerated; + if (!enumprinters(mem_ctx, p, 1, &num_enumerated)) { + d_printf("(%s) enumprinters failed\n", __location__); + talloc_free(mem_ctx); + return False; + } + if (num_printers != num_enumerated) { + d_printf("(%s) netshareenum gave %d printers, " + "enumprinters gave %d\n", __location__, + num_printers, num_enumerated); + talloc_free(mem_ctx); + return False; + } } talloc_free(mem_ctx);