]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
r6291: BUG 2588: force smbclient messages to port 139 unless someone set the -p option
authorGerald Carter <jerry@samba.org>
Mon, 11 Apr 2005 03:34:27 +0000 (03:34 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:56:35 +0000 (10:56 -0500)
source/client/client.c

index 204e51d4cc395c14ba25cf72552d7814afece911..604bf0989a8f5cec5045bc36214bfab1af3126d5 100644 (file)
@@ -3252,6 +3252,7 @@ static int do_message_op(void)
        struct nmb_name called, calling;
        fstring server_name;
        char name_type_hex[10];
+       int msg_port;
 
        make_nmb_name(&calling, calling_name, 0x0);
        make_nmb_name(&called , desthost, name_type);
@@ -3264,7 +3265,11 @@ static int do_message_op(void)
        if (have_ip) 
                ip = dest_ip;
 
-       if (!(cli=cli_initialise(NULL)) || (cli_set_port(cli, port) != port) ||
+       /* we can only do messages over port 139 (to windows clients at least) */
+
+       msg_port = port ? port : 139;
+
+       if (!(cli=cli_initialise(NULL)) || (cli_set_port(cli, msg_port) != msg_port) ||
            !cli_connect(cli, server_name, &ip)) {
                d_printf("Connection to %s failed\n", desthost);
                return 1;