[SCM] Samba Shared Repository - branch v3-4-test updated - release-4-0-0alpha7-744-gd99b302

Günther Deschner gd at samba.org
Mon Apr 13 21:55:30 GMT 2009


The branch, v3-4-test has been updated
       via  d99b3025eb54030e90d0c32b2967490d41a1e02a (commit)
       via  4a12f9e09355236fc2d50651177197fc68b075e0 (commit)
       via  677b57deeb96e3e4c2b604abca29b6a49471fc01 (commit)
       via  03b5a3dd11c7e7300acf1c07d25c4374802d4fc5 (commit)
       via  8f08c873a69c8a9a210ba0c1943a2f053c22b225 (commit)
      from  5fd2ea50e390c1d9ecee7e8473f94f8e0c366650 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-4-test


- Log -----------------------------------------------------------------
commit d99b3025eb54030e90d0c32b2967490d41a1e02a
Author: Günther Deschner <gd at samba.org>
Date:   Mon Apr 13 23:11:23 2009 +0200

    s3-rpcclient: add set_job command.
    
    Guenther
    (cherry picked from commit fc056e561b95fb7869053bdec810e8c47e6c6dc2)

commit 4a12f9e09355236fc2d50651177197fc68b075e0
Author: Günther Deschner <gd at samba.org>
Date:   Mon Apr 13 20:44:19 2009 +0200

    s4-smbtorture: fix two valgrind warnings.
    
    Guenther
    (cherry picked from commit 1dbb6530fa044fbbc65409238b5b57dfd0e850a3)

commit 677b57deeb96e3e4c2b604abca29b6a49471fc01
Author: Günther Deschner <gd at samba.org>
Date:   Mon Apr 13 17:06:37 2009 +0200

    s4-smbtorture: disable test_SecondaryClosePrinter when running against s3 for now.
    
    Guenther
    (cherry picked from commit 56f5105400e1eda7baf5babe7ad1e608d0ffa04b)

commit 03b5a3dd11c7e7300acf1c07d25c4374802d4fc5
Author: Günther Deschner <gd at samba.org>
Date:   Mon Apr 13 17:05:12 2009 +0200

    s4-smbtorture: move test_ReplyOpenPrinter from RPC-SPOOLSS to RPC-SPOOLSS-NOTIFY.
    
    Guenther
    (cherry picked from commit 0f76e2d0bd8120d27ec6b782da6fb63407012fa2)

commit 8f08c873a69c8a9a210ba0c1943a2f053c22b225
Author: Günther Deschner <gd at samba.org>
Date:   Mon Apr 13 23:40:46 2009 +0200

    s3-spoolss: fix typo in fill_printer_driver_info3().
    
    Guenther
    (cherry picked from commit a79e1ce0488f80f40ddb4c9b32a7be4d5e1cb9d4)

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

Summary of changes:
 source3/rpc_server/srv_spoolss_nt.c  |    2 +-
 source3/rpcclient/cmd_spoolss.c      |   55 ++++++++++++++++++++++++++++++++++
 source4/torture/rpc/spoolss.c        |   50 ++++++------------------------
 source4/torture/rpc/spoolss_notify.c |   36 ++++++++++++++++++++++
 4 files changed, 102 insertions(+), 41 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 3edfca9..effbb92 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -4836,7 +4836,7 @@ static WERROR fill_printer_driver_info3(TALLOC_CTX *mem_ctx,
 	} else {
 		r->help_file	= talloc_strdup(mem_ctx, "");
 	}
-	W_ERROR_HAVE_NO_MEMORY(r->config_file);
+	W_ERROR_HAVE_NO_MEMORY(r->help_file);
 
 	r->monitor_name		= talloc_strdup(mem_ctx, driver->info_3->monitorname);
 	W_ERROR_HAVE_NO_MEMORY(r->monitor_name);
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index c9c457b..4bcaa29 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -2449,6 +2449,60 @@ done:
 	return result;
 }
 
+/****************************************************************************
+****************************************************************************/
+
+static WERROR cmd_spoolss_set_job(struct rpc_pipe_client *cli,
+				  TALLOC_CTX *mem_ctx, int argc,
+				  const char **argv)
+{
+	WERROR result;
+	NTSTATUS status;
+	const char *printername;
+	struct policy_handle hnd;
+	uint32_t job_id;
+	enum spoolss_JobControl command;
+
+	if (argc != 4) {
+		printf("Usage: %s printername job_id command\n", argv[0]);
+		return WERR_OK;
+	}
+
+	job_id = atoi(argv[2]);
+	command = atoi(argv[3]);
+
+	/* Open printer handle */
+
+	RPCCLIENT_PRINTERNAME(printername, cli, argv[1]);
+
+	result = rpccli_spoolss_openprinter_ex(cli, mem_ctx,
+					       printername,
+					       SEC_FLAG_MAXIMUM_ALLOWED,
+					       &hnd);
+	if (!W_ERROR_IS_OK(result)) {
+		goto done;
+	}
+
+	/* Set Job */
+
+	status = rpccli_spoolss_SetJob(cli, mem_ctx,
+				       &hnd,
+				       job_id,
+				       NULL,
+				       command,
+				       &result);
+
+	if (!W_ERROR_IS_OK(result)) {
+		goto done;
+	}
+
+done:
+	if (is_valid_policy_hnd(&hnd)) {
+		rpccli_spoolss_ClosePrinter(cli, mem_ctx, &hnd, NULL);
+	}
+
+	return result;
+}
 
 /****************************************************************************
 ****************************************************************************/
