From 90fee86e59df073a03ebb9f51605346a31795ec0 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 19 Oct 2004 22:13:08 +0000 Subject: r3069: add 'force printername' service parameter for people that want to enforce printername == sharename for spoolss printing --- source/printing/nt_printing.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'source/printing') diff --git a/source/printing/nt_printing.c b/source/printing/nt_printing.c index 14c0417f776..a69433df37f 100644 --- a/source/printing/nt_printing.c +++ b/source/printing/nt_printing.c @@ -3357,7 +3357,8 @@ static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, const char *se { pstring key; NT_PRINTER_INFO_LEVEL_2 info; - int len = 0; + int len = 0; + int snum = lp_servicenumber(sharename); TDB_DATA kbuf, dbuf; fstring printername; char adevice[MAXDEVICENAME]; @@ -3403,7 +3404,12 @@ static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, const char *se /* Restore the stripped strings. */ slprintf(info.servername, sizeof(info.servername)-1, "\\\\%s", servername); - slprintf(printername, sizeof(printername)-1, "\\\\%s\\%s", servername, info.printername); + + if ( lp_force_printername(snum) ) + slprintf(printername, sizeof(printername)-1, "\\\\%s\\%s", servername, sharename ); + else + slprintf(printername, sizeof(printername)-1, "\\\\%s\\%s", servername, info.printername); + fstrcpy(info.printername, printername); len += unpack_devicemode(&info.devmode,dbuf.dptr+len, dbuf.dsize-len); @@ -3416,7 +3422,7 @@ static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, const char *se * See comments in get_a_printer_2_default() */ - if (lp_default_devmode(lp_servicenumber(sharename)) && !info.devmode) { + if (lp_default_devmode(snum) && !info.devmode) { DEBUG(8,("get_a_printer_2: Constructing a default device mode for [%s]\n", printername)); info.devmode = construct_nt_devicemode(printername); -- cgit