1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-29 13:49:30 +03:00

r5963: Fix parameter passing for gentest and locktest

(This used to be commit 28914c89dc)
This commit is contained in:
Jelmer Vernooij
2005-03-22 19:30:59 +00:00
committed by Gerald (Jerry) Carter
parent 1bb3e99d06
commit 88a5f8b26f
2 changed files with 21 additions and 17 deletions

View File

@ -60,7 +60,7 @@ static struct {
struct smbcli_state *cli[NINSTANCES]; struct smbcli_state *cli[NINSTANCES];
char *server_name; char *server_name;
char *share_name; char *share_name;
struct cli_credentials credentials; struct cli_credentials *credentials;
} servers[NSERVERS]; } servers[NSERVERS];
/* the seeds and flags for each operation */ /* the seeds and flags for each operation */
@ -175,13 +175,13 @@ static BOOL connect_servers(void)
NTSTATUS status; NTSTATUS status;
printf("Connecting to \\\\%s\\%s as %s - instance %d\n", printf("Connecting to \\\\%s\\%s as %s - instance %d\n",
servers[i].server_name, servers[i].share_name, servers[i].server_name, servers[i].share_name,
servers[i].credentials.username, j); servers[i].credentials->username, j);
status = smbcli_full_connection(NULL, &servers[i].cli[j], status = smbcli_full_connection(NULL, &servers[i].cli[j],
"gentest", "gentest",
servers[i].server_name, servers[i].server_name,
servers[i].share_name, NULL, servers[i].share_name, NULL,
&servers[i].credentials); servers[i].credentials);
if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to \\\\%s\\%s - %s\n", printf("Failed to connect to \\\\%s\\%s - %s\n",
servers[i].server_name, servers[i].share_name, servers[i].server_name, servers[i].share_name,
@ -2115,6 +2115,7 @@ static void usage(void)
for (i=0;i<NSERVERS;i++) { for (i=0;i<NSERVERS;i++) {
const char *share = argv[1+i]; const char *share = argv[1+i];
servers[i].credentials = cli_credentials_init(NULL);
if (!split_unc_name(share, &servers[i].server_name, &servers[i].share_name)) { if (!split_unc_name(share, &servers[i].server_name, &servers[i].share_name)) {
printf("Invalid share name '%s'\n", share); printf("Invalid share name '%s'\n", share);
return -1; return -1;
@ -2135,8 +2136,8 @@ static void usage(void)
while ((opt = getopt(argc, argv, "U:s:o:ad:i:AOhS:LFXC")) != EOF) { while ((opt = getopt(argc, argv, "U:s:o:ad:i:AOhS:LFXC")) != EOF) {
switch (opt) { switch (opt) {
case 'U': case 'U':
i = servers[0].credentials.username?1:0; i = servers[0].credentials->username?1:0;
cli_credentials_parse_string(&servers[0].credentials, optarg, CRED_SPECIFIED); cli_credentials_parse_string(servers[i].credentials, optarg, CRED_SPECIFIED);
break; break;
case 'd': case 'd':
DEBUGLEVEL = atoi(optarg); DEBUGLEVEL = atoi(optarg);
@ -2186,13 +2187,13 @@ static void usage(void)
gentest_init_subsystems; gentest_init_subsystems;
if (!servers[0].credentials.username) { if (!servers[0].credentials->username) {
usage(); usage();
return -1; return -1;
} }
if (!servers[1].credentials.username) { if (!servers[1].credentials->username) {
servers[1].credentials.username = servers[0].credentials.username; servers[1].credentials->username = servers[0].credentials->username;
servers[1].credentials.password = servers[0].credentials.password; servers[1].credentials->password = servers[0].credentials->password;
} }
printf("seed=%u\n", options.seed); printf("seed=%u\n", options.seed);

View File

@ -47,7 +47,7 @@ static BOOL zero_zero;
#define NASTY_POSIX_LOCK_HACK 0 #define NASTY_POSIX_LOCK_HACK 0
static struct cli_credentials servers[NSERVERS]; static struct cli_credentials *servers[NSERVERS];
enum lock_op {OP_LOCK, OP_UNLOCK, OP_REOPEN}; enum lock_op {OP_LOCK, OP_UNLOCK, OP_REOPEN};
@ -121,7 +121,7 @@ static struct smbcli_state *connect_one(char *share, int snum)
status = smbcli_full_connection(NULL, &c, myname, status = smbcli_full_connection(NULL, &c, myname,
server, server,
share, NULL, share, NULL,
&servers[snum]); servers[snum]);
if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_IS_OK(status)) {
sleep(2); sleep(2);
} }
@ -477,13 +477,16 @@ static void usage(void)
lp_load(dyn_CONFIGFILE,True,False,False); lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces(); load_interfaces();
servers[0] = cli_credentials_init(talloc_autofree_context());
servers[1] = cli_credentials_init(talloc_autofree_context());
seed = time(NULL); seed = time(NULL);
while ((opt = getopt(argc, argv, "U:s:ho:aAW:OR:B:M:EZW:")) != EOF) { while ((opt = getopt(argc, argv, "U:s:ho:aAW:OR:B:M:EZW:")) != EOF) {
switch (opt) { switch (opt) {
case 'U': case 'U':
i = servers[0].username?1:0; i = servers[0]->username?1:0;
cli_credentials_parse_string(&servers[0], optarg, CRED_SPECIFIED); cli_credentials_parse_string(servers[i], optarg, CRED_SPECIFIED);
break; break;
case 'R': case 'R':
@ -531,13 +534,13 @@ static void usage(void)
} }
} }
if (!servers[0].username) { if (!servers[0]->username) {
usage(); usage();
return -1; return -1;
} }
if (!servers[1].username) { if (!servers[1]->username) {
servers[1].username = servers[0].username; servers[1]->username = servers[0]->username;
servers[1].password = servers[0].password; servers[1]->password = servers[0]->password;
} }
locktest_init_subsystems; locktest_init_subsystems;