summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/nt_printing.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index a0dacc14c5..701944824d 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -22,7 +22,6 @@
#include "includes.h"
-extern pstring global_myname;
extern DOM_SID global_sid_World;
static TDB_CONTEXT *tdb_forms; /* used for forms files */
@@ -2381,16 +2380,18 @@ get a default printer info 2 struct
static WERROR get_a_printer_2_default(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharename)
{
extern pstring global_myname;
+ extern fstring local_machine;
int snum;
NT_PRINTER_INFO_LEVEL_2 info;
+ char *sub_name = *local_machine ? local_machine : global_myname;
ZERO_STRUCT(info);
snum = lp_servicenumber(sharename);
- slprintf(info.servername, sizeof(info.servername)-1, "\\\\%s", global_myname);
+ slprintf(info.servername, sizeof(info.servername)-1, "\\\\%s", sub_name);
slprintf(info.printername, sizeof(info.printername)-1, "\\\\%s\\%s",
- global_myname, sharename);
+ sub_name, sharename);
fstrcpy(info.sharename, sharename);
fstrcpy(info.portname, SAMBA_PRINTER_PORT_NAME);
fstrcpy(info.drivername, lp_printerdriver(snum));
@@ -2466,7 +2467,10 @@ static WERROR get_a_printer_2_default(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstrin
****************************************************************************/
static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharename)
{
+ extern pstring global_myname;
+ extern fstring local_machine;
pstring key;
+ char *sub_name = *local_machine ? local_machine : global_myname;
NT_PRINTER_INFO_LEVEL_2 info;
int len = 0;
TDB_DATA kbuf, dbuf;
@@ -2511,8 +2515,8 @@ static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharen
info.attributes |= (PRINTER_ATTRIBUTE_SHARED|PRINTER_ATTRIBUTE_RAW_ONLY);
/* Restore the stripped strings. */
- slprintf(info.servername, sizeof(info.servername)-1, "\\\\%s", global_myname);
- slprintf(printername, sizeof(printername)-1, "\\\\%s\\%s", global_myname,
+ slprintf(info.servername, sizeof(info.servername)-1, "\\\\%s", sub_name);
+ slprintf(printername, sizeof(printername)-1, "\\\\%s\\%s", sub_name,
info.printername);
fstrcpy(info.printername, printername);