summaryrefslogtreecommitdiff
path: root/source3/torture/utable.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/torture/utable.c')
-rw-r--r--source3/torture/utable.c49
1 files changed, 21 insertions, 28 deletions
diff --git a/source3/torture/utable.c b/source3/torture/utable.c
index 74d5f164c0..2b5a912062 100644
--- a/source3/torture/utable.c
+++ b/source3/torture/utable.c
@@ -24,7 +24,7 @@
BOOL torture_utable(int dummy)
{
- struct cli_state *cli;
+ static 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,35 +129,28 @@ BOOL torture_casetable(int dummy)
memset(equiv, 0, sizeof(equiv));
- cli_unlink(cli, "\\utable\\*");
- cli_rmdir(cli, "\\utable");
- if (!cli_mkdir(cli, "\\utable")) {
- printf("Failed to create utable directory!\n");
- return False;
- }
+ cli_mkdir(&cli, "\\utable");
+ cli_unlink(&cli, "\\utable\\*");
for (c=1; c < 0x10000; c++) {
size_t size;
if (c == '.' || c == '\\') continue;
- printf("%04x (%c)\n", c, isprint(c)?c:'.');
+ 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,
FILE_OPEN_IF, 0);
- if (fnum == -1) {
- printf("Failed to create file with char %04x\n", c);
- continue;
- }
+ if (fnum == -1) continue;
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) {
@@ -167,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++) {
@@ -182,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;
}