diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-11-17 00:39:20 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:54 -0500 |
commit | ca90965a3a2dabfc50be6d155c20004a61f81318 (patch) | |
tree | 1486bf4b8245168ccfc88d832b05ed021db5b013 /source4 | |
parent | 285db3339931c47a569f49e8e18760d6185aac54 (diff) | |
download | samba-ca90965a3a2dabfc50be6d155c20004a61f81318.tar.gz samba-ca90965a3a2dabfc50be6d155c20004a61f81318.tar.bz2 samba-ca90965a3a2dabfc50be6d155c20004a61f81318.zip |
r3793: add some streams tests that show how the :$DATA suffix is handled
(This used to be commit 41d8c95c94291e73fae1541543d6ce02b81c0c46)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/raw/streams.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c index 4614367abf..239955fd93 100644 --- a/source4/torture/raw/streams.c +++ b/source4/torture/raw/streams.c @@ -98,10 +98,11 @@ static BOOL test_stream_io(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) const char *fname = BASEDIR "\\stream.txt"; const char *sname1, *sname2; BOOL ret = True; - int fnum, fnum2; + int fnum; ssize_t retsize; sname1 = talloc_asprintf(mem_ctx, "%s:%s", fname, "Stream One"); + sname2 = talloc_asprintf(mem_ctx, "%s:%s:$DaTa", fname, "Second Stream"); printf("opening non-existant directory stream\n"); io.generic.level = RAW_OPEN_NTCREATEX; @@ -149,7 +150,28 @@ static BOOL test_stream_io(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) smbcli_close(cli->tree, fnum); + ret &= check_stream(cli, mem_ctx, fname, "Stream One:$FOO", NULL); + + printf("creating a stream2 on a existing file\n"); + io.ntcreatex.in.fname = sname2; + io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF; + status = smb_raw_open(cli->tree, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + fnum = io.ntcreatex.out.fnum; + + printf("modifying stream\n"); + retsize = smbcli_write(cli->tree, fnum, 0, "SECOND STREAM", 0, 13); + CHECK_VALUE(retsize, 13); + + smbcli_close(cli->tree, fnum); + ret &= check_stream(cli, mem_ctx, fname, "Stream One", "test MORE DATA "); + ret &= check_stream(cli, mem_ctx, fname, "Stream One:$DATA", "test MORE DATA "); + ret &= check_stream(cli, mem_ctx, fname, "Stream One:", NULL); + ret &= check_stream(cli, mem_ctx, fname, "Second Stream", "SECOND STREAM"); + ret &= check_stream(cli, mem_ctx, fname, "Second Stream:$DATA", "SECOND STREAM"); + ret &= check_stream(cli, mem_ctx, fname, "Second Stream:", NULL); + ret &= check_stream(cli, mem_ctx, fname, "Second Stream:$FOO", NULL); printf("deleting stream\n"); status = smbcli_unlink(cli->tree, sname1); |