mirror of
https://github.com/samba-team/samba.git
synced 2025-11-07 12:23:51 +03:00
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 commit is contained in:
@@ -89,7 +89,7 @@ static char *form_name(int c)
|
|||||||
char *p;
|
char *p;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
fstrcpy(fname, "\\utable\\x");
|
fstrcpy(fname, "\\utable\\");
|
||||||
p = fname+strlen(fname);
|
p = fname+strlen(fname);
|
||||||
SSVAL(&c2, 0, c);
|
SSVAL(&c2, 0, c);
|
||||||
|
|
||||||
@@ -97,7 +97,6 @@ static char *form_name(int c)
|
|||||||
&c2, 2,
|
&c2, 2,
|
||||||
p, sizeof(fname)-strlen(fname));
|
p, sizeof(fname)-strlen(fname));
|
||||||
p[len] = 0;
|
p[len] = 0;
|
||||||
fstrcat(fname,"_a_long_extension");
|
|
||||||
return fname;
|
return fname;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,46 +105,62 @@ BOOL torture_casetable(int dummy)
|
|||||||
static struct cli_state cli;
|
static struct cli_state cli;
|
||||||
char *fname;
|
char *fname;
|
||||||
int fnum;
|
int fnum;
|
||||||
int c;
|
int c, i;
|
||||||
|
#define MAX_EQUIVALENCE 8
|
||||||
printf("starting utable\n");
|
smb_ucs2_t equiv[0x10000][MAX_EQUIVALENCE];
|
||||||
|
printf("starting casetable\n");
|
||||||
|
|
||||||
if (!torture_open_connection(&cli)) {
|
if (!torture_open_connection(&cli)) {
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(equiv, 0, sizeof(equiv));
|
||||||
|
|
||||||
cli_mkdir(&cli, "\\utable");
|
cli_mkdir(&cli, "\\utable");
|
||||||
cli_unlink(&cli, "\\utable\\*");
|
cli_unlink(&cli, "\\utable\\*");
|
||||||
|
|
||||||
for (c=1; c < 0x10000; c++) {
|
for (c=1; c < 0x10000; c++) {
|
||||||
|
size_t size;
|
||||||
|
|
||||||
|
if (c == '.') continue;
|
||||||
|
|
||||||
fname = form_name(c);
|
fname = form_name(c);
|
||||||
fnum = cli_nt_create_full(&cli, fname,
|
fnum = cli_nt_create_full(&cli, fname,
|
||||||
GENERIC_ALL_ACCESS,
|
GENERIC_ALL_ACCESS,
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
FILE_SHARE_NONE,
|
FILE_SHARE_NONE,
|
||||||
FILE_CREATE, 0);
|
FILE_OPEN_IF, 0);
|
||||||
|
|
||||||
if (fnum == -1 &&
|
if (fnum == -1) continue;
|
||||||
NT_STATUS_EQUAL(cli_nt_error(&cli),NT_STATUS_OBJECT_NAME_COLLISION)) {
|
|
||||||
|
size = 0;
|
||||||
|
|
||||||
|
if (!cli_qfileinfo(&cli, fnum, NULL, &size,
|
||||||
|
NULL, NULL, NULL, NULL, NULL)) continue;
|
||||||
|
|
||||||
|
if (size > 0) {
|
||||||
/* found a character equivalence! */
|
/* found a character equivalence! */
|
||||||
int c2;
|
int c2[MAX_EQUIVALENCE];
|
||||||
|
|
||||||
fnum = cli_nt_create_full(&cli, fname,
|
if (size/sizeof(int) >= MAX_EQUIVALENCE) {
|
||||||
GENERIC_ALL_ACCESS,
|
printf("too many chars match?? size=%d c=0x%04x\n",
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
size, c);
|
||||||
FILE_SHARE_NONE,
|
cli_close(&cli, fnum);
|
||||||
FILE_OPEN, 0);
|
return False;
|
||||||
if (fnum == -1 ||
|
|
||||||
cli_read(&cli, fnum, (char *)&c2, 0, sizeof(c2)) != sizeof(c2)) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%04x == %04x\n", c, c2);
|
cli_read(&cli, fnum, (char *)c2, 0, size);
|
||||||
cli_close(&cli, fnum);
|
printf("%04x: ", c);
|
||||||
continue;
|
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);
|
cli_close(&cli, fnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user