Control: tag -1 + patch

Patches attached. I have not forwarded them upstream, I will leave that to your discretion.

Subject: offer version 3 or lower printer drivers to clients requesting >3
 Additional work would be needed to actualy support versions >3 properly,
 but meanwhile if we have drivers available lower than the client requested
 we should offer them.
Author: Jonathan Wiltshire, Tiger Computing Ltd <j...@tiger-computing.co.uk>
Bug-Debian: http://bugs.debian.org/707551
Forwarded: no
Last-Update: 2013-05-09

Index: samba-3.5.6~dfsg/source3/rpc_server/srv_spoolss_nt.c
===================================================================
--- samba-3.5.6~dfsg.orig/source3/rpc_server/srv_spoolss_nt.c	2013-04-26 11:41:09.413752346 +0100
+++ samba-3.5.6~dfsg/source3/rpc_server/srv_spoolss_nt.c	2013-05-09 11:28:40.450116068 +0100
@@ -8,6 +8,7 @@
  *  Copyright (C) Gerald Carter		       2000-2004,
  *  Copyright (C) Tim Potter                   2001-2002.
  *  Copyright (C) Guenther Deschner                 2009.
+ *  Copyright (C) Tiger Computing Ltd               2013.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -5088,26 +5089,28 @@
 	DEBUG(8,("construct_printer_driver_info_level: status: %s\n",
 		win_errstr(result)));
 
+	/* Tiger Computing */
 	if (!W_ERROR_IS_OK(result)) {
 		/*
-		 * Is this a W2k client ?
+		 * Not available at the requested version. Offer the next best.
 		 */
 
-		if (version < 3) {
-			free_a_printer(&printer, 2);
-			return WERR_UNKNOWN_PRINTER_DRIVER;
+		while(version > 2) {
+			version--;
+			result = get_a_printer_driver(mem_ctx, &driver, printer->info_2->drivername,
+						      architecture, version);
+			DEBUG(8,("construct_printer_driver_level: status: %s\n",
+				win_errstr(result)));
+			if (W_ERROR_IS_OK(result)) {
+				break;
+			}
 		}
+	}
+	/* End Tiger Computing */
 
-		/* Yes - try again with a WinNT driver. */
-		version = 2;
-		result = get_a_printer_driver(mem_ctx, &driver, printer->info_2->drivername,
-					      architecture, version);
-		DEBUG(8,("construct_printer_driver_level: status: %s\n",
-			win_errstr(result)));
-		if (!W_ERROR_IS_OK(result)) {
-			free_a_printer(&printer, 2);
-			return WERR_UNKNOWN_PRINTER_DRIVER;
-		}
+	if (!W_ERROR_IS_OK(result)) {
+		free_a_printer(&printer, 2);
+		return WERR_UNKNOWN_PRINTER_DRIVER;
 	}
 
 	switch (level) {
Subject: offer version 3 or lower printer drivers to clients requesting >3
 Additional work would be needed to actualy support versions >3 properly,
 but meanwhile if we have drivers available lower than the client requested
 we should offer them.
Author: Jonathan Wiltshire, Tiger Computing Ltd <j...@tiger-computing.co.uk>
Bug-Debian: http://bugs.debian.org/707551
Forwarded: no
Last-Update: 2013-05-09

Index: samba-3.6.6/source3/rpc_server/spoolss/srv_spoolss_nt.c
===================================================================
--- samba-3.6.6.orig/source3/rpc_server/spoolss/srv_spoolss_nt.c	2012-06-24 18:21:16.000000000 +0100
+++ samba-3.6.6/source3/rpc_server/spoolss/srv_spoolss_nt.c	2013-05-09 11:59:34.410808625 +0100
@@ -9,6 +9,7 @@
  *  Copyright (C) Tim Potter                   2001-2002.
  *  Copyright (C) Guenther Deschner            2009-2010.
  *  Copyright (C) Andreas Schneider            2010.
+ *  Copyright (C) Tiger Computing Ltd          2013.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -5520,29 +5521,32 @@
 	DEBUG(8,("construct_printer_driver_info_level: status: %s\n",
 		win_errstr(result)));
 
+	/* Tiger Computing */
 	if (!W_ERROR_IS_OK(result)) {
 		/*
-		 * Is this a W2k client ?
+		 * Not available at the requested version. Offer the next best.
 		 */
 
-		if (version < 3) {
-			talloc_free(pinfo2);
-			return WERR_UNKNOWN_PRINTER_DRIVER;
+		while(version > 2 {
+			version--;
+			result = winreg_get_driver(mem_ctx, b,
+						   architecture,
+						   pinfo2->drivername,
+						   version, &driver);
+			DEBUG(8,("construct_printer_driver_level: status: %s\n",
+				win_errstr(result)));
+			if (!W_ERROR_IS_OK(result)) {
+				break;
+			}
 		}
 
-		/* Yes - try again with a WinNT driver. */
-		version = 2;
-		result = winreg_get_driver(mem_ctx, b,
-					   architecture,
-					   pinfo2->drivername,
-					   version, &driver);
-		DEBUG(8,("construct_printer_driver_level: status: %s\n",
-			win_errstr(result)));
-		if (!W_ERROR_IS_OK(result)) {
-			talloc_free(pinfo2);
-			return WERR_UNKNOWN_PRINTER_DRIVER;
-		}
 	}
+	/* End Tiger Computing */
+
+	if (!W_ERROR_IS_OK(result)) {
+		talloc_free(pinfo2);
+		return WERR_UNKNOWN_PRINTER_DRIVER;
+ 	}
 
 	switch (level) {
 	case 1:

Reply via email to