Author: vlendec Date: 2006-07-10 09:39:14 +0000 (Mon, 10 Jul 2006) New Revision: 16909
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16909 Log: Change torture_open_connection to look at torture:unclist. Volker Modified: branches/SAMBA_4_0/source/torture/util_smb.c Changeset: Modified: branches/SAMBA_4_0/source/torture/util_smb.c =================================================================== --- branches/SAMBA_4_0/source/torture/util_smb.c 2006-07-10 08:31:47 UTC (rev 16908) +++ branches/SAMBA_4_0/source/torture/util_smb.c 2006-07-10 09:39:14 UTC (rev 16909) @@ -486,7 +486,29 @@ { const char *host = lp_parm_string(-1, "torture", "host"); const char *share = lp_parm_string(-1, "torture", "share"); + char **unc_list = NULL; + int num_unc_names = 0; + const char *p; + + p = lp_parm_string(-1, "torture", "unclist"); + if (p) { + char *h, *s; + unc_list = file_lines_load(p, &num_unc_names, NULL); + if (!unc_list || num_unc_names <= 0) { + printf("Failed to load unc names list from '%s'\n", p); + exit(1); + } + if (!smbcli_parse_unc(unc_list[conn_index % num_unc_names], + NULL, &h, &s)) { + printf("Failed to parse UNC name %s\n", + unc_list[conn_index % num_unc_names]); + exit(1); + } + host = h; + share = s; + } + return torture_open_connection_share(NULL, c, host, share, NULL); } @@ -558,9 +580,6 @@ int synccount; int tries = 8; double start_time_limit = 10 + (torture_nprocs * 1.5); - char **unc_list = NULL; - const char *p; - int num_unc_names = 0; struct timeval tv; *result = True; @@ -581,15 +600,6 @@ return -1; } - p = lp_parm_string(-1, "torture", "unclist"); - if (p) { - unc_list = file_lines_load(p, &num_unc_names, NULL); - if (!unc_list || num_unc_names <= 0) { - printf("Failed to load unc names list from '%s'\n", p); - exit(1); - } - } - for (i = 0; i < torture_nprocs; i++) { child_status[i] = 0; child_status_out[i] = True; @@ -601,7 +611,6 @@ procnum = i; if (fork() == 0) { char *myname; - char *hostname=NULL, *sharename; pid_t mypid = getpid(); srandom(((int)mypid) ^ ((int)time(NULL))); @@ -611,26 +620,9 @@ free(myname); - if (unc_list) { - if (!smbcli_parse_unc(unc_list[i % num_unc_names], - NULL, &hostname, &sharename)) { - printf("Failed to parse UNC name %s\n", - unc_list[i % num_unc_names]); - exit(1); - } - } - while (1) { - if (hostname) { - if (torture_open_connection_share(NULL, - ¤t_cli, - hostname, - sharename, - NULL)) { - break; - } - } else if (torture_open_connection(¤t_cli, 0)) { - break; + if (torture_open_connection(¤t_cli, i)) { + break; } if (tries-- == 0) { printf("pid %d failed to start\n", (int)getpid());