[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Tue Apr 20 06:35:24 MDT 2010


The branch, master has been updated
       via  4f5298c... s4-smbtorture: add test for csetprinter field behaviour in printer info level 0.
      from  ac11b61... s4-net: don't show a full python exception when you can't open sam.ldb

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 4f5298cbb4c044b6bde0cda04d182651f826ee53
Author: Günther Deschner <gd at samba.org>
Date:   Tue Apr 20 14:15:24 2010 +0200

    s4-smbtorture: add test for csetprinter field behaviour in printer info level 0.
    
    Suprisingly, that value is always 0 (at least on w2k8r2).
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source4/torture/rpc/spoolss.c |   71 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 71 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index ec4cc78..55af920 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -5847,6 +5847,69 @@ static bool test_one_printer(struct torture_context *tctx,
 	return ret;
 }
 
+static bool test_csetprinter(struct torture_context *tctx,
+			     struct dcerpc_pipe *p,
+			     struct policy_handle *handle,
+			     const char *printername,
+			     const char *drivername,
+			     const char *portname)
+{
+	union spoolss_PrinterInfo info;
+	struct policy_handle new_handle, new_handle2;
+	struct dcerpc_binding_handle *b = p->binding_handle;
+
+	torture_comment(tctx, "Testing c_setprinter\n");
+
+	torture_assert(tctx,
+		test_GetPrinter_level(tctx, b, handle, 0, &info),
+		"failed to get level 0 printer info");
+	torture_comment(tctx, "csetprinter on initial printer handle: %d\n",
+		info.info0.c_setprinter);
+
+	/* check if c_setprinter on 1st handle increases after a printer has
+	 * been added */
+
+	torture_assert(tctx,
+		test_AddPrinter(tctx, p, &new_handle, printername, drivername, portname),
+		"failed to add new printer");
+	torture_assert(tctx,
+		test_GetPrinter_level(tctx, b, handle, 0, &info),
+		"failed to get level 0 printer info");
+	torture_comment(tctx, "csetprinter on initial printer handle (after add): %d\n",
+		info.info0.c_setprinter);
+
+	/* check if c_setprinter on new handle increases after a printer has
+	 * been added */
+
+	torture_assert(tctx,
+		test_GetPrinter_level(tctx, b, &new_handle, 0, &info),
+		"failed to get level 0 printer info");
+	torture_comment(tctx, "csetprinter on created handle: %d\n",
+		info.info0.c_setprinter);
+
+	/* open the new printer and check if c_setprinter increases */
+
+	torture_assert(tctx,
+		call_OpenPrinterEx(tctx, p, printername, NULL, &new_handle2),
+		"failed to open created printer");
+	torture_assert(tctx,
+		test_GetPrinter_level(tctx, b, &new_handle2, 0, &info),
+		"failed to get level 0 printer info");
+	torture_comment(tctx, "csetprinter on new handle (after openprinter): %d\n",
+		info.info0.c_setprinter);
+
+	/* cleanup */
+
+	torture_assert(tctx,
+		test_ClosePrinter(tctx, b, &new_handle2),
+		"failed to close printer");
+	torture_assert(tctx,
+		test_DeletePrinter(tctx, b, &new_handle),
+		"failed to delete new printer");
+
+	return true;
+}
+
 static bool test_printer(struct torture_context *tctx,
 			 struct dcerpc_pipe *p)
 {
@@ -5863,6 +5926,10 @@ static bool test_printer(struct torture_context *tctx,
 		return false;
 	}
 
+	if (!test_csetprinter(tctx, p, &handle[0], TORTURE_PRINTER "2", drivername, portname)) {
+		ret = false;
+	}
+
 	if (!test_one_printer(tctx, p, &handle[0], TORTURE_PRINTER)) {
 		ret = false;
 	}
@@ -5884,6 +5951,10 @@ static bool test_printer(struct torture_context *tctx,
 		return false;
 	}
 
+	if (!test_csetprinter(tctx, p, &handle[1], TORTURE_PRINTER_EX "2", drivername, portname)) {
+		ret = false;
+	}
+
 	if (!test_one_printer(tctx, p, &handle[1], TORTURE_PRINTER_EX)) {
 		ret = false;
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list