summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2008-12-23 00:53:28 -0800
committerTim Prouty <tprouty@samba.org>2009-02-18 23:48:35 -0800
commit6bac890533112e6c4f853c0b77a9dd431c471cee (patch)
treed527be3bd79071c392777ce06fe1b4c6a2fdfc3f
parentab025bf0fe80c3ed84a3fe0ee3aac053f05154f8 (diff)
downloadsamba-6bac890533112e6c4f853c0b77a9dd431c471cee.tar.gz
samba-6bac890533112e6c4f853c0b77a9dd431c471cee.tar.bz2
samba-6bac890533112e6c4f853c0b77a9dd431c471cee.zip
s4 torture: Add new test to create a file with a lot of streams
This tests how streaminfo deals with large buffers smbclient seems to have problems when the buffer size approaches the max data size. Also smbclient exposes no way to specify the max data size that is sent in a trans2 request. Instead it hardcodes in a much larger max than windows uses. For these reasons this test isn't actually run, but is more of a reference for how windows handles streaminfo buffers.
-rw-r--r--source4/torture/raw/streams.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c
index 6105fb230f..0622e0809d 100644
--- a/source4/torture/raw/streams.c
+++ b/source4/torture/raw/streams.c
@@ -1492,6 +1492,49 @@ static bool test_stream_create_disposition(struct torture_context *tctx,
return ret;
}
+/* Test streaminfo with enough streams on a file to fill up the buffer. */
+static bool test_stream_large_streaminfo(struct torture_context *tctx,
+ struct smbcli_state *cli,
+ TALLOC_CTX *mem_ctx)
+{
+#define LONG_STREAM_SIZE 2
+ char *lstream_name;
+ const char *fname = BASEDIR "\\stream.txt";
+ const char *fname_stream;
+ NTSTATUS status;
+ bool ret = true;
+ int i;
+ union smb_fileinfo finfo;
+
+ lstream_name = talloc_array(mem_ctx, char, LONG_STREAM_SIZE);
+
+ for (i = 0; i < LONG_STREAM_SIZE - 1; i++) {
+ lstream_name[i] = (char)('a' + i%26);
+ }
+ lstream_name[LONG_STREAM_SIZE - 1] = '\0';
+
+ printf("(%s) Creating a file with a lot of streams\n", __location__);
+ for (i = 0; i < 10000; i++) {
+ fname_stream = talloc_asprintf(mem_ctx, "%s:%s%d", fname,
+ lstream_name, i);
+ ret = create_file_with_stream(tctx, cli, mem_ctx, fname,
+ fname_stream);
+ if (!ret) {
+ goto done;
+ }
+ }
+
+ finfo.generic.level = RAW_FILEINFO_STREAM_INFO;
+ finfo.generic.in.file.path = fname;
+
+ status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
+ CHECK_STATUS(status, STATUS_BUFFER_OVERFLOW);
+
+ done:
+ smbcli_unlink(cli->tree, fname);
+ return ret;
+}
+
/*
basic testing of streams calls
*/
@@ -1523,6 +1566,8 @@ bool torture_raw_streams(struct torture_context *torture,
smb_raw_exit(cli->session);
ret &= test_stream_create_disposition(torture, cli, torture);
smb_raw_exit(cli->session);
+ /* ret &= test_stream_large_streaminfo(torture, cli, torture); */
+/* smb_raw_exit(cli->session); */
smbcli_deltree(cli->tree, BASEDIR);