From 3958c3910658e99fe1cfd737e0cfc126dffc75da Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 7 Mar 2000 21:55:42 +0000 Subject: 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) --- source3/param/loadparm.c | 2 +- source3/utils/torture.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 7a225b035e..25c9440019 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -964,7 +964,7 @@ static void init_globals(void) Globals.bStripDot = False; Globals.syslog = 1; Globals.bSyslogOnly = False; - Globals.bTimestampLogs = True; + Globals.bTimestampLogs = False; Globals.bDebugHiresTimestamp = False; Globals.bDebugPid = False; Globals.bDebugUid = False; 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}}; -- cgit