3.0.3pre1, nmbd not running, W2K/XP clients installing printers from //alias.
alias resolves in dns to eth1 ip interface of samba server, and samba is
configured with netbios aliases = alias.
However, when a client installs a printer from alias, the printer name is
installed using the real netbios/hostname of the samba server, instead of the
netbios alias the client requested. Subsequent use of this printer is
directed at real netbios/hostname of samba server instead of the original
This severely cripples the usefulness of netbios aliases (and %L) for anything
to do with print.
global smb.conf options:
workgroup = TCS_MAIN_DOM
use mmap = no
netbios name = real
netbios aliases = alias
server string = Samba Print Server (%L)
interfaces = eth1 eth0 127.0.0.1/24
# bind interfaces only = yes
bind interfaces only = no
security = DOMAIN
encrypt passwords = Yes
password server = *
username map = /etc/samba/smbusers
log file = /var/log/samba/%m.log
mangling method = hash2
preferred master = No
domain master = No
local master = Yes
dns proxy = No
wins server = 10.176.157.10 172.16.23.13
kernel oplocks = No
winbind uid = 10000-20000
winbind gid = 10000-20000
winbind enum users = yes
winbind enum groups = yes
winbind use default domain = yes
oplocks = No
level2 oplocks = No
guest account = nobody
load printers = no
printing = cups
printcap name = cups
print$, printers, and individual print queue shares not listed. Please let me
know if you think they might be useful for some reason.
More info... this appears to be because printing/nt_printing.c:get_a_printer_2
does a slprintf of get_called_name() to restore servername (and servername in
Hard coding the alias in place of get_called_name (and also modifying
unpack_devicemode's devmode.devicename, not sure if this was required), fixed
the problem locally.
get_called_name is returning lib/util.c's local_machine. Which I think is
getting set during smbd's init_structs (lib/util.c:init_names) to global_myname
If this is really how it's supposed to happen, I don't understand the
get_called_name comment "Return the NetBIOS called name, or my IP - but never
global_myname()." get_called_name uses local_name if available, and
local_name appears to be initialized right off the bat to global_myname()?
Created attachment 478 [details]
set_local_machine_name (like set_remote_machine_name) for port 445 connections
Like the set_remote_machine_name in open_sockets_smbd, also call
set_local_machine_name so get_called_name will work for multiple
interfaces/aliases over port 445.
This does not affect NETBIOS connections, but fixes a problem where %L is
effectively always global_myname() for port 445 connections, despite the
interface/alias the client truly requests or connects to.
I know smb.conf says:
%L the NetBIOS name of the server. This allows you to
change your config based on what the client calls
you. Your server can have a ``dual personality''.
This parameter is not available when Samba listens
on port 445, as clients no longer send this infor-
But "not available" seems like a cop-out, since the print code uses
get_called_name pretty extensively, and it's broken if you want clients to be
able to use anything other than global_myname().
For Samba 3.0.2a in security = domain mode (NT pdc), with an alias that
resolves in dns that is different from the netbios name... before this patch,
attempting to install a printer on alias.domain really installed the printer
from SERVER-NETBIOS-NAME on the client. After the patch, the printer is
installed correctly from the "alias.domain" the client initially connected to.
Does this seem okay or is fixing get_called_name for 445 this way too
dangerous in Samba 3?
Patch is better with this just before the "can't pass the same source and dest
strings in "... comment:
/* Accept host only up to first '.', for things like MAXDEVICENAME limit
and to more closely mimic netbios */
if ((p = strchr_m(name_buf,'.')))
*p = 0;
I'll look at this but until I do....
netbios aliases only make sense when you are using netbios :-)
'smb ports = 139' will disable netbios-less CIFS on port 445.
> netbios aliases only make sense when you are using netbios :-)
This is true. But "dual-personality" with %L was a great feature in the
2.2.8a days, and losing it seems somewhat of an unecessary regression.
Or maybe %h should be used, or a new substitution letter? At any rate, the
problem was that the way it was, if clients connected to one host/IP address
to install a printer, Samba would tell them to connect to a different host
instead. This screwed up some HA environments we were considering, because we
really wanted the clients to be connected to the one they specified. And it
seems like you'd get in trouble with printers and terminal server too, since
aliases are often recommended with TS.
> 'smb ports = 139' will disable netbios-less CIFS on port 445.
Ooh, yes it would. We may have to resort to this, but it would be nice not to
This should be fixed in 3.0.4
originally reported against 3.0.3pre1. Moving back to version to 3.0.2a
to remove preX and rcX versions.
originally reported against 3.0.3pre2. Moving back to version to 3.0.2a
to remove preX and rcX versions.
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.