[SCM] Samba Shared Repository - branch master updated
Tim Prouty
tprouty at samba.org
Thu Dec 17 19:16:20 MST 2009
The branch, master has been updated
via cfbf62d... s4 torture: RAW-STREAMS-NAMES Make sure the create time of the streams are different from the base file
via c3582f9... s4 torture: Add RAW-STREAMS-RENAME3 to show error when trying to overwrite a stream with an open handle
via f8bb5a6... s4 torture: Parameterize streams delete behavior rather than commenting out the check.
via f02206d... s4 torture: RAW-STREAMS-CREATEDISP Use a normal deny mode
via 5c13a90... s4 torture: close handle instead of using exit
from fbf4923... Update default with correct value. Add a note about Win7 behavior here. Jeremy.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit cfbf62dbfd18465d1a3f699cd22a35f9303f87fe
Author: Tim Prouty <tprouty at samba.org>
Date: Thu Dec 17 13:42:24 2009 -0800
s4 torture: RAW-STREAMS-NAMES Make sure the create time of the streams are different from the base file
commit c3582f923e6adf2f3332540b062a2f994aeb7122
Author: Tim Prouty <tprouty at samba.org>
Date: Thu Dec 17 10:39:51 2009 -0800
s4 torture: Add RAW-STREAMS-RENAME3 to show error when trying to overwrite a stream with an open handle
A normal file overwrite in this case would return NT_STATUS_ACCESS_DENIED,
but if a stream is the target NT_STATUS_INVALID_PARAMETER is returned.
commit f8bb5a60e71bd51971ef05a23037cac4523dee25
Author: Tim Prouty <tprouty at samba.org>
Date: Wed Dec 16 14:31:54 2009 -0800
s4 torture: Parameterize streams delete behavior rather than commenting out the check.
commit f02206d933c2952b9b9674b94290142f269248c5
Author: Tim Prouty <tprouty at samba.org>
Date: Thu Dec 17 13:35:01 2009 -0800
s4 torture: RAW-STREAMS-CREATEDISP Use a normal deny mode
commit 5c13a90abebbd9f23c4e426b2f52c7440aa49586
Author: Tim Prouty <tprouty at samba.org>
Date: Tue Dec 15 17:17:48 2009 -0800
s4 torture: close handle instead of using exit
-----------------------------------------------------------------------
Summary of changes:
source4/torture/raw/rename.c | 2 +-
source4/torture/raw/streams.c | 128 +++++++++++++++++++++++++++++++++++++++-
2 files changed, 125 insertions(+), 5 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/torture/raw/rename.c b/source4/torture/raw/rename.c
index 7c9d15b..187645f 100644
--- a/source4/torture/raw/rename.c
+++ b/source4/torture/raw/rename.c
@@ -305,7 +305,7 @@ static bool test_ntrename(struct torture_context *tctx,
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
- smb_raw_exit(cli->session);
+ smbcli_close(cli->tree, fnum);
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c
index c0cb64b..79cacff 100644
--- a/source4/torture/raw/streams.c
+++ b/source4/torture/raw/streams.c
@@ -607,9 +607,13 @@ static bool test_stream_delete(struct torture_context *tctx,
status = smb_raw_fileinfo(cli->tree, tctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
- /* w2k and w2k3 return 0 and w2k8 returns 1
- CHECK_VALUE(finfo.all_info.out.delete_pending, 0);
- */
+
+ /* w2k and w2k3 return 0 and w2k8 returns 1 */
+ if (TARGET_IS_WINXP(tctx) || TARGET_IS_W2K3(tctx)) {
+ CHECK_VALUE(finfo.all_info.out.delete_pending, 0);
+ } else {
+ CHECK_VALUE(finfo.all_info.out.delete_pending, 1);
+ }
smbcli_close(cli->tree, fnum);
@@ -711,6 +715,30 @@ static bool test_stream_names(struct torture_context *tctx,
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
io.ntcreatex.in.security_flags = 0;
+ io.ntcreatex.in.fname = fname;
+
+ status = smb_raw_open(cli->tree, tctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ fnum1 = io.ntcreatex.out.file.fnum;
+
+ /*
+ * Make sure the create time of the streams are different from the
+ * base file.
+ */
+ sleep(2);
+ smbcli_close(cli->tree, fnum1);
+
+ io.generic.level = RAW_OPEN_NTCREATEX;
+ io.ntcreatex.in.root_fid.fnum = 0;
+ io.ntcreatex.in.flags = 0;
+ io.ntcreatex.in.access_mask = SEC_FILE_WRITE_DATA;
+ io.ntcreatex.in.create_options = 0;
+ io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
+ io.ntcreatex.in.share_access = 0;
+ io.ntcreatex.in.alloc_size = 0;
+ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
+ io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
+ io.ntcreatex.in.security_flags = 0;
io.ntcreatex.in.fname = sname1;
status = smb_raw_open(cli->tree, tctx, &io);
@@ -1327,6 +1355,97 @@ static bool test_stream_rename2(struct torture_context *tctx,
return ret;
}
+/*
+ test stream renames
+*/
+static bool test_stream_rename3(struct torture_context *tctx,
+ struct smbcli_state *cli)
+{
+ NTSTATUS status, status2;
+ union smb_open io;
+ const char *fname = BASEDIR "\\stream_rename.txt";
+ const char *sname1, *sname2;
+ union smb_fileinfo finfo1;
+ union smb_setfileinfo sfinfo;
+ bool ret = true;
+ int fnum = -1;
+ int fnum2 = -1;
+ bool check_fnum;
+ const char *call_name;
+
+ if (!torture_setup_dir(cli, BASEDIR)) {
+ return false;
+ }
+
+ sname1 = talloc_asprintf(tctx, "%s:%s", fname, "MStream Two:$DATA");
+ sname2 = talloc_asprintf(tctx, "%s:%s:$DaTa", fname, "Second Stream");
+
+ printf("(%s) testing stream renames\n", __location__);
+ io.generic.level = RAW_OPEN_NTCREATEX;
+ io.ntcreatex.in.root_fid.fnum = 0;
+ io.ntcreatex.in.flags = 0;
+ io.ntcreatex.in.access_mask = SEC_FILE_READ_ATTRIBUTE |
+ SEC_FILE_WRITE_ATTRIBUTE |
+ SEC_RIGHTS_FILE_ALL;
+ io.ntcreatex.in.create_options = 0;
+ io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
+ io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
+ NTCREATEX_SHARE_ACCESS_WRITE | NTCREATEX_SHARE_ACCESS_DELETE;
+ io.ntcreatex.in.alloc_size = 0;
+ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
+ io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
+ io.ntcreatex.in.security_flags = 0;
+ io.ntcreatex.in.fname = sname1;
+
+ /* Create two streams. */
+ status = smb_raw_open(cli->tree, tctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ fnum = io.ntcreatex.out.file.fnum;
+ if (fnum != -1) smbcli_close(cli->tree, fnum);
+
+ io.ntcreatex.in.fname = sname2;
+ status = smb_raw_open(cli->tree, tctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ fnum = io.ntcreatex.out.file.fnum;
+
+ if (fnum != -1) smbcli_close(cli->tree, fnum);
+
+ /* open the second stream. */
+ io.ntcreatex.in.access_mask = SEC_STD_DELETE;
+ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
+ status = smb_raw_open(cli->tree, tctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ fnum = io.ntcreatex.out.file.fnum;
+
+ /* Keep a handle to the first stream open. */
+ io.ntcreatex.in.fname = sname1;
+ io.ntcreatex.in.access_mask = SEC_STD_DELETE;
+ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
+ status = smb_raw_open(cli->tree, tctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ fnum2 = io.ntcreatex.out.file.fnum;
+
+ ZERO_STRUCT(sfinfo);
+ sfinfo.rename_information.in.overwrite = 1;
+ sfinfo.rename_information.in.root_fid = 0;
+ sfinfo.rename_information.in.new_name = ":MStream Two:$DATA";
+ if (torture_setting_bool(tctx, "samba4", false) ||
+ torture_setting_bool(tctx, "samba3", false)) {
+ CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_OK);
+ } else {
+ CHECK_CALL_FNUM(RENAME_INFORMATION,
+ NT_STATUS_INVALID_PARAMETER);
+ }
+
+
+done:
+ if (fnum != -1) smbcli_close(cli->tree, fnum);
+ if (fnum2 != -1) smbcli_close(cli->tree, fnum2);
+ status = smbcli_unlink(cli->tree, fname);
+ smbcli_deltree(cli->tree, BASEDIR);
+ return ret;
+}
+
static bool create_file_with_stream(struct torture_context *tctx,
struct smbcli_state *cli,
const char *stream)
@@ -1487,7 +1606,7 @@ static bool test_stream_create_disposition(struct torture_context *tctx,
io.openx.level = RAW_OPEN_OPENX;
io.openx.in.flags = OPENX_FLAGS_ADDITIONAL_INFO;
- io.openx.in.open_mode = OPENX_MODE_ACCESS_RDWR;
+ io.openx.in.open_mode = OPENX_MODE_ACCESS_RDWR | OPEN_FLAGS_DENY_NONE;
io.openx.in.search_attrs = 0;
io.openx.in.file_attrs = 0;
io.openx.in.write_time = 0;
@@ -1791,6 +1910,7 @@ struct torture_suite *torture_raw_streams(TALLOC_CTX *tctx)
torture_suite_add_1smb_test(suite, "NAMES2", test_stream_names2);
torture_suite_add_1smb_test(suite, "RENAME", test_stream_rename);
torture_suite_add_1smb_test(suite, "RENAME2", test_stream_rename2);
+ torture_suite_add_1smb_test(suite, "RENAME3", test_stream_rename3);
torture_suite_add_1smb_test(suite, "CREATEDISP",
test_stream_create_disposition);
torture_suite_add_1smb_test(suite, "ATTR", test_stream_attributes);
--
Samba Shared Repository
More information about the samba-cvs
mailing list