From 43b27771f50d5feba995c6ede961fdb4e73354f9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 7 Jan 2002 22:58:20 +0000 Subject: Return called NetBIOS name if present in preference to global_myname. Should allow print servers to work with NetBIOS aliases. Needs testing. Jeremy. (This used to be commit ee8fd2690a4c8e4ebc5dd3b6e830116806ed5a4b) --- source3/printing/nt_printing.c | 14 +++++++++----- 1 file 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); -- cgit