summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-10-06 18:50:48 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:20:44 -0500
commit84a5b728472b9cc7b942d521bc41afff66aa9141 (patch)
tree944e44d5101d80919c6a8eca9fc2589a0754e676
parentb510a0bed9525dd7e082e4e5dbb6b317770cb120 (diff)
downloadsamba-84a5b728472b9cc7b942d521bc41afff66aa9141.tar.gz
samba-84a5b728472b9cc7b942d521bc41afff66aa9141.tar.bz2
samba-84a5b728472b9cc7b942d521bc41afff66aa9141.zip
r19152: A simple consistency check for enumprinters
(This used to be commit 593b17c8e5678949d8b41d241f522ffb20c6640f)
-rw-r--r--source4/torture/rpc/samba3rpc.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 1e859e1ff8..8bfbad22e5 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);