struct cli_state *cli;
extern BOOL in_client;
+static int port = SMB_PORT;
pstring cur_dir = "\\";
pstring cd_path = "";
static pstring service;
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;
}
{
fstring base_directory;
char *pname = argv[0];
- int port = SMB_PORT;
int opt;
extern FILE *dbf;
extern char *optarg;
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
}
+ 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;
ZERO_STRUCTP(cli);
+ cli -> port = 0;
cli->fd = -1;
cli->cnum = -1;
cli->pid = (uint16)getpid();
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>