summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-07-10 09:39:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:58 -0500
commit70b5c605c0b7decca818536c5434519a027b2a61 (patch)
tree8e12931d40a0a7e096047df7879bf5b8a761851c
parent977e44c556c76ee6df9359124807e003e4dc3257 (diff)
downloadsamba-70b5c605c0b7decca818536c5434519a027b2a61.tar.gz
samba-70b5c605c0b7decca818536c5434519a027b2a61.tar.bz2
samba-70b5c605c0b7decca818536c5434519a027b2a61.zip
r16909: Change torture_open_connection to look at torture:unclist.
Volker (This used to be commit 3413ad5c31b24d490744ad61229372ef74a707b0)
-rw-r--r--source4/torture/util_smb.c56
1 files changed, 24 insertions, 32 deletions
diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c
index 789a609275..a4e8e198bb 100644
--- a/source4/torture/util_smb.c
+++ b/source4/torture/util_smb.c
@@ -486,6 +486,28 @@ _PUBLIC_ BOOL torture_open_connection(struct smbcli_state **c, int conn_index)
{
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 @@ double torture_create_procs(BOOL (*fn)(struct smbcli_state *, int), BOOL *result
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 @@ double torture_create_procs(BOOL (*fn)(struct smbcli_state *, int), BOOL *result
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 @@ double torture_create_procs(BOOL (*fn)(struct smbcli_state *, int), BOOL *result
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 @@ double torture_create_procs(BOOL (*fn)(struct smbcli_state *, int), BOOL *result
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,
- &current_cli,
- hostname,
- sharename,
- NULL)) {
- break;
- }
- } else if (torture_open_connection(&current_cli, 0)) {
- break;
+ if (torture_open_connection(&current_cli, i)) {
+ break;
}
if (tries-- == 0) {
printf("pid %d failed to start\n", (int)getpid());