summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorRichard Sharpe <sharpe@samba.org>1999-01-25 01:46:14 +0000
committerRichard Sharpe <sharpe@samba.org>1999-01-25 01:46:14 +0000
commitf5f913b001ab66c2266e3325f8c91af2486116a2 (patch)
treeb9e85ff9d4828317cfecf8dbe30a8d4ccdc52288 /source3
parent444dc51920f648458b6fd6bee1a7309cecb87ad1 (diff)
downloadsamba-f5f913b001ab66c2266e3325f8c91af2486116a2.tar.gz
samba-f5f913b001ab66c2266e3325f8c91af2486116a2.tar.bz2
samba-f5f913b001ab66c2266e3325f8c91af2486116a2.zip
Putting back the -p flag in smbclient.
However, it seems that the -s flag in smbclient is also ignored :-( (This used to be commit f6c78192664d611d4663ed7459a2789315861eec)
Diffstat (limited to 'source3')
-rw-r--r--source3/client/client.c8
-rw-r--r--source3/include/client.h1
-rw-r--r--source3/libsmb/clientgen.c18
-rw-r--r--source3/smbd/ssl.c9
4 files changed, 32 insertions, 4 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 8d6e8a4b3c..afee7dbbd3 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -29,6 +29,7 @@
struct cli_state *cli;
extern BOOL in_client;
+static int port = SMB_PORT;
pstring cur_dir = "\\";
pstring cd_path = "";
static pstring service;
@@ -1642,12 +1643,16 @@ struct cli_state *do_connect(char *server, char *share)
make_nmb_name(&calling, global_myname, 0x0, "");
make_nmb_name(&called , server, name_type, "");
+ if (port == 0)
+ port = 139; /* If not set, set to 139, FIXME, NUMBERS BAD */
+
again:
ip = ipzero;
if (have_ip) ip = dest_ip;
/* have to open a new connection */
- if (!(c=cli_initialise(NULL)) || !cli_connect(c, server_n, &ip)) {
+ if (!(c=cli_initialise(NULL)) || (cli_set_port(c, port) == 0) ||
+ !cli_connect(c, server_n, &ip)) {
DEBUG(0,("Connection to %s failed\n", server_n));
return NULL;
}
@@ -1909,7 +1914,6 @@ static int do_message_op(void)
{
fstring base_directory;
char *pname = argv[0];
- int port = SMB_PORT;
int opt;
extern FILE *dbf;
extern char *optarg;
diff --git a/source3/include/client.h b/source3/include/client.h
index 25f8436079..89bcf49248 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -72,6 +72,7 @@ struct pwd_info
};
struct cli_state {
+ int port;
int fd;
uint16 cnum;
uint16 pid;
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();
diff --git a/source3/smbd/ssl.c b/source3/smbd/ssl.c
index 1c953272c3..1f098b2533 100644
--- a/source3/smbd/ssl.c
+++ b/source3/smbd/ssl.c
@@ -19,9 +19,16 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include "includes.h"
+
+/*
+ * Hmmm, only check on WITH_SSL after we have included includes.h
+ * which pulls in config.h which is where WITH_SSL is defined, if
+ * at all :-)
+ */
+
#ifdef WITH_SSL /* should always be defined if this module is compiled */
-#include "includes.h"
#include <ssl.h>
#include <err.h>