[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-990-g6bac890

Tim Prouty tprouty at samba.org
Thu Feb 19 07:49:31 GMT 2009


The branch, master has been updated
       via  6bac890533112e6c4f853c0b77a9dd431c471cee (commit)
       via  ab025bf0fe80c3ed84a3fe0ee3aac053f05154f8 (commit)
       via  7a2c4acf8631813889982f6059f17a1954308906 (commit)
      from  053e1873c5dd30e7bb3102692ba79e280034c392 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 6bac890533112e6c4f853c0b77a9dd431c471cee
Author: Tim Prouty <tprouty at samba.org>
Date:   Tue Dec 23 00:53:28 2008 -0800

    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.

commit ab025bf0fe80c3ed84a3fe0ee3aac053f05154f8
Author: Tim Prouty <tprouty at samba.org>
Date:   Wed Feb 18 23:10:41 2009 -0800

    s3: Fix bug opening streams with truncating disposition
    
    Do not attempt to delete streams on a truncating open, if the name
    we're opening is itself a stream.
    
    Port 176e8857203944bc332844b700749120ce90c891 to standard open path

commit 7a2c4acf8631813889982f6059f17a1954308906
Author: Tim Prouty <tprouty at samba.org>
Date:   Wed Feb 18 22:51:27 2009 -0800

    s4 torture: Add additional streams create disposition test

-----------------------------------------------------------------------

Summary of changes:
 source3/smbd/open.c           |    2 +-
 source4/torture/raw/streams.c |   65 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index f7a52d7..9971ffa 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1975,7 +1975,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 	SMB_ASSERT(lck != NULL);
 
 	/* Delete streams if create_disposition requires it */
-	if (file_existed && clear_ads) {
+	if (file_existed && clear_ads && !is_ntfs_stream_name(fname)) {
 		status = delete_all_streams(conn, fname);
 		if (!NT_STATUS_IS_OK(status)) {
 			TALLOC_FREE(lck);
diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c
index aff97d0..0622e08 100644
--- a/source4/torture/raw/streams.c
+++ b/source4/torture/raw/streams.c
@@ -1439,6 +1439,26 @@ static bool test_stream_create_disposition(struct torture_context *tctx,
 	}
 
 	/*
+	 * check ntcreatex overwrite_if on a stream.
+	 */
+	printf("(%s) Checking ntcreatex disp: overwrite_if on stream\n",
+	       __location__);
+	smbcli_unlink(cli->tree, fname);
+	if (!create_file_with_stream(tctx, cli, mem_ctx, fname,
+				     fname_stream)) {
+		goto done;
+	}
+
+	io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OVERWRITE_IF;
+	io.ntcreatex.in.fname = fname_stream;
+	status = smb_raw_open(cli->tree, mem_ctx, &io);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	smbcli_close(cli->tree, io.ntcreatex.out.file.fnum);
+	if (!check_stream_list(cli, fname, 2, &default_stream_name)) {
+		goto done;
+	}
+
+	/*
 	 * check openx overwrite_if
 	 */
 	printf("(%s) Checking openx disp: overwrite_if\n", __location__);
@@ -1472,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
 */
@@ -1503,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);
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list