svn commit: samba r19152 - in branches/SAMBA_4_0/source/torture/rpc: .

vlendec at samba.org vlendec at samba.org
Fri Oct 6 18:50:49 GMT 2006


Author: vlendec
Date: 2006-10-06 18:50:48 +0000 (Fri, 06 Oct 2006)
New Revision: 19152

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19152

Log:
A simple consistency check for enumprinters
Modified:
   branches/SAMBA_4_0/source/torture/rpc/samba3rpc.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/rpc/samba3rpc.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/samba3rpc.c	2006-10-06 18:49:29 UTC (rev 19151)
+++ branches/SAMBA_4_0/source/torture/rpc/samba3rpc.c	2006-10-06 18:50:48 UTC (rev 19152)
@@ -2230,7 +2230,7 @@
 }
 
 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 @@
 		return False;
 	}
 
+	*num_printers = r.out.count;
+
 	return True;
 }
 
@@ -2506,10 +2508,20 @@
 		}
 	}
 
-	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);



More information about the samba-cvs mailing list