[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Wed May 30 00:35:03 UTC 2018
The branch, master has been updated
via 46d1278 vfs_fruit: delete 0 byte size streams if AAPL is enabled
via cf5d471 s4:torture: test setting EOF of a stream to 0 with enabled AAPL extensions
via 2729b432 s4:torture/vfs/fruit: decrease large resource fork size in test from 1 GB to 64 MB
from 5b86203 python/samba/netcmd/schema.py: samdb schema update now
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 46d127865f3fb14041797d395db3b3234ed3bd6c
Author: Ralph Boehme <slow at samba.org>
Date: Thu May 17 16:48:09 2018 +0200
vfs_fruit: delete 0 byte size streams if AAPL is enabled
macOS SMB server uses xattrs as storage backend for streams, directly
exposing xattr get/set characteristics. Setting EOF on a stream to 0
just deletes the xattr as macOS doesn't support 0-byte sized xattrs.
Note that this does not apply to the AFP_AfpInfo and AFP_Resource
streams, they have even stranger semantics and we have other tests
for those.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13441
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed May 30 02:34:29 CEST 2018 on sn-devel-144
commit cf5d471544f0cb0d072e4af1ee36798580d32897
Author: Ralph Boehme <slow at samba.org>
Date: Thu May 17 16:43:49 2018 +0200
s4:torture: test setting EOF of a stream to 0 with enabled AAPL extensions
macOS SMB server uses xattrs as storage backend for streams, directly
exposing xattr get/set characteristics. Setting EOF on a stream to 0
just deletes the xattr as macOS doesn't support 0-byte sized xattrs.
Note that this does not apply to the AFP_AfpInfo and AFP_Resource
streams, they have even stranger semantics and we have other tests
for those.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13441
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 2729b4329af0ad0b6a8bd188450b8abd76670d8a
Author: Ralph Boehme <slow at samba.org>
Date: Sat May 19 01:36:21 2018 +0200
s4:torture/vfs/fruit: decrease large resource fork size in test from 1 GB to 64 MB
64 MB is a more realistic value and lets the test pass on FreeBSD with
fruit:resource=stream and vfs_streams_xattr.
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/modules/vfs_fruit.c | 3 +
source4/torture/vfs/fruit.c | 201 +++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 202 insertions(+), 2 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 0a8141a..df3cd0c 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -5542,6 +5542,9 @@ static int fruit_ftruncate(struct vfs_handle_struct *handle,
(intmax_t)offset);
if (fio == NULL) {
+ if (offset == 0 && global_fruit_config.nego_aapl) {
+ return SMB_VFS_NEXT_UNLINK(handle, fsp->fsp_name);
+ }
return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
}
diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c
index 9310d05..14191fd0 100644
--- a/source4/torture/vfs/fruit.c
+++ b/source4/torture/vfs/fruit.c
@@ -1594,11 +1594,11 @@ static bool test_write_atalk_rfork_io(struct torture_context *tctx,
ret &= write_stream(tree, __location__, tctx, mem_ctx,
fname, AFPRESOURCE_STREAM_NAME,
- (off_t)1<<32, 10, rfork_content);
+ (off_t)64*1024*1024, 10, rfork_content);
ret &= check_stream(tree, __location__, tctx, mem_ctx,
fname, AFPRESOURCE_STREAM_NAME,
- (off_t)1<<32, 10, 0, 10, rfork_content);
+ (off_t)64*1024*1024, 10, 0, 10, rfork_content);
/* Truncate back to size of 1 byte */
@@ -4600,6 +4600,202 @@ done:
return ret;
}
+static bool test_setinfo_stream_eof(struct torture_context *tctx,
+ struct smb2_tree *tree)
+{
+ bool ret = true;
+ NTSTATUS status;
+ struct smb2_create create;
+ union smb_setfileinfo sfinfo;
+ union smb_fileinfo finfo;
+ struct smb2_handle h1;
+ TALLOC_CTX *mem_ctx = talloc_new(tctx);
+ const char *fname = BASEDIR "\\file";
+ const char *sname = BASEDIR "\\file:foo";
+
+ torture_assert_goto(tctx, mem_ctx != NULL, ret, done,
+ "talloc_new failed\n");
+
+ torture_comment(tctx, "Test setting EOF on a stream\n");
+
+ smb2_deltree(tree, BASEDIR);
+ status = torture_smb2_testdir(tree, BASEDIR, &h1);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "torture_smb2_testdir\n");
+ smb2_util_close(tree, h1);
+
+ status = torture_smb2_testfile(tree, fname, &h1);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "torture_smb2_testfile failed\n");
+ smb2_util_close(tree, h1);
+
+ status = torture_smb2_testfile_access(tree, sname, &h1,
+ SEC_FILE_WRITE_DATA);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "torture_smb2_testfile failed\n");
+
+ status = smb2_util_write(tree, h1, "1234567890", 0, 10);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "smb2_util_write failed\n");
+ smb2_util_close(tree, h1);
+
+ /*
+ * Test setting EOF to 21
+ */
+
+ torture_comment(tctx, "Setting stream EOF to 21\n");
+
+ status = torture_smb2_testfile_access(tree, sname, &h1,
+ SEC_FILE_WRITE_DATA);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "torture_smb2_testfile failed\n");
+
+ ZERO_STRUCT(sfinfo);
+ sfinfo.generic.in.file.handle = h1;
+ sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
+ sfinfo.position_information.in.position = 21;
+ status = smb2_setinfo_file(tree, &sfinfo);
+ torture_assert_ntstatus_ok_goto(tctx, status,
+ ret, done, "set EOF 21 failed\n");
+
+ smb2_util_close(tree, h1);
+
+ status = torture_smb2_testfile_access(tree, sname, &h1,
+ SEC_FILE_WRITE_DATA);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "torture_smb2_testfile failed\n");
+
+ ZERO_STRUCT(finfo);
+ finfo.generic.level = RAW_FILEINFO_STANDARD_INFORMATION;
+ finfo.generic.in.file.handle = h1;
+ status = smb2_getinfo_file(tree, mem_ctx, &finfo);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "smb2_getinfo_file failed");
+
+ smb2_util_close(tree, h1);
+
+ torture_assert_goto(tctx, finfo.standard_info.out.size == 21,
+ ret, done, "size != 21\n");
+
+ /*
+ * Test setting EOF to 0
+ */
+
+ torture_comment(tctx, "Setting stream EOF to 0\n");
+
+ status = torture_smb2_testfile_access(tree, sname, &h1,
+ SEC_FILE_WRITE_DATA);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "torture_smb2_testfile failed\n");
+
+ ZERO_STRUCT(sfinfo);
+ sfinfo.generic.in.file.handle = h1;
+ sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
+ sfinfo.position_information.in.position = 0;
+ status = smb2_setinfo_file(tree, &sfinfo);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "set eof 0 failed\n");
+
+ smb2_util_close(tree, h1);
+
+ status = torture_smb2_testfile_access(tree, sname, &h1,
+ SEC_FILE_WRITE_DATA);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "torture_smb2_testfile failed\n");
+
+ ZERO_STRUCT(finfo);
+ finfo.generic.level = RAW_FILEINFO_STANDARD_INFORMATION;
+ finfo.generic.in.file.handle = h1;
+ status = smb2_getinfo_file(tree, mem_ctx, &finfo);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "smb2_getinfo_file failed\n");
+
+ smb2_util_close(tree, h1);
+
+ torture_assert_goto(tctx, finfo.standard_info.out.size == 0,
+ ret, done, "size != 0\n");
+
+ /*
+ * Test setinfo end-of-file info to 1
+ */
+
+ torture_comment(tctx, "Setting stream EOF to 1\n");
+
+ status = torture_smb2_testfile_access(tree, sname, &h1,
+ SEC_FILE_WRITE_DATA);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "torture_smb2_testfile failed\n");
+
+ ZERO_STRUCT(sfinfo);
+ sfinfo.generic.in.file.handle = h1;
+ sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
+ sfinfo.position_information.in.position = 1;
+ status = smb2_setinfo_file(tree, &sfinfo);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "set EOF 1 failed\n");
+
+ smb2_util_close(tree, h1);
+
+ status = torture_smb2_testfile_access(tree, sname, &h1,
+ SEC_FILE_WRITE_DATA);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "torture_smb2_testfile failed\n");
+
+ ZERO_STRUCT(finfo);
+ finfo.generic.level = RAW_FILEINFO_STANDARD_INFORMATION;
+ finfo.generic.in.file.handle = h1;
+ status = smb2_getinfo_file(tree, mem_ctx, &finfo);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "smb2_getinfo_file failed\n");
+
+ smb2_util_close(tree, h1);
+
+ torture_assert_goto(tctx, finfo.standard_info.out.size == 1,
+ ret, done, "size != 1\n");
+
+ /*
+ * Test setting EOF to 0 with AAPL enabled, should delete stream
+ */
+
+ torture_comment(tctx, "Enabling AAPL extensions\n");
+
+ ret = enable_aapl(tctx, tree);
+ torture_assert(tctx, ret == true, "enable_aapl failed\n");
+
+ torture_comment(tctx, "Setting stream EOF to 0\n");
+ status = torture_smb2_testfile_access(tree, sname, &h1,
+ SEC_FILE_WRITE_DATA);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "torture_smb2_testfile failed\n");
+
+ ZERO_STRUCT(sfinfo);
+ sfinfo.generic.in.file.handle = h1;
+ sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
+ sfinfo.position_information.in.position = 0;
+ status = smb2_setinfo_file(tree, &sfinfo);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "set eof 0 failed\n");
+
+ smb2_util_close(tree, h1);
+
+ ZERO_STRUCT(create);
+ create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
+ create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
+ create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
+ create.in.create_disposition = NTCREATEX_DISP_OPEN;
+ create.in.fname = sname;
+
+ status = smb2_create(tree, tctx, &create);
+ torture_assert_ntstatus_equal_goto(
+ tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done,
+ "Unexpected status\n");
+
+done:
+ smb2_util_unlink(tree, fname);
+ smb2_util_rmdir(tree, BASEDIR);
+ return ret;
+}
+
/*
* Note: This test depends on "vfs objects = catia fruit streams_xattr". For
* some tests torture must be run on the host it tests and takes an additional
@@ -4632,6 +4828,7 @@ struct torture_suite *torture_vfs_fruit(TALLOC_CTX *ctx)
torture_suite_add_1smb2_test(suite, "create delete-on-close AFP_AfpResource", test_create_delete_on_close_resource);
torture_suite_add_1smb2_test(suite, "setinfo delete-on-close AFP_AfpResource", test_setinfo_delete_on_close_resource);
torture_suite_add_1smb2_test(suite, "setinfo eof AFP_AfpResource", test_setinfo_eof_resource);
+ torture_suite_add_1smb2_test(suite, "setinfo eof stream", test_setinfo_stream_eof);
torture_suite_add_1smb2_test(suite, "null afpinfo", test_null_afpinfo);
torture_suite_add_1smb2_test(suite, "delete", test_delete_file_with_rfork);
torture_suite_add_1smb2_test(suite, "read open rsrc after rename", test_rename_and_read_rsrc);
--
Samba Shared Repository
More information about the samba-cvs
mailing list