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 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: