mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
Make smbtorture use the same cli_full_connection() framework as the rest of
Samba. This fixes things like not doing *SMBSERVER etc.
Andrew Bartlett
(This used to be commit 8863ff863c
)
This commit is contained in:
parent
6684c85714
commit
ca0d82b11c
@ -1408,7 +1408,7 @@ static void progress_bar(unsigned i, unsigned total)
|
||||
*/
|
||||
BOOL torture_denytest1(int dummy)
|
||||
{
|
||||
static struct cli_state cli1;
|
||||
struct cli_state *cli1;
|
||||
int fnum1, fnum2;
|
||||
int i;
|
||||
BOOL correct = True;
|
||||
@ -1421,10 +1421,10 @@ BOOL torture_denytest1(int dummy)
|
||||
printf("starting denytest1\n");
|
||||
|
||||
for (i=0;i<2;i++) {
|
||||
cli_unlink(&cli1, fnames[i]);
|
||||
fnum1 = cli_open(&cli1, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
|
||||
cli_write(&cli1, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
|
||||
cli_close(&cli1, fnum1);
|
||||
cli_unlink(cli1, fnames[i]);
|
||||
fnum1 = cli_open(cli1, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
|
||||
cli_write(cli1, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
|
||||
cli_close(cli1, fnum1);
|
||||
}
|
||||
|
||||
printf("testing %d entries\n", ARRAY_SIZE(denytable1));
|
||||
@ -1435,10 +1435,10 @@ BOOL torture_denytest1(int dummy)
|
||||
|
||||
progress_bar(i, ARRAY_SIZE(denytable1));
|
||||
|
||||
fnum1 = cli_open(&cli1, fname,
|
||||
fnum1 = cli_open(cli1, fname,
|
||||
denytable1[i].mode1,
|
||||
denytable1[i].deny1);
|
||||
fnum2 = cli_open(&cli1, fname,
|
||||
fnum2 = cli_open(cli1, fname,
|
||||
denytable1[i].mode2,
|
||||
denytable1[i].deny2);
|
||||
|
||||
@ -1449,10 +1449,10 @@ BOOL torture_denytest1(int dummy)
|
||||
} else {
|
||||
char x = 1;
|
||||
res = A_0;
|
||||
if (cli_read(&cli1, fnum2, (void *)&x, 0, 1) == 1) {
|
||||
if (cli_read(cli1, fnum2, (void *)&x, 0, 1) == 1) {
|
||||
res += A_R;
|
||||
}
|
||||
if (cli_write(&cli1, fnum2, 0, (void *)&x, 0, 1) == 1) {
|
||||
if (cli_write(cli1, fnum2, 0, (void *)&x, 0, 1) == 1) {
|
||||
res += A_W;
|
||||
}
|
||||
}
|
||||
@ -1472,15 +1472,15 @@ BOOL torture_denytest1(int dummy)
|
||||
resultstr(denytable1[i].result));
|
||||
}
|
||||
|
||||
cli_close(&cli1, fnum1);
|
||||
cli_close(&cli1, fnum2);
|
||||
cli_close(cli1, fnum1);
|
||||
cli_close(cli1, fnum2);
|
||||
}
|
||||
|
||||
for (i=0;i<2;i++) {
|
||||
cli_unlink(&cli1, fnames[i]);
|
||||
cli_unlink(cli1, fnames[i]);
|
||||
}
|
||||
|
||||
if (!torture_close_connection(&cli1)) {
|
||||
if (!torture_close_connection(cli1)) {
|
||||
correct = False;
|
||||
}
|
||||
|
||||
@ -1494,7 +1494,7 @@ BOOL torture_denytest1(int dummy)
|
||||
*/
|
||||
BOOL torture_denytest2(int dummy)
|
||||
{
|
||||
static struct cli_state cli1, cli2;
|
||||
static struct cli_state *cli1, *cli2;
|
||||
int fnum1, fnum2;
|
||||
int i;
|
||||
BOOL correct = True;
|
||||
@ -1507,10 +1507,10 @@ BOOL torture_denytest2(int dummy)
|
||||
printf("starting denytest2\n");
|
||||
|
||||
for (i=0;i<2;i++) {
|
||||
cli_unlink(&cli1, fnames[i]);
|
||||
fnum1 = cli_open(&cli1, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
|
||||
cli_write(&cli1, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
|
||||
cli_close(&cli1, fnum1);
|
||||
cli_unlink(cli1, fnames[i]);
|
||||
fnum1 = cli_open(cli1, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
|
||||
cli_write(cli1, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
|
||||
cli_close(cli1, fnum1);
|
||||
}
|
||||
|
||||
for (i=0; i<ARRAY_SIZE(denytable2); i++) {
|
||||
@ -1519,10 +1519,10 @@ BOOL torture_denytest2(int dummy)
|
||||
|
||||
progress_bar(i, ARRAY_SIZE(denytable1));
|
||||
|
||||
fnum1 = cli_open(&cli1, fname,
|
||||
fnum1 = cli_open(cli1, fname,
|
||||
denytable2[i].mode1,
|
||||
denytable2[i].deny1);
|
||||
fnum2 = cli_open(&cli2, fname,
|
||||
fnum2 = cli_open(cli2, fname,
|
||||
denytable2[i].mode2,
|
||||
denytable2[i].deny2);
|
||||
|
||||
@ -1533,10 +1533,10 @@ BOOL torture_denytest2(int dummy)
|
||||
} else {
|
||||
char x = 1;
|
||||
res = A_0;
|
||||
if (cli_read(&cli2, fnum2, (void *)&x, 0, 1) == 1) {
|
||||
if (cli_read(cli2, fnum2, (void *)&x, 0, 1) == 1) {
|
||||
res += A_R;
|
||||
}
|
||||
if (cli_write(&cli2, fnum2, 0, (void *)&x, 0, 1) == 1) {
|
||||
if (cli_write(cli2, fnum2, 0, (void *)&x, 0, 1) == 1) {
|
||||
res += A_W;
|
||||
}
|
||||
}
|
||||
@ -1556,18 +1556,18 @@ BOOL torture_denytest2(int dummy)
|
||||
resultstr(denytable2[i].result));
|
||||
}
|
||||
|
||||
cli_close(&cli1, fnum1);
|
||||
cli_close(&cli2, fnum2);
|
||||
cli_close(cli1, fnum1);
|
||||
cli_close(cli2, fnum2);
|
||||
}
|
||||
|
||||
for (i=0;i<2;i++) {
|
||||
cli_unlink(&cli1, fnames[i]);
|
||||
cli_unlink(cli1, fnames[i]);
|
||||
}
|
||||
|
||||
if (!torture_close_connection(&cli1)) {
|
||||
if (!torture_close_connection(cli1)) {
|
||||
correct = False;
|
||||
}
|
||||
if (!torture_close_connection(&cli2)) {
|
||||
if (!torture_close_connection(cli2)) {
|
||||
correct = False;
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ static void gen_name(char *name)
|
||||
BOOL torture_mangle(int dummy)
|
||||
{
|
||||
extern int torture_numops;
|
||||
static struct cli_state cli;
|
||||
static struct cli_state *cli;
|
||||
int i;
|
||||
|
||||
printf("starting mangle test\n");
|
||||
@ -167,10 +167,10 @@ BOOL torture_mangle(int dummy)
|
||||
return False;
|
||||
}
|
||||
|
||||
cli_unlink(&cli, "\\mangle_test\\*");
|
||||
cli_rmdir(&cli, "\\mangle_test");
|
||||
cli_unlink(cli, "\\mangle_test\\*");
|
||||
cli_rmdir(cli, "\\mangle_test");
|
||||
|
||||
if (!cli_mkdir(&cli, "\\mangle_test")) {
|
||||
if (!cli_mkdir(cli, "\\mangle_test")) {
|
||||
printf("ERROR: Failed to make directory\n");
|
||||
return False;
|
||||
}
|
||||
@ -180,7 +180,7 @@ BOOL torture_mangle(int dummy)
|
||||
|
||||
gen_name(name);
|
||||
|
||||
if (!test_one(&cli, name)) {
|
||||
if (!test_one(cli, name)) {
|
||||
break;
|
||||
}
|
||||
if (total && total % 100 == 0) {
|
||||
@ -189,8 +189,8 @@ BOOL torture_mangle(int dummy)
|
||||
}
|
||||
}
|
||||
|
||||
cli_unlink(&cli, "\\mangle_test\\*");
|
||||
if (!cli_rmdir(&cli, "\\mangle_test")) {
|
||||
cli_unlink(cli, "\\mangle_test\\*");
|
||||
if (!cli_rmdir(cli, "\\mangle_test")) {
|
||||
printf("ERROR: Failed to remove directory\n");
|
||||
return False;
|
||||
}
|
||||
@ -198,7 +198,7 @@ BOOL torture_mangle(int dummy)
|
||||
printf("\nTotal collisions %u/%u - %.2f%% (%u failures)\n",
|
||||
collisions, total, (100.0*collisions) / total, failures);
|
||||
|
||||
torture_close_connection(&cli);
|
||||
torture_close_connection(cli);
|
||||
|
||||
printf("mangle test finished\n");
|
||||
return (failures == 0);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -24,7 +24,7 @@
|
||||
|
||||
BOOL torture_utable(int dummy)
|
||||
{
|
||||
static struct cli_state cli;
|
||||
struct cli_state *cli;
|
||||
fstring fname, alt_name;
|
||||
int fnum;
|
||||
smb_ucs2_t c2;
|
||||
@ -40,8 +40,8 @@ BOOL torture_utable(int dummy)
|
||||
|
||||
memset(valid, 0, sizeof(valid));
|
||||
|
||||
cli_mkdir(&cli, "\\utable");
|
||||
cli_unlink(&cli, "\\utable\\*");
|
||||
cli_mkdir(cli, "\\utable");
|
||||
cli_unlink(cli, "\\utable\\*");
|
||||
|
||||
for (c=1; c < 0x10000; c++) {
|
||||
char *p;
|
||||
@ -55,13 +55,13 @@ BOOL torture_utable(int dummy)
|
||||
p[len] = 0;
|
||||
fstrcat(fname,"_a_long_extension");
|
||||
|
||||
fnum = cli_open(&cli, fname, O_RDWR | O_CREAT | O_TRUNC,
|
||||
fnum = cli_open(cli, fname, O_RDWR | O_CREAT | O_TRUNC,
|
||||
DENY_NONE);
|
||||
if (fnum == -1) continue;
|
||||
|
||||
chars_allowed++;
|
||||
|
||||
cli_qpathinfo_alt_name(&cli, fname, alt_name);
|
||||
cli_qpathinfo_alt_name(cli, fname, alt_name);
|
||||
|
||||
if (strncmp(alt_name, "X_A_L", 5) != 0) {
|
||||
alt_allowed++;
|
||||
@ -69,8 +69,8 @@ BOOL torture_utable(int dummy)
|
||||
d_printf("fname=[%s] alt_name=[%s]\n", fname, alt_name);
|
||||
}
|
||||
|
||||
cli_close(&cli, fnum);
|
||||
cli_unlink(&cli, fname);
|
||||
cli_close(cli, fnum);
|
||||
cli_unlink(cli, fname);
|
||||
|
||||
if (c % 100 == 0) {
|
||||
printf("%d (%d/%d)\r", c, chars_allowed, alt_allowed);
|
||||
@ -78,7 +78,7 @@ BOOL torture_utable(int dummy)
|
||||
}
|
||||
printf("%d (%d/%d)\n", c, chars_allowed, alt_allowed);
|
||||
|
||||
cli_rmdir(&cli, "\\utable");
|
||||
cli_rmdir(cli, "\\utable");
|
||||
|
||||
d_printf("%d chars allowed %d alt chars allowed\n", chars_allowed, alt_allowed);
|
||||
|
||||
@ -115,7 +115,7 @@ static char *form_name(int c)
|
||||
|
||||
BOOL torture_casetable(int dummy)
|
||||
{
|
||||
static struct cli_state cli;
|
||||
static struct cli_state *cli;
|
||||
char *fname;
|
||||
int fnum;
|
||||
int c, i;
|
||||
@ -129,8 +129,8 @@ BOOL torture_casetable(int dummy)
|
||||
|
||||
memset(equiv, 0, sizeof(equiv));
|
||||
|
||||
cli_mkdir(&cli, "\\utable");
|
||||
cli_unlink(&cli, "\\utable\\*");
|
||||
cli_mkdir(cli, "\\utable");
|
||||
cli_unlink(cli, "\\utable\\*");
|
||||
|
||||
for (c=1; c < 0x10000; c++) {
|
||||
size_t size;
|
||||
@ -140,7 +140,7 @@ BOOL torture_casetable(int dummy)
|
||||
printf("%04x\n", c);
|
||||
|
||||
fname = form_name(c);
|
||||
fnum = cli_nt_create_full(&cli, fname,
|
||||
fnum = cli_nt_create_full(cli, fname,
|
||||
GENERIC_ALL_ACCESS,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
FILE_SHARE_NONE,
|
||||
@ -150,7 +150,7 @@ BOOL torture_casetable(int dummy)
|
||||
|
||||
size = 0;
|
||||
|
||||
if (!cli_qfileinfo(&cli, fnum, NULL, &size,
|
||||
if (!cli_qfileinfo(cli, fnum, NULL, &size,
|
||||
NULL, NULL, NULL, NULL, NULL)) continue;
|
||||
|
||||
if (size > 0) {
|
||||
@ -160,11 +160,11 @@ BOOL torture_casetable(int dummy)
|
||||
if (size/sizeof(int) >= MAX_EQUIVALENCE) {
|
||||
printf("too many chars match?? size=%d c=0x%04x\n",
|
||||
size, c);
|
||||
cli_close(&cli, fnum);
|
||||
cli_close(cli, fnum);
|
||||
return False;
|
||||
}
|
||||
|
||||
cli_read(&cli, fnum, (char *)c2, 0, size);
|
||||
cli_read(cli, fnum, (char *)c2, 0, size);
|
||||
printf("%04x: ", c);
|
||||
equiv[c][0] = c;
|
||||
for (i=0; i<size/sizeof(int); i++) {
|
||||
@ -175,12 +175,12 @@ BOOL torture_casetable(int dummy)
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
cli_write(&cli, fnum, 0, (char *)&c, size, sizeof(c));
|
||||
cli_close(&cli, fnum);
|
||||
cli_write(cli, fnum, 0, (char *)&c, size, sizeof(c));
|
||||
cli_close(cli, fnum);
|
||||
}
|
||||
|
||||
cli_unlink(&cli, "\\utable\\*");
|
||||
cli_rmdir(&cli, "\\utable");
|
||||
cli_unlink(cli, "\\utable\\*");
|
||||
cli_rmdir(cli, "\\utable");
|
||||
|
||||
return True;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user