smbclient...

Christopher R. Hertel crh at ubiqx.mn.org
Wed Jun 4 16:24:04 GMT 2003


On Wed, Jun 04, 2003 at 07:19:58AM -0700, Esh, Andrew wrote:
> Why not use nmblookup to translate the IP address into the netbios name?
> 
> [root at pluto bin]# nmblookup -U 10.105.102.26 -T '*'
> querying * on 10.105.102.26
> esh.tricord.com, 10.105.102.26 *<00>
> 
> My machine name is 'ESH'.

Because the NetBIOS machine name and the DNS machine name are not
necessarily the same.  The two exist in separate namespaces and the fact
that they often match is a convenience.  Windows tries to ensure that both 
names match, but they do so at the application layer (that is, the dialog 
boxes urge you to use the same name for both NetBIOS and DNS).  You can 
easily override this on the Windows systems I've seen.

Samba defaults to using the hostname as the NetBIOS machine name but, 
again, it can be overridden (which is good).

> [root at pluto bin]# echo "Hi there" | smbclient -M ESH
> added interface ip=10.105.102.25 bcast=10.105.103.255 nmask=255.255.252.0
> Connected. Type your message, ending it with a Control-D
> sent 10 bytes

Note that the destination NetBIOS name in the above will be ESH<03>.  The
Messanger Service listens on the <03> name.  In fact, it may listen on
both machine<03> and user<03>.  Note that if your username is also "ESH",
the there's an interesting dynamic to consider here.

In general, the "correct" way to find the destination name for a WinPopup
(Messanger Service) message is to send an adapter status query and then
scan the results for <03> names.

for f in `nmblookup -A ${IP} | fgrep "<03>" | awk '{ print $1 }'`
do
  echo ${MSG} | smbclient -M $f
done

The above may result in duplicate messages to machines which have both 
user<03> and machine<03> registered.  That's probably not a problem, 
though.

Chris -)-----

--
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org



More information about the samba-technical mailing list