smbclient bug in 2.2.5

jra at dp.samba.org jra at dp.samba.org
Wed Oct 2 20:48:01 GMT 2002


On Wed, Oct 02, 2002 at 09:26:08AM -0700, Andrew Morgan wrote:
> 
> I think I've found a bug in the smbclient program in 2.2.5.  Smbclient
> hard-codes the name_type to 0x20 (File Server) for all netbios queries,
> but calling 'smbclient -M machine' should use a name_type of 0x03
> (Messenger) instead.
> 
> When sending a message to a machine, it is not necessary for the machine
> to be running file sharing.  Our client machines have file sharing turned
> off and do not register 0x20 with the WINS server.  I'm not sure when this
> behavior changed, but the smbclient program from samba 2.0.10 works
> correctly.

Try this patch - I'm going to commit to all branches...

Jeremy.

Index: client/client.c
===================================================================
RCS file: /data/cvs/samba/source/client/client.c,v
retrieving revision 1.148.2.30
diff -u -r1.148.2.30 client.c
--- client/client.c     27 Aug 2002 14:49:19 -0000      1.148.2.30
+++ client/client.c     2 Oct 2002 20:46:31 -0000
@@ -2422,8 +2422,9 @@
 }

 /****************************************************************************
-handle a message operation
+ Handle a message operation.
 ****************************************************************************/
+
 static int do_message_op(void)
 {
        struct in_addr ip;
@@ -2435,7 +2436,15 @@
        make_nmb_name(&called , desthost, name_type);

        zero_ip(&ip);
-       if (have_ip) ip = dest_ip;
+       if (have_ip)
+               ip = dest_ip;
+       else if (name_type != 0x20) {
+               /* We must do our own resolve name here as the nametype is #0x3, not #0x20. */
+               if (!resolve_name(desthost, &ip, name_type)) {
+                       DEBUG(0,("Cannot resolve name %s#0x%x\n", desthost, name_type));
+                       return 1;
+               }
+       }

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




More information about the samba-technical mailing list