1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-08 05:57:51 +03:00

Make the mangleing code actually use a common prefix, not just the same

name for many files.  Also report complete failure to create a filename as
a failure of the test.

Andrew Bartlett
This commit is contained in:
Andrew Bartlett -
parent 616b6dd60f
commit ce572df77f

View File

@ -135,7 +135,12 @@ static void gen_name(char *name)
/* and a medium probability of a common lead string */ /* and a medium probability of a common lead string */
if (random() % 10 == 0) { if (random() % 10 == 0) {
strncpy(p, "ABCDE", 6); if (strlen(p) <= 5) {
fstrcpy(p, "ABCDE");
} else {
/* try not to kill off the null termination */
memcpy(p, "ABCDE", 5);
}
} }
/* and a high probability of a good extension length */ /* and a high probability of a good extension length */
@ -153,6 +158,7 @@ BOOL torture_mangle(int dummy)
extern int torture_numops; extern int torture_numops;
static struct cli_state *cli; static struct cli_state *cli;
int i; int i;
BOOL ret = True;
printf("starting mangle test\n"); printf("starting mangle test\n");
@ -177,10 +183,12 @@ BOOL torture_mangle(int dummy)
for (i=0;i<torture_numops;i++) { for (i=0;i<torture_numops;i++) {
fstring name; fstring name;
ZERO_STRUCT(name);
gen_name(name); gen_name(name);
if (!test_one(cli, name)) { if (!test_one(cli, name)) {
ret = False;
break; break;
} }
if (total && total % 100 == 0) { if (total && total % 100 == 0) {
@ -201,5 +209,5 @@ BOOL torture_mangle(int dummy)
torture_close_connection(cli); torture_close_connection(cli);
printf("mangle test finished\n"); printf("mangle test finished\n");
return (failures == 0); return (ret && (failures == 0));
} }