diff options
author | Luke Leighton <lkcl@samba.org> | 1999-08-03 17:43:12 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-08-03 17:43:12 +0000 |
commit | ebfa9fa928c7efc2313deb576373da7c536a2aad (patch) | |
tree | e863a3b305ba2d2e207a1e64145b4d544445619e /source3 | |
parent | 80d714e75b48b6ed75de48ea0ca878736eb9b259 (diff) | |
download | samba-ebfa9fa928c7efc2313deb576373da7c536a2aad.tar.gz samba-ebfa9fa928c7efc2313deb576373da7c536a2aad.tar.bz2 samba-ebfa9fa928c7efc2313deb576373da7c536a2aad.zip |
attempting a connection to port 445 first, followed by a connection to 139
if this fails.
(This used to be commit 5f821e65015c27f5306c3a707841cd0228509974)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/clientgen.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 765160ffe4..1913ccd79b 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -36,9 +36,9 @@ int cli_set_port(struct cli_state *cli, int port) { if (port != 0) - cli -> port = port; + cli->port = port; - return cli -> port; /* return it incase caller wants it */ + return cli->port; /* return it incase caller wants it */ } @@ -2442,6 +2442,11 @@ BOOL cli_session_request(struct cli_state *cli, memcpy(&(cli->calling), calling, sizeof(*calling)); memcpy(&(cli->called ), called , sizeof(*called )); + if (cli->port == 445) + { + return True; + } + /* put in the destination name */ p = cli->outbuf+len; name_mangle(cli->called .name, p, cli->called .name_type); @@ -2490,6 +2495,7 @@ open the client sockets BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip) { extern struct in_addr ipzero; + int port = cli->port; fstrcpy(cli->desthost, host); @@ -2503,12 +2509,23 @@ BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip) } - if (cli -> port == 0) cli -> port = 139; + if (port == 0) port = 445; cli->fd = open_socket_out(SOCK_STREAM, &cli->dest_ip, - cli -> port, cli->timeout); + port, cli->timeout); if (cli->fd == -1) - return False; + { + if (cli->port != 0) + { + return False; + } + port = 139; + + cli->fd = open_socket_out(SOCK_STREAM, &cli->dest_ip, + port, cli->timeout); + if (cli->fd == -1) return False; + } + return True; } @@ -2532,7 +2549,7 @@ struct cli_state *cli_initialise(struct cli_state *cli) ZERO_STRUCTP(cli); - cli -> port = 0; + cli->port = 0; cli->fd = -1; cli->cnum = -1; cli->pid = (uint16)getpid(); |