diff options
author | Jeremy Allison <jra@samba.org> | 2002-01-07 22:58:20 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2002-01-07 22:58:20 +0000 |
commit | 43b27771f50d5feba995c6ede961fdb4e73354f9 (patch) | |
tree | ee00af2f71928ba9c2cd618467f530054cc4e565 /source3 | |
parent | f1256e847e6820c29f8bc74db4609d8aa282a1a1 (diff) | |
download | samba-43b27771f50d5feba995c6ede961fdb4e73354f9.tar.gz samba-43b27771f50d5feba995c6ede961fdb4e73354f9.tar.bz2 samba-43b27771f50d5feba995c6ede961fdb4e73354f9.zip |
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)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/printing/nt_printing.c | 14 |
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); |