Pete Peterson
2000-Jul-16 17:35 UTC
"smbclient -p <port>" appears to be broken in Samba 2.x
I posted this problem as a question to this list a while ago and got no reply. I submitted it as a bug, but found that "samba-bugs@samba.org", no longer accepts bug reports, even though the web page says to send them to that address. Wondering if the option had been intentionally discontinuted without updating the man page, I made a quick check of the source and found that the "-p <port>" option is still processed in "client.c". I was hoping that there would be a patch available, so I don't have to try to debug it myself. Here again is the description of the problem: ************************************************************ It appears that "smbclient -p <portnumber>" doesn't work as advertised in Samba 2.x. On both Linux 6.2 and Solaris 2.6, independent of firewalls and the like, it works with old Samba (e.g. 1.9.18p10) , but not with new Samba (e.g. 2.0.7). The new version seems to *IGNORE* the port specification and stubbornly attempt to connect to port 139. Here's the result when I try to send a popup message to one of my machines at home. Note that MediaOne blocks the standard NETBIOS ports, so I've chosen a couple other ports. I send the message to port $LINPOP or $NTPOP and my gateway redirects it to port 139 on my Linux machine or my NT machine respectively. Here are two tests from the same Solaris machine, first with the current Samba and second with the 1.19.18p10 version. -------------------- seadog> echo 'some message to home machine' | /opt/samba/bin/smbclient -p $LINPO P -I hashbang.dhs.org -M petep timeout connecting to 24.147.30.33:139 Connection to petep failed -------------------- Note that smbclient tried to connect to port 139, not port $LINPOP. With the old Samba, it works as advertised in the man page: -------------------- seadog> echo 'other message to my home machine' | /usr/local/smbclient -p $LINPO P -I hashbang.dhs.org -M petep Connected. Type your message, ending it with a Control-D sent 34 bytes (status was 0-0) -------------------- I get the same results on Linux versions: the 1.9.xx versions work; the 2.0.x versions ignore the port specification. This appears to be a bug, rather than an out-of-date man page or a misunderstanding on my part, though if it's the latter, that's much easier to fix. :-) pete peterson GenRad, Inc. 7 Technology Park Drive Westford, MA 01886-0033 petersonp@genrad.com or rep@genrad.com +1-978-589-7478 (GenRad); +1-978-256-5829 (Home: Chelmsford, MA) +1-978-589-2088 (Closest FAX); +1-978-589-7007 (Main GenRad FAX)
[Pete Peterson <petersonp@genrad.com>]> It appears that "smbclient -p <portnumber>" doesn't work as > advertised in Samba 2.x.It does work, just not for winpopup messages. (: This patch should fix it. It's untested but almost certainly correct. Samba maintainers please apply. 2.0, HEAD and TNG all have this bug. Peter --- samba-2.0.x/source/client/client.c~ Mon Jul 3 01:15:21 2000 +++ samba-2.0.x/source/client/client.c Sun Jul 16 15:33:34 2000 @@ -2164,7 +2164,8 @@ ip = ipzero; if (have_ip) ip = dest_ip; - if (!(cli=cli_initialise(NULL)) || !cli_connect(cli, desthost, &ip)) { + if (!(cli=cli_initialise(NULL)) || !cli_set_port(cli, port) || + !cli_connect(cli, desthost, &ip)) { DEBUG(0,("Connection to %s failed\n", desthost)); return 1; }