[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Thu Aug 24 11:24:02 UTC 2017


The branch, master has been updated
       via  c90069b s4:torture: The teardown function should just return
       via  bd44e43 s4:torture: Delete printer before we remove the driver
       via  731fe59 s4:torture: Use a different driver name for add_driver tests
       via  f449177 s3:script: Untaint user supplied data in modprinter.pl
       via  f9c0a8e s3:spoolss: Set timeout values to the one which Windows uses by default
      from  3a719dc dynconfig: Use INSTALL_DIR to create directories

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


- Log -----------------------------------------------------------------
commit c90069b26424752b15922de9cb796c431d2f3e08
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Aug 8 12:05:24 2017 +0200

    s4:torture: The teardown function should just return
    
    The teardown functions should not return on error but finish cleaning
    up!
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12984
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Thu Aug 24 13:23:22 CEST 2017 on sn-devel-144

commit bd44e435fa6a93d47a470f8ee95763a95eba4b5d
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Aug 8 10:40:19 2017 +0200

    s4:torture: Delete printer before we remove the driver
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12984
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit 731fe596ac0999d54aae03ce4175356c56b3c94b
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Aug 8 11:25:48 2017 +0200

    s4:torture: Use a different driver name for add_driver tests
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12984
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit f44917743512fa40f2833629dfd781f7c691ce62
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Aug 8 08:40:34 2017 +0200

    s3:script: Untaint user supplied data in modprinter.pl
    
    spoolss_SetPrinter fails because of the error produced by modprinter.pl.
    
    Perl error:
    Insecure dependency in open while running setgid at modprinter.pl line 76.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12950
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit f9c0a8e3e0dc340d2cc71196d1ad600b6359c41c
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Nov 18 15:06:22 2016 +0100

    s3:spoolss: Set timeout values to the one which Windows uses by default
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

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

Summary of changes:
 source3/rpc_server/spoolss/srv_spoolss_nt.c |  9 +++--
 source3/script/tests/printing/modprinter.pl | 15 +++++--
 source4/torture/rpc/spoolss.c               | 63 +++++++++++++++++++----------
 3 files changed, 59 insertions(+), 28 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index 9d99e74..663c623 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -4177,9 +4177,12 @@ static WERROR construct_printer_info5(TALLOC_CTX *mem_ctx,
 
 	r->attributes	= info2->attributes;
 
-	/* these two are not used by NT+ according to MSDN */
-	r->device_not_selected_timeout		= 0x0;  /* have seen 0x3a98 */
-	r->transmission_retry_timeout		= 0x0;  /* have seen 0xafc8 */
+	/*
+	 * These two are not used by NT+ according to MSDN. However the values
+	 * we saw on Windows Server 2012 and 2016 are always set to the 0xafc8.
+	 */
+	r->device_not_selected_timeout		= 0xafc8; /* 45 sec */
+	r->transmission_retry_timeout		= 0xafc8; /* 45 sec */
 
 	return WERR_OK;
 }
diff --git a/source3/script/tests/printing/modprinter.pl b/source3/script/tests/printing/modprinter.pl
index 9e5e329..ec1ebcd 100755
--- a/source3/script/tests/printing/modprinter.pl
+++ b/source3/script/tests/printing/modprinter.pl
@@ -67,7 +67,14 @@ if (!defined($share_name)) {
 	die "share name not defined";
 }
 
-my $tmp = $opt_smb_conf.$$;
+my $smb_conf_file = $opt_smb_conf;
+if ($smb_conf_file =~ /^(.*)$/) {
+	$smb_conf_file = $1; # untaint file name
+} else {
+	die "Invalid file name $smb_conf_file";
+}
+
+my $tmp = $smb_conf_file.$$;
 
 my $section = undef;
 my $within_section = 0;
@@ -75,7 +82,7 @@ my $found_section = 0;
 
 open(CONFIGFILE_NEW, "+>$tmp") || die "Unable top open conf file $tmp";
 
-open (CONFIGFILE, "+<$opt_smb_conf") || die "Unable to open config file $opt_smb_conf";
+open (CONFIGFILE, "+<$smb_conf_file") || die "Unable to open config file $smb_conf_file";
 while (<CONFIGFILE>) {
 	my $line = $_;
 	chomp($_);
@@ -123,7 +130,9 @@ close (CONFIGFILE_NEW);
 if ($opt_delete && ($found_section == 0)) {
 	die "share $share_name not found";
 }
-system("cp", "$tmp", "$opt_smb_conf");
+
+$ENV{'PATH'} = '/bin:/usr/bin'; # untaint PATH
+system("cp", "$tmp", "$smb_conf_file");
 unlink $tmp;
 
 exit 0;
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 89e9a13..d4f6969 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -47,6 +47,7 @@
 #define TORTURE_WELLKNOWN_PRINTER_EX	"torture_wkn_printer_ex"
 #define TORTURE_PRINTER_EX		"torture_printer_ex"
 #define TORTURE_DRIVER			"torture_driver"
+#define TORTURE_DRIVER_ADD		"torture_driver_add"
 #define TORTURE_DRIVER_EX		"torture_driver_ex"
 #define TORTURE_DRIVER_ADOBE		"torture_driver_adobe"
 #define TORTURE_DRIVER_EX_ADOBE		"torture_driver_ex_adobe"
@@ -8575,6 +8576,7 @@ static bool torture_rpc_spoolss_printer_teardown_common(struct torture_context *
 	struct dcerpc_pipe *p = t->spoolss_pipe;
 	struct dcerpc_binding_handle *b = NULL;
 	const char *server_name_slash;
+	bool ok = true;
 
 	if (p == NULL) {
 		return true;
@@ -8583,38 +8585,55 @@ static bool torture_rpc_spoolss_printer_teardown_common(struct torture_context *
 
 	server_name_slash = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
 
-	if (t->added_driver) {
-		torture_assert(tctx,
-			remove_printer_driver(tctx, dcerpc_server_name(p), &t->driver),
-			"failed to remove printer driver");
-
-		torture_assert(tctx,
-			test_DeletePrinterDriverEx_exp(tctx, b,
-						       server_name_slash,
-						       t->driver.info8.driver_name,
-						       t->driver.info8.architecture,
-						       DPD_DELETE_ALL_FILES,
-						       t->driver.info8.version,
-						       WERR_OK),
-			"failed to delete printer driver via spoolss");
-	}
-
 	if (!t->wellknown) {
 		const char *printer_name = t->info2.printername;
 
-		torture_assert(tctx,
+		torture_assert_goto(tctx,
 			test_DeletePrinter(tctx, b, &t->handle),
+			ok,
+			remove_driver,
 			"failed to delete printer");
 
-		torture_assert(tctx,
+		torture_assert_goto(tctx,
 			test_EnumPrinters_findname(tctx, b, PRINTER_ENUM_LOCAL, 1,
 						   printer_name, &found),
+			ok,
+			remove_driver,
 			"failed to enumerate printers");
 
-		torture_assert(tctx, !found, "deleted printer still there");
+		torture_assert_goto(tctx,
+			!found,
+			ok,
+			remove_driver,
+			"deleted printer still there");
 	}
 
-	return true;
+
+remove_driver:
+	if (t->added_driver) {
+		ok = remove_printer_driver(tctx,
+					   dcerpc_server_name(p),
+					   &t->driver);
+		if (!ok) {
+			torture_warning(tctx,
+					"failed to remove printer driver\n");
+		}
+
+		ok = test_DeletePrinterDriverEx_exp(tctx, b,
+						    server_name_slash,
+						    t->driver.info8.driver_name,
+						    t->driver.info8.architecture,
+						    DPD_DELETE_ALL_FILES,
+						    t->driver.info8.version,
+						    WERR_OK);
+		if (!ok) {
+			torture_warning(tctx,
+					"failed to delete printer driver via "
+					"spoolss\n");
+		}
+	}
+
+	return ok;
 }
 
 static bool torture_rpc_spoolss_printer_teardown(struct torture_context *tctx, void *data)
@@ -10932,7 +10951,7 @@ static bool test_add_driver_64(struct torture_context *tctx,
 	d->local.driver_directory	= talloc_strdup(d, "/usr/share/cups/drivers/x64");
 
 	d->info8.version		= SPOOLSS_DRIVER_VERSION_200X;
-	d->info8.driver_name		= TORTURE_DRIVER;
+	d->info8.driver_name		= TORTURE_DRIVER_ADD;
 	d->info8.architecture		= d->local.environment;
 	d->info8.driver_path		= talloc_strdup(d, "pscript5.dll");
 	d->info8.data_file		= talloc_strdup(d, "cups6.ppd");
@@ -10953,7 +10972,7 @@ static bool test_add_driver_32(struct torture_context *tctx,
 	d->local.driver_directory	= talloc_strdup(d, "/usr/share/cups/drivers/i386");
 
 	d->info8.version		= SPOOLSS_DRIVER_VERSION_200X;
-	d->info8.driver_name		= TORTURE_DRIVER;
+	d->info8.driver_name		= TORTURE_DRIVER_ADD;
 	d->info8.architecture		= d->local.environment;
 	d->info8.driver_path		= talloc_strdup(d, "pscript5.dll");
 	d->info8.data_file		= talloc_strdup(d, "cups6.ppd");


-- 
Samba Shared Repository



More information about the samba-cvs mailing list