summaryrefslogtreecommitdiff
path: root/source3/libsmb/clientgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libsmb/clientgen.c')
-rw-r--r--source3/libsmb/clientgen.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index e269011402..a1a5bbf0a9 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -27,6 +27,19 @@
extern int DEBUGLEVEL;
+/*
+ * set the port that will be used for connections by the client
+ */
+
+int cli_set_port(struct cli_state *cli, int port)
+{
+
+ if (port != 0)
+ cli -> port = port;
+
+ return cli -> port; /* return it incase caller wants it */
+
+}
/****************************************************************************
recv an smb
@@ -2355,8 +2368,10 @@ BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip)
}
+ if (cli -> port == 0) cli -> port = 139;
+
cli->fd = open_socket_out(SOCK_STREAM, &cli->dest_ip,
- 139, cli->timeout);
+ cli -> port, cli->timeout);
if (cli->fd == -1)
return False;
@@ -2382,6 +2397,7 @@ struct cli_state *cli_initialise(struct cli_state *cli)
ZERO_STRUCTP(cli);
+ cli -> port = 0;
cli->fd = -1;
cli->cnum = -1;
cli->pid = (uint16)getpid();