Add code to allow us to specify the port to connect on when performing
authorRichard Sharpe <sharpe@samba.org>
Wed, 5 Mar 2003 23:29:36 +0000 (23:29 +0000)
committerRichard Sharpe <sharpe@samba.org>
Wed, 5 Mar 2003 23:29:36 +0000 (23:29 +0000)
a test ...
(This used to be commit 1128a2fb4c16681e669efe605ff7d7161a2f7acd)

source3/torture/torture.c

index fe53baae7e197ff93268351c9737f8d6c19f442a..1744d3109c16f14e950d96ff955b9611abc4c84a 100644 (file)
@@ -26,6 +26,7 @@ static fstring host, workgroup, share, password, username, myname;
 static int max_protocol = PROTOCOL_NT1;
 static const char *sockops="TCP_NODELAY";
 static int nprocs=1;
+static int port_to_use=0;
 int torture_numops=100;
 static int procnum; /* records process count number when forking */
 static struct cli_state current_cli;
@@ -104,7 +105,14 @@ static BOOL open_nbt_connection(struct cli_state *c)
 
         zero_ip(&ip);
 
-       if (!cli_initialise(c) || !cli_connect(c, host, &ip)) {
+       if (!cli_initialise(c)) {
+               printf("Failed initialize cli_struct to connect with %s\n", host);
+               return False;
+       }
+
+       c->port = port_to_use;
+
+       if (!cli_connect(c, host, &ip)) {
                printf("Failed to connect with %s\n", host);
                return False;
        }
@@ -4191,6 +4199,7 @@ static void usage(void)
        printf("\t-L use oplocks\n");
        printf("\t-c CLIENT.TXT   specify client load file for NBENCH\n");
        printf("\t-A showall\n");
+       printf("\t-p port\n");
        printf("\t-s seed\n");
        printf("\n\n");
 
@@ -4205,10 +4214,6 @@ static void usage(void)
        exit(1);
 }
 
-
-
-
-
 /****************************************************************************
   main program
 ****************************************************************************/
@@ -4264,8 +4269,11 @@ static void usage(void)
 
        fstrcpy(workgroup, lp_workgroup());
 
-       while ((opt = getopt(argc, argv, "hW:U:n:N:O:o:m:Ld:Ac:ks:")) != EOF) {
+       while ((opt = getopt(argc, argv, "p:hW:U:n:N:O:o:m:Ld:Ac:ks:")) != EOF) {
                switch (opt) {
+               case 'p':
+                       port_to_use = atoi(optarg);
+                       break;
                case 's':
                        srandom(atoi(optarg));
                        break;