Rev 12285: Add generic tests for ReplyOpenPrinter() and ReplyClosePrinter(). in file:///home/jelmer/bzr.samba4/spoolss/

Jelmer Vernooij jelmer at samba.org
Mon Jun 11 13:27:45 GMT 2007


At file:///home/jelmer/bzr.samba4/spoolss/

------------------------------------------------------------
revno: 12285
revision-id: jelmer at samba.org-20070528232035-25ruz8bhjnclnzps
parent: jelmer at samba.org-20070528194403-hw2nim09zkr7rqiq
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: spoolss
timestamp: Tue 2007-05-29 01:20:35 +0200
message:
  Add generic tests for ReplyOpenPrinter() and ReplyClosePrinter().
modified:
  source/rpc_server/spoolss/dcesrv_spoolss.c 1185 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818:branches%2FSAMBA_4_0:source%2Frpc_server%2Fspoolss%2Fdcesrv_spoolss.c
  source/torture/rpc/spoolss.c   6 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818:branches%2FSAMBA_4_0:source%2Ftorture%2Frpc%2Fspoolss.c
=== modified file 'source/rpc_server/spoolss/dcesrv_spoolss.c'
--- a/source/rpc_server/spoolss/dcesrv_spoolss.c	2007-05-28 19:44:03 +0000
+++ b/source/rpc_server/spoolss/dcesrv_spoolss.c	2007-05-28 23:20:35 +0000
@@ -1070,7 +1070,13 @@
 static WERROR dcesrv_spoolss_ReplyClosePrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
 		       struct spoolss_ReplyClosePrinter *r)
 {
-	DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
+	struct dcesrv_handle *handle;
+	
+	DCESRV_PULL_HANDLE_WERR(handle, r->in.handle, SPOOLSS_NOTIFY);
+
+	talloc_free(handle);
+
+	return WERR_OK;
 }
 
 

=== modified file 'source/torture/rpc/spoolss.c'
--- a/source/torture/rpc/spoolss.c	2007-05-28 19:44:03 +0000
+++ b/source/torture/rpc/spoolss.c	2007-05-28 23:20:35 +0000
@@ -2072,6 +2072,41 @@
 	return ret;
 }
 
+/** Test that makes sure that calling ReplyOpenPrinter()
+ * on Samba 4 will cause an irpc broadcast call.
+ */
+static bool test_ReplyOpenPrinter(struct torture_context *tctx, 
+								  struct dcerpc_pipe *pipe)
+{
+	struct spoolss_ReplyOpenPrinter r;
+	struct spoolss_ReplyClosePrinter s;
+	struct policy_handle h;
+
+	r.in.server_name = "earth";
+	r.in.printer_local = 2;
+	r.in.type = REG_DWORD;
+	r.in.unknown1 = 0;
+	r.in.unknown2 = 0;
+	r.out.handle = &h;
+
+	torture_assert_ntstatus_ok(tctx, 
+			dcerpc_spoolss_ReplyOpenPrinter(pipe, tctx, &r),
+			"spoolss_ReplyOpenPrinter call failed");
+
+	torture_assert_werr_ok(tctx, r.out.result, "error return code");
+
+	s.in.handle = &h;
+	s.out.handle = &h;
+
+	torture_assert_ntstatus_ok(tctx,
+			dcerpc_spoolss_ReplyClosePrinter(pipe, tctx, &s),
+			"spoolss_ReplyClosePrinter call failed");
+
+	torture_assert_werr_ok(tctx, r.out.result, "error return code");
+
+	return true;
+}
+
 BOOL torture_rpc_spoolss(struct torture_context *torture)
 {
 	NTSTATUS status;
@@ -2133,6 +2168,8 @@
 
 	ret &= test_EnumPrinterDrivers_old(p, mem_ctx);
 
+	ret &= test_ReplyOpenPrinter(torture, p);
+
 	talloc_free(mem_ctx);
 
 	return ret;



More information about the samba-cvs mailing list