diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-08-14 01:31:31 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-08-14 01:31:31 +0000 |
commit | 89f55d36f31ae51e365fc0e4020be0728091bd53 (patch) | |
tree | cf2dd6ad8cc017b6da4df55a6507ea2e6ee624c3 /source4/torture | |
parent | 9af22cd8837f25758e3993d5836c2a26f05e5676 (diff) | |
download | samba-89f55d36f31ae51e365fc0e4020be0728091bd53.tar.gz samba-89f55d36f31ae51e365fc0e4020be0728091bd53.tar.bz2 samba-89f55d36f31ae51e365fc0e4020be0728091bd53.zip |
added the ancient SMBcreate operation to the testsuite and client lib
(This used to be commit 3eef35e581b5e1802711b9b5297f61800a7e242e)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/raw/open.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c index 9f77eb3f8e..3e28322f37 100644 --- a/source4/torture/raw/open.c +++ b/source4/torture/raw/open.c @@ -796,6 +796,61 @@ done: /* + test RAW_OPEN_CREATE +*/ +static BOOL test_create(struct cli_state *cli, TALLOC_CTX *mem_ctx) +{ + union smb_open io; + const char *fname = BASEDIR "\\torture_create.txt"; + NTSTATUS status; + int fnum; + BOOL ret = True; + time_t basetime = (time(NULL) + 3600*24*3) & ~1; + union smb_fileinfo finfo; + + printf("Checking RAW_OPEN_CREATE\n"); + + io.create.level = RAW_OPEN_CREATE; + io.create.in.attrib = 0; + io.create.in.write_time = 0; + io.create.in.fname = fname; + status = smb_raw_open(cli->tree, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + fnum = io.create.out.fnum; + + status = smb_raw_open(cli->tree, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + + cli_close(cli, io.create.out.fnum); + cli_close(cli, fnum); + cli_unlink(cli, fname); + + /* make sure write_time works */ + io.create.in.write_time = basetime; + status = smb_raw_open(cli->tree, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + fnum = io.create.out.fnum; + CHECK_TIME(basetime, write_time); + + cli_close(cli, fnum); + cli_unlink(cli, fname); + + /* make sure file_attrs works */ + io.create.in.attrib = FILE_ATTRIBUTE_HIDDEN; + status = smb_raw_open(cli->tree, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + fnum = io.create.out.fnum; + CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE, attrib); + +done: + cli_close(cli, fnum); + cli_unlink(cli, fname); + + return ret; +} + + +/* test RAW_OPEN_CTEMP */ static BOOL test_ctemp(struct cli_state *cli, TALLOC_CTX *mem_ctx) @@ -882,6 +937,10 @@ BOOL torture_raw_open(int dummy) ret = False; } + if (!test_create(cli, mem_ctx)) { + ret = False; + } + if (!test_ctemp(cli, mem_ctx)) { ret = False; } |