diff options
author | Luke Leighton <lkcl@samba.org> | 2000-03-07 21:55:42 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 2000-03-07 21:55:42 +0000 |
commit | 3958c3910658e99fe1cfd737e0cfc126dffc75da (patch) | |
tree | 71b178bc7824e16966ddb583c778efe139586d93 /source3/utils | |
parent | fd69e4a13a8bbaf838b33ab7a3f3f00ed558b163 (diff) | |
download | samba-3958c3910658e99fe1cfd737e0cfc126dffc75da.tar.gz samba-3958c3910658e99fe1cfd737e0cfc126dffc75da.tar.bz2 samba-3958c3910658e99fe1cfd737e0cfc126dffc75da.zip |
added a tcon test: make two tconXs with the same user/pass, open a file
with one of them and try to write to the file with the other.
(This used to be commit f8d3ce0419aee44e4d5efe1257ce4b27f7511ceb)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/torture.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/source3/utils/torture.c b/source3/utils/torture.c index ad14461ff5..d6d8c6010b 100644 --- a/source3/utils/torture.c +++ b/source3/utils/torture.c @@ -498,6 +498,77 @@ static void run_locktest1(int dummy) printf("Passed locktest1\n"); } +/* + checks for correct tconX support + */ +static void run_tcon_test(int dummy) +{ + static struct cli_state cli1; + char *fname = "\\tcontest.tmp"; + int fnum1; + uint16 cnum; + char buf[4]; + + if (!open_connection(&cli1)) { + return; + } + cli_sockopt(&cli1, sockops); + + printf("starting tcontest\n"); + + cli_unlink(&cli1, fname); + + fnum1 = cli_open(&cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + if (fnum1 == -1) + { + printf("open of %s failed (%s)\n", fname, cli_errstr(&cli1)); + return; + } + + cnum = cli1.cnum; + + if (cli_write(&cli1, fnum1, 0, buf, 130, 4) != 4) + { + printf("write failed (%s)", cli_errstr(&cli1)); + return; + } + + if (!cli_send_tconX(&cli1, share, "?????", + password, strlen(password)+1)) { + printf("%s refused 2nd tree connect (%s)\n", host, + cli_errstr(&cli1)); + cli_shutdown(&cli1); + return ; + } + + if (cli_write(&cli1, fnum1, 0, buf, 130, 4) == 4) + { + printf("write succeeded (%s)", cli_errstr(&cli1)); + return; + } + + if (cli_close(&cli1, fnum1)) { + printf("close2 succeeded (%s)\n", cli_errstr(&cli1)); + return; + } + + if (!cli_tdis(&cli1)) { + printf("tdis failed (%s)\n", cli_errstr(&cli1)); + return; + } + + cli1.cnum = cnum; + + if (!cli_close(&cli1, fnum1)) { + printf("close2 failed (%s)\n", cli_errstr(&cli1)); + return; + } + + close_connection(&cli1); + + printf("Passed tcontest\n"); +} + /* This test checks that @@ -1638,6 +1709,7 @@ static struct { {"DIR", run_dirtest, 0}, {"DENY1", run_denytest1, 0}, {"DENY2", run_denytest2, 0}, + {"TCON", run_tcon_test, 0}, {NULL, NULL, 0}}; |