diff options
author | Andrew Tridgell <tridge@samba.org> | 1997-11-23 02:41:22 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1997-11-23 02:41:22 +0000 |
commit | 8bf0f359f3ec440ace0bba6c12ca65d25ba45fd9 (patch) | |
tree | 85540049013fd3fbf18f4aee8d691a575925ee2e /source3/utils/torture.c | |
parent | 8d971f1db1ba172befc77d5827cb47a18571b88e (diff) | |
download | samba-8bf0f359f3ec440ace0bba6c12ca65d25ba45fd9.tar.gz samba-8bf0f359f3ec440ace0bba6c12ca65d25ba45fd9.tar.bz2 samba-8bf0f359f3ec440ace0bba6c12ca65d25ba45fd9.zip |
added a test for the NT SMBgetatr bug in smbtorture
added support for choosing the protocol level in smbtorture (-m option)
use -1 for null date in cli_close()
get the attributes right in cli_open()
(This used to be commit d64d40a6ec57a4a999ae1f39175bcfd86ccb196e)
Diffstat (limited to 'source3/utils/torture.c')
-rw-r--r-- | source3/utils/torture.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/source3/utils/torture.c b/source3/utils/torture.c index 1e284fb93d..06f9f5f1fb 100644 --- a/source3/utils/torture.c +++ b/source3/utils/torture.c @@ -26,6 +26,7 @@ #include "includes.h" static fstring host, workgroup, share, password, username, myname; +static int max_protocol = PROTOCOL_NT1; static char *sockops=""; @@ -57,6 +58,8 @@ static BOOL open_connection(struct cli_state *c) return False; } + c->protocol = max_protocol; + if (!cli_negprot(c)) { printf("%s rejected the negprot (%s)\n",host, cli_errstr(c)); cli_shutdown(c); @@ -184,6 +187,7 @@ static void usage(void) printf("\t-W workgroup\n"); printf("\t-o num_operations\n"); printf("\t-O socket_options\n"); + printf("\t-m maximum protocol\n"); printf("\n"); exit(1); @@ -626,6 +630,40 @@ static void run_browsetest(void) } +/* + This checks how the getatr calls works +*/ +static void run_attrtest(void) +{ + static struct cli_state cli; + int fnum; + struct stat st; + char *fname = "\\attrib.tst"; + + printf("staring attrib test\n"); + + if (!open_connection(&cli)) { + return; + } + + cli_unlink(&cli, fname); + fnum = cli_open(&cli, fname, + O_RDWR | O_CREAT | O_TRUNC, DENY_NONE); + cli_close(&cli, fnum); + if (!cli_stat(&cli, fname, &st)) { + printf("getatr failed (%s)\n", cli_errstr(&cli)); + } + + if (abs(st.st_mtime - time(NULL)) > 2) { + printf("ERROR: SMBgetatr bug. time is %s", + ctime(&st.st_mtime)); + } + + close_connection(&cli); + + printf("attrib test finished\n"); +} + static void create_procs(int nprocs, int numops) { @@ -689,11 +727,14 @@ static void create_procs(int nprocs, int numops) argv++; - while ((opt = getopt(argc, argv, "hW:U:n:N:O:o:")) != EOF) { + while ((opt = getopt(argc, argv, "hW:U:n:N:O:o:m:")) != EOF) { switch (opt) { case 'W': fstrcpy(workgroup,optarg); break; + case 'm': + max_protocol = interpret_protocol(optarg, max_protocol); + break; case 'N': nprocs = atoi(optarg); break; @@ -742,6 +783,7 @@ static void create_procs(int nprocs, int numops) run_locktest3(numops); run_unlinktest(); run_browsetest(); + run_attrtest(); return(0); } |