diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-03-29 23:30:53 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-03-29 23:30:53 +0000 |
commit | 19a384a54c678e9e064a79abeb1cfa39f9201896 (patch) | |
tree | bc979e00c45d8e01550a48a1a621edee44f1428f /source3/torture | |
parent | 054e5daf7c362b55310d9159ac90732f6ee5f7e0 (diff) | |
download | samba-19a384a54c678e9e064a79abeb1cfa39f9201896.tar.gz samba-19a384a54c678e9e064a79abeb1cfa39f9201896.tar.bz2 samba-19a384a54c678e9e064a79abeb1cfa39f9201896.zip |
updated the TCON test so that win2000 passes. Samba now fails this
test.
It is an interesting test because it shows that win2000 completely
ignores the TID and VUID fields in a SMBwriteX. In Samba it is hard to
do this as we check the VUID and TID fields before we call the SMB
specific reply functions.
The test also shows that the list of open files must be global to the
socket, not specific to a tcon.
(This used to be commit be98069c4e5bbfbe3ce66c20f796c2d2324e7511)
Diffstat (limited to 'source3/torture')
-rw-r--r-- | source3/torture/torture.c | 95 |
1 files changed, 63 insertions, 32 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 6ab5bf6dbb..7bf4f10af0 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -902,77 +902,108 @@ static BOOL run_locktest1(int dummy) } /* - checks for correct tconX support + this checks to see if a secondary tconx can use open files from an + earlier tconx */ static BOOL run_tcon_test(int dummy) { - static struct cli_state *cli1; + static struct cli_state *cli; const char *fname = "\\tcontest.tmp"; int fnum1; - uint16 cnum; + uint16 cnum1, cnum2, cnum3; + uint16 vuid1, vuid2; char buf[4]; + BOOL ret = True; - if (!torture_open_connection(&cli1)) { + if (!torture_open_connection(&cli)) { return False; } - cli_sockopt(cli1, sockops); + cli_sockopt(cli, sockops); printf("starting tcontest\n"); - cli_unlink(cli1, fname); + cli_unlink(cli, 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)); + fnum1 = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + if (fnum1 == -1) { + printf("open of %s failed (%s)\n", fname, cli_errstr(cli)); return False; } - cnum = cli1->cnum; + cnum1 = cli->cnum; + vuid1 = cli->vuid; - if (cli_write(cli1, fnum1, 0, buf, 130, 4) != 4) - { - printf("write failed (%s)", cli_errstr(cli1)); + if (cli_write(cli, fnum1, 0, buf, 130, 4) != 4) { + printf("initial write failed (%s)", cli_errstr(cli)); return False; } - if (!cli_send_tconX(cli1, share, "?????", + if (!cli_send_tconX(cli, share, "?????", password, strlen(password)+1)) { printf("%s refused 2nd tree connect (%s)\n", host, - cli_errstr(cli1)); - cli_shutdown(cli1); + cli_errstr(cli)); + cli_shutdown(cli); return False; } - if (cli_write(cli1, fnum1, 0, buf, 130, 4) == 4) - { - printf("write succeeded (%s)", cli_errstr(cli1)); - return False; + cnum2 = cli->cnum; + cnum3 = MAX(cnum1, cnum2) + 1; /* any invalid number */ + vuid2 = cli->vuid + 1; + + /* try a write with the wrong tid */ + cli->cnum = cnum2; + + if (cli_write(cli, fnum1, 0, buf, 130, 4) == 4) { + printf("server allows write with wrong TID\n"); + } else { + printf("* server fails write with wrong TID : %s\n", cli_errstr(cli)); + ret = False; } - if (cli_close(cli1, fnum1)) { - printf("close2 succeeded (%s)\n", cli_errstr(cli1)); - return False; + + /* try a write with an invalid tid */ + cli->cnum = cnum3; + + if (cli_write(cli, fnum1, 0, buf, 130, 4) == 4) { + printf("server allows write with invalid TID\n"); + } else { + printf("* server fails write with invalid TID : %s\n", cli_errstr(cli)); + ret = False; + } + + /* try a write with an invalid vuid */ + cli->vuid = vuid2; + cli->cnum = cnum1; + + if (cli_write(cli, fnum1, 0, buf, 130, 4) == 4) { + printf("server allows write with invalid VUID\n"); + } else { + printf("* server fails write with invalid VUID : %s\n", cli_errstr(cli)); + ret = False; } - if (!cli_tdis(cli1)) { - printf("tdis failed (%s)\n", cli_errstr(cli1)); + cli->cnum = cnum1; + cli->vuid = vuid1; + + if (!cli_close(cli, fnum1)) { + printf("close failed (%s)\n", cli_errstr(cli)); return False; } - cli1->cnum = cnum; + cli->cnum = cnum2; - if (!cli_close(cli1, fnum1)) { - printf("close2 failed (%s)\n", cli_errstr(cli1)); + if (!cli_tdis(cli)) { + printf("secondary tdis failed (%s)\n", cli_errstr(cli)); return False; } - if (!torture_close_connection(cli1)) { + cli->cnum = cnum1; + + if (!torture_close_connection(cli)) { return False; } - printf("Passed tcontest\n"); - return True; + return ret; } |