patch for smbclient -M username

Bjart Kvarme bjart.kvarme at
Mon Dec 13 12:10:34 GMT 1999

You can use NT's net send command to send messages to users, but with
smbclient this is difficult. You could use nmblookup first to find the ip
number of the user's PC, and then use smbclient -M username -I ip send a
message to username.

The resolving of the username is done by the cli_connect function which uses
the 0x20 name type to determine the ip number of the pc/username. This is
correct if you want a data connection, but it is wrong for a message
connection. This small patch does a resolve of the 0x03 name type before the
call to cli_connect and makes it possible to send messages to users and

% diff -u client/ client/client.c
--- client/ Thu Nov 11 03:35:59 1999
+++ client/client.c     Mon Dec 13 12:48:21 1999
@@ -2144,7 +2144,14 @@
        make_nmb_name(&called , desthost, name_type, "");

        ip = ipzero;
-       if (have_ip) ip = dest_ip;
+       if (have_ip) {
+         ip = dest_ip;
+       } else {
+         if (!resolve_name(desthost, &ip, name_type)) {
+           DEBUG(0,("Resolve of %s failed\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 mailing list