@@ -3136,6 +3190,7 @@ struct cmd_set spoolss_commands[] = {
 	{ "enumkey",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_printerkey,	&ndr_table_spoolss.syntax_id, NULL, "Enumerate printer keys",              "" },
 	{ "enumjobs",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_jobs,          &ndr_table_spoolss.syntax_id, NULL, "Enumerate print jobs",                "" },
 	{ "getjob",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_get_job,		&ndr_table_spoolss.syntax_id, NULL, "Get print job",                       "" },
+	{ "setjob",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_set_job,		&ndr_table_spoolss.syntax_id, NULL, "Set print job",                       "" },
 	{ "enumports", 		RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_ports, 	&ndr_table_spoolss.syntax_id, NULL, "Enumerate printer ports",             "" },
 	{ "enumdrivers", 	RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_drivers, 	&ndr_table_spoolss.syntax_id, NULL, "Enumerate installed printer drivers", "" },
 	{ "enumprinters", 	RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_printers, 	&ndr_table_spoolss.syntax_id, NULL, "Enumerate printers",                  "" },
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index f2a503b..b188970 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -1122,6 +1122,7 @@ static bool test_AddJob(struct torture_context *tctx,
 	r.in.handle = handle;
 	r.in.offered = 0;
 	r.out.needed = &needed;
+	r.in.buffer = r.out.buffer = NULL;
 
 	torture_comment(tctx, "Testing AddJob\n");
 
@@ -1381,6 +1382,7 @@ static bool test_GetPrinterDataEx(struct torture_context *tctx,
 	r.in.offered = 0;
 	r.out.type = &type;
 	r.out.needed = &needed;
+	r.out.buffer = NULL;
 
 	torture_comment(tctx, "Testing GetPrinterDataEx\n");
 
@@ -1658,8 +1660,10 @@ static bool test_OpenPrinter(struct torture_context *tctx,
 		ret = false;
 	}
 
-	if (!test_SecondaryClosePrinter(tctx, p, &handle)) {
-		ret = false;
+	if (!torture_setting_bool(tctx, "samba3", false)) {
+		if (!test_SecondaryClosePrinter(tctx, p, &handle)) {
+			ret = false;
+		}
 	}
 
 	if (!test_ClosePrinter(tctx, p, &handle)) {
@@ -1758,8 +1762,10 @@ static bool test_OpenPrinterEx(struct torture_context *tctx,
 		ret = false;
 	}
 
-	if (!test_SecondaryClosePrinter(tctx, p, &handle)) {
-		ret = false;
+	if (!torture_setting_bool(tctx, "samba3", false)) {
+		if (!test_SecondaryClosePrinter(tctx, p, &handle)) {
+			ret = false;
+		}
 	}
 
 	if (!test_ClosePrinter(tctx, p, &handle)) {
@@ -1941,41 +1947,6 @@ static bool test_EnumPrinterDrivers_old(struct torture_context *tctx,
 	return true;
 }
 
-/** 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.bufsize = 0;
-	r.in.buffer = NULL;
-	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;
@@ -2029,7 +2000,6 @@ bool torture_rpc_spoolss(struct torture_context *torture)
 	ret &= test_EnumPorts_old(torture, p);
 	ret &= test_EnumPrinters_old(torture, p);
 	ret &= test_EnumPrinterDrivers_old(torture, p);
-	ret &= test_ReplyOpenPrinter(torture, p);
 
 	return ret;
 }
diff --git a/source4/torture/rpc/spoolss_notify.c b/source4/torture/rpc/spoolss_notify.c
index b7f2d3c..a8a0ca5 100644
--- a/source4/torture/rpc/spoolss_notify.c
+++ b/source4/torture/rpc/spoolss_notify.c
@@ -289,6 +289,41 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
 	return true;
 }
 
+/** 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.bufsize = 0;
+	r.in.buffer = NULL;
+	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;
+}
+
 struct torture_suite *torture_rpc_spoolss_notify(TALLOC_CTX *mem_ctx)
 {
 	struct torture_suite *suite = torture_suite_create(mem_ctx, "SPOOLSS-NOTIFY");
@@ -297,6 +332,7 @@ struct torture_suite *torture_rpc_spoolss_notify(TALLOC_CTX *mem_ctx)
 							"notify", &ndr_table_spoolss);
 
 	torture_rpc_tcase_add_test(tcase, "testRFFPCNEx", test_RFFPCNEx);
+	torture_rpc_tcase_add_test(tcase, "testReplyOpenPrinter", test_ReplyOpenPrinter);
 	
 	return suite;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list