Bug in smbclient's winpopup? And name_query() question

Michael Ju. Tokarev mjt at tls.msk.ru
Mon Oct 25 18:12:58 GMT 1999


Hi!

I'm not shure if this was not discussed already.
I was noticied that smbclient is unable to send message to _USER_
(with _HOST_ all is ok). Looking to client/client.c source, I found
that with -M option client sets name_type to 0x03 and after that
tries to request session using that name type (in do_message_op()).
But for name resolution it uses name 0x20 (calling cli_connect()
with just a client host name). Here is a trivial patch to make
smbclient explicitly lookup name with choosen type.
So here is a my question: Is it a Right Thing To Do?
And the first answer is: _not_, because with this patch smbclient does
strange things when sending empty messages:
  $ smbclient -M mjt
  Connected. Type your message, ending it with a Control-D
  sent 0 bytes               <============= look here
  $ smbclient -M roland
  Connected. Type your message, ending it with a Control-D
  SMBsendtxt failed (code 0) <============= look here
(roland is my machine, mjt is my username).
I'm not very familiar with name types etc...

And another question around name resolution: in libsmb/namequery.c,
name_query() routine, there is a comment (marked "XXXX what do we do with this?").
I noticied that condition mentioned in this block of code (if it is true,
answer is ignored) is true if wins server is unable to find requested
name. Some fields/values around:
  header: flags: auth=Yes
  header: rcode=3
  answers: nmb_name=NOT_FOUND_NAME<TYPE> rr_type=32 rr_class=1 ttl=0
where NOT_FOUND_NAME<TYPE> is a requested name sent back to client.
As I can guess, wins server is autoritative for information about
that there is _no_ such name found (auth=Yes, rcode=3 (?), ttl=0).
And as I can see again, Windows machine just gives me "name can't
be found on network" if it receives such answer (I tried to send
winpopup from winmachine to nonexisted name and looked to nmbd's
logs -- only one packet was sent from win, and only one reply from
nmbd, with analogous content). I don't know what is rcode=3 mean
here, but maybe this whole info is sufficient to say that there
is no such name on network? I don't know also about multiply
wins servers etc, and there is some differences for "non-winpopup"
name resolution...

Regards,
  Michael.

P.S. Here is a patch for client/client.c.
P.P.S. All code is "in sync" with cvs, so this two questions are
against latest sources.

--- client.c.orig       Mon Oct 25 21:44:41 1999
+++ client.c    Mon Oct 25 21:42:54 1999
@@ -2076,6 +2076,12 @@

	ip = ipzero;
	if (have_ip) ip = dest_ip;
+	else if (!resolve_name( desthost, &ip, name_type )) {
+		DEBUG(0,("Unable to resolve name %s\n", desthost));
+		return 1;
+	}

	if (!(cli=cli_initialise(NULL)) || !cli_connect(cli, desthost, &ip)) {
		DEBUG(0,("Connection to %s failed\n", desthost));


More information about the samba-technical mailing list