summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-08-22 22:39:39 +0000
committerAndrew Tridgell <tridge@samba.org>2001-08-22 22:39:39 +0000
commitc5004cf0e6014fd8b1776c7d717560b347495bed (patch)
tree6de3f037e30ac3a2ceadab91ece47e93668828ca
parent2051bb7d0366e07c5ecda5e5f7cfedc4153d6228 (diff)
downloadsamba-c5004cf0e6014fd8b1776c7d717560b347495bed.tar.gz
samba-c5004cf0e6014fd8b1776c7d717560b347495bed.tar.bz2
samba-c5004cf0e6014fd8b1776c7d717560b347495bed.zip
added port 445 support to our client code
(This used to be commit 0c3120ae475fb53662d6ab9f0d96a832c3c90625)
-rw-r--r--source3/libsmb/cliconnect.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 982ac544cf..eb14f54b1a 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -269,8 +269,13 @@ BOOL cli_send_tconX(struct cli_state *cli,
}
}
- slprintf(fullshare, sizeof(fullshare)-1,
- "\\\\%s\\%s", cli->desthost, share);
+ if (cli->port == 445) {
+ slprintf(fullshare, sizeof(fullshare)-1,
+ "%s", share);
+ } else {
+ slprintf(fullshare, sizeof(fullshare)-1,
+ "\\\\%s\\%s", "foo", share);
+ }
set_message(cli->outbuf,4, 0, True);
CVAL(cli->outbuf,smb_com) = SMBtconX;
@@ -474,6 +479,9 @@ BOOL cli_session_request(struct cli_state *cli,
int len = 4;
extern pstring user_socket_options;
+ /* 445 doesn't have session request */
+ if (cli->port == 445) return True;
+
/* send a session request (RFC 1002) */
memcpy(&(cli->calling), calling, sizeof(*calling));
@@ -578,13 +586,19 @@ BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip)
cli->dest_ip = *ip;
}
- if (cli->port == 0) cli->port = 139; /* Set to default */
-
if (getenv("LIBSMB_PROG")) {
cli->fd = sock_exec(getenv("LIBSMB_PROG"));
} else {
+ /* try 445 first, then 139 */
+ int port = cli->port?cli->port:445;
cli->fd = open_socket_out(SOCK_STREAM, &cli->dest_ip,
- cli->port, cli->timeout);
+ port, cli->timeout);
+ if (cli->fd == -1 && cli->port == 0) {
+ port = 139;
+ cli->fd = open_socket_out(SOCK_STREAM, &cli->dest_ip,
+ port, cli->timeout);
+ }
+ if (cli->fd != -1) cli->port = port;
}
if (cli->fd == -1)
return False;