summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-10-02 13:26:38 +0000
committerAndrew Tridgell <tridge@samba.org>2001-10-02 13:26:38 +0000
commite8547256f3d3c0e51a7715894874de36475ec131 (patch)
tree749ab5e52c4e73d92a299523870984b3f0029def
parentcb4b13a82ba26c70674fe903d89db1d38103dff7 (diff)
downloadsamba-e8547256f3d3c0e51a7715894874de36475ec131.tar.gz
samba-e8547256f3d3c0e51a7715894874de36475ec131.tar.bz2
samba-e8547256f3d3c0e51a7715894874de36475ec131.zip
better method of generating the case equivalence table
interestingly, this shows that w2kp-jp and w2kp have the *same* case equivalence table, but it is not the same as the Samba one. (This used to be commit b97fbfcd7cfbafc40b4be558fb8d6e86ad656cb0)
-rw-r--r--source3/torture/utable.c59
1 files changed, 37 insertions, 22 deletions
diff --git a/source3/torture/utable.c b/source3/torture/utable.c
index ea36487f64..daf9bd49d6 100644
--- a/source3/torture/utable.c
+++ b/source3/torture/utable.c
@@ -89,7 +89,7 @@ static char *form_name(int c)
char *p;
int len;
- fstrcpy(fname, "\\utable\\x");
+ fstrcpy(fname, "\\utable\\");
p = fname+strlen(fname);
SSVAL(&c2, 0, c);
@@ -97,7 +97,6 @@ static char *form_name(int c)
&c2, 2,
p, sizeof(fname)-strlen(fname));
p[len] = 0;
- fstrcat(fname,"_a_long_extension");
return fname;
}
@@ -106,46 +105,62 @@ BOOL torture_casetable(int dummy)
static struct cli_state cli;
char *fname;
int fnum;
- int c;
-
- printf("starting utable\n");
+ int c, i;
+#define MAX_EQUIVALENCE 8
+ smb_ucs2_t equiv[0x10000][MAX_EQUIVALENCE];
+ printf("starting casetable\n");
if (!torture_open_connection(&cli)) {
return False;
}
+ memset(equiv, 0, sizeof(equiv));
+
cli_mkdir(&cli, "\\utable");
cli_unlink(&cli, "\\utable\\*");
for (c=1; c < 0x10000; c++) {
+ size_t size;
+
+ if (c == '.') continue;
+
fname = form_name(c);
fnum = cli_nt_create_full(&cli, fname,
GENERIC_ALL_ACCESS,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_NONE,
- FILE_CREATE, 0);
+ FILE_OPEN_IF, 0);
- if (fnum == -1 &&
- NT_STATUS_EQUAL(cli_nt_error(&cli),NT_STATUS_OBJECT_NAME_COLLISION)) {
+ if (fnum == -1) continue;
+
+ size = 0;
+
+ if (!cli_qfileinfo(&cli, fnum, NULL, &size,
+ NULL, NULL, NULL, NULL, NULL)) continue;
+
+ if (size > 0) {
/* found a character equivalence! */
- int c2;
-
- fnum = cli_nt_create_full(&cli, fname,
- GENERIC_ALL_ACCESS,
- FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_NONE,
- FILE_OPEN, 0);
- if (fnum == -1 ||
- cli_read(&cli, fnum, (char *)&c2, 0, sizeof(c2)) != sizeof(c2)) {
- continue;
+ int c2[MAX_EQUIVALENCE];
+
+ if (size/sizeof(int) >= MAX_EQUIVALENCE) {
+ printf("too many chars match?? size=%d c=0x%04x\n",
+ size, c);
+ cli_close(&cli, fnum);
+ return False;
}
- printf("%04x == %04x\n", c, c2);
- cli_close(&cli, fnum);
- continue;
+ cli_read(&cli, fnum, (char *)c2, 0, size);
+ printf("%04x: ", c);
+ equiv[c][0] = c;
+ for (i=0; i<size/sizeof(int); i++) {
+ printf("%04x ", c2[i]);
+ equiv[c][i+1] = c2[i];
+ }
+ printf("\n");
+ fflush(stdout);
}
- cli_write(&cli, fnum, 0, (char *)&c, 0, sizeof(c));
+ cli_write(&cli, fnum, 0, (char *)&c, size, sizeof(c));
cli_close(&cli, fnum);
}