diff options
author | Andrew Tridgell <tridge@samba.org> | 2000-01-16 12:28:43 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2000-01-16 12:28:43 +0000 |
commit | 6389b81f9d272da7ed26bb4df61d57fe2e42b074 (patch) | |
tree | 3056f22ebe6d789bc173e64fae46c512e4fe7510 /source3 | |
parent | b09e4c370e99edb8b206d601b62933b8bed45925 (diff) | |
download | samba-6389b81f9d272da7ed26bb4df61d57fe2e42b074.tar.gz samba-6389b81f9d272da7ed26bb4df61d57fe2e42b074.tar.bz2 samba-6389b81f9d272da7ed26bb4df61d57fe2e42b074.zip |
renamed DENY to DENY1
added DENY2 test that checks all 648 deny combinations for the case
of two opens on the same connection
(This used to be commit 01d4c4784dd26bdfc9883907b3170e8b0ea0cd6f)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/utils/torture.c | 100 |
1 files changed, 95 insertions, 5 deletions
diff --git a/source3/utils/torture.c b/source3/utils/torture.c index fb4367283c..ad14461ff5 100644 --- a/source3/utils/torture.c +++ b/source3/utils/torture.c @@ -869,12 +869,12 @@ static void run_locktest4(int dummy) /* this produces a matrix of deny mode behaviour */ -static void run_denytest(int dummy) +static void run_denytest1(int dummy) { static struct cli_state cli1, cli2; int fnum1, fnum2; int f, d1, d2, o1, o2, x=0; - char *fnames[] = {"denytest.exe", "denytest.dat", NULL}; + char *fnames[] = {"denytest1.exe", "denytest1.dat", NULL}; struct { int v; char *name; @@ -901,7 +901,7 @@ static void run_denytest(int dummy) cli_sockopt(&cli1, sockops); cli_sockopt(&cli2, sockops); - printf("starting denytest\n"); + printf("starting denytest1\n"); for (f=0;fnames[f];f++) { cli_unlink(&cli1, fnames[f]); @@ -952,7 +952,96 @@ static void run_denytest(int dummy) close_connection(&cli1); close_connection(&cli2); - printf("finshed denytest\n"); + printf("finshed denytest1\n"); +} + + +/* + this produces a matrix of deny mode behaviour for two opens on the + same connection + */ +static void run_denytest2(int dummy) +{ + static struct cli_state cli1; + int fnum1, fnum2; + int f, d1, d2, o1, o2, x=0; + char *fnames[] = {"denytest2.exe", "denytest2.dat", NULL}; + struct { + int v; + char *name; + } deny_modes[] = { + {DENY_DOS, "DENY_DOS"}, + {DENY_ALL, "DENY_ALL"}, + {DENY_WRITE, "DENY_WRITE"}, + {DENY_READ, "DENY_READ"}, + {DENY_NONE, "DENY_NONE"}, + {DENY_FCB, "DENY_FCB"}, + {-1, NULL}}; + struct { + int v; + char *name; + } open_modes[] = { + {O_RDWR, "O_RDWR"}, + {O_RDONLY, "O_RDONLY"}, + {O_WRONLY, "O_WRONLY"}, + {-1, NULL}}; + + if (!open_connection(&cli1)) { + return; + } + cli_sockopt(&cli1, sockops); + + printf("starting denytest2\n"); + + for (f=0;fnames[f];f++) { + cli_unlink(&cli1, fnames[f]); + + fnum1 = cli_open(&cli1, fnames[f], O_RDWR|O_CREAT, DENY_NONE); + cli_write(&cli1, fnum1, 0, fnames[f], 0, strlen(fnames[f])); + cli_close(&cli1, fnum1); + + for (d1=0;deny_modes[d1].name;d1++) + for (o1=0;open_modes[o1].name;o1++) + for (d2=0;deny_modes[d2].name;d2++) + for (o2=0;open_modes[o2].name;o2++) { + fnum1 = cli_open(&cli1, fnames[f], + open_modes[o1].v, + deny_modes[d1].v); + fnum2 = cli_open(&cli1, fnames[f], + open_modes[o2].v, + deny_modes[d2].v); + + printf("%s %8s %10s %8s %10s ", + fnames[f], + open_modes[o1].name, + deny_modes[d1].name, + open_modes[o2].name, + deny_modes[d2].name); + + if (fnum1 == -1) { + printf("X"); + } else if (fnum2 == -1) { + printf("-"); + } else { + if (cli_read(&cli1, fnum2, (void *)&x, 0, 1) == 1) { + printf("R"); + } + if (cli_write(&cli1, fnum2, 0, (void *)&x, 0, 1) == 1) { + printf("W"); + } + } + + printf("\n"); + cli_close(&cli1, fnum1); + cli_close(&cli1, fnum2); + } + + cli_unlink(&cli1, fnames[f]); + } + + close_connection(&cli1); + + printf("finshed denytest2\n"); } /* @@ -1547,7 +1636,8 @@ static struct { {"NBWNT", run_nbwnt, 0}, {"OPLOCK", run_oplock, 0}, {"DIR", run_dirtest, 0}, - {"DENY", run_denytest, 0}, + {"DENY1", run_denytest1, 0}, + {"DENY2", run_denytest2, 0}, {NULL, NULL, 0}}; |