summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2017-11-17 12:53:42 +0100
committerKarolin Seeger <kseeger@samba.org>2017-12-05 10:32:11 +0100
commit775ec5ecc85adf73837da0fba0b8f738a88646bd (patch)
tree4cfd9a4f1119ac2230384314029e61fc87d39a2b
parentdba33c9ec9ba83f716002cc562168ddde3bcb6b6 (diff)
downloadsamba-775ec5ecc85adf73837da0fba0b8f738a88646bd.tar.gz
s4/torture: fruit: remove use of localdir from test_adouble_conversion test
The previous use of localdir and torture_setup_local_file() was motivated by the fact that by default vfs_fruit rejects access to files with a "._" prefix. Since a previous commit allowed SMB access to ._ files, rewrite the test_adouble_conversion() test to create the ._ AppleDouble file over SMB. This also renders torture_setup_local_file() obsolete. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13155 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit ebbffd80862d7d7b025eca219bc0c8f818585ac9)
-rw-r--r--source4/torture/vfs/fruit.c77
1 files changed, 14 insertions, 63 deletions
diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c
index c78fd83377c..c40eca1aa28 100644
--- a/source4/torture/vfs/fruit.c
+++ b/source4/torture/vfs/fruit.c
@@ -1210,49 +1210,6 @@ static bool torture_setup_local_xattr(struct torture_context *tctx,
return ret;
}
-static bool torture_setup_local_file(struct torture_context *tctx,
- const char *path_option,
- const char *name,
- const char *buf,
- size_t size)
-{
- int fd;
- const char *spath;
- char *path;
- ssize_t rsize;
-
- spath = torture_setting_string(tctx, path_option, NULL);
- if (spath == NULL) {
- printf("No sharepath for option %s\n", path_option);
- return false;
- }
-
- path = talloc_asprintf(tctx, "%s/%s", spath, name);
- if (path == NULL) {
- return false;
- }
-
- fd = creat(path, S_IRWXU);
- TALLOC_FREE(path);
- if (fd == -1) {
- return false;
- }
-
- if ((buf == NULL) || (size == 0)) {
- close(fd);
- return true;
- }
-
- rsize = write(fd, buf, size);
- if (rsize != size) {
- return false;
- }
-
- close(fd);
-
- return true;
-}
-
/**
* Create a file or directory
**/
@@ -1996,38 +1953,32 @@ static bool test_adouble_conversion(struct torture_context *tctx,
{
TALLOC_CTX *mem_ctx = talloc_new(tctx);
const char *fname = BASEDIR "\\test_adouble_conversion";
- const char *fname_local = BASEDIR "/test_adouble_conversion";
- const char *adname_local = BASEDIR "/._test_adouble_conversion";
+ const char *adname = BASEDIR "/._test_adouble_conversion";
NTSTATUS status;
struct smb2_handle testdirh;
bool ret = true;
const char *data = "This resource fork intentionally left blank";
size_t datalen = strlen(data);
- const char *localdir = NULL;
-
- localdir = torture_setting_string(tctx, "localdir", NULL);
- if (localdir == NULL) {
- torture_skip(tctx, "Need localdir for test");
- }
- smb2_util_unlink(tree, fname);
+ smb2_deltree(tree, BASEDIR);
status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
CHECK_STATUS(status, NT_STATUS_OK);
smb2_util_close(tree, testdirh);
- ret = torture_setup_local_file(tctx, "localdir", fname_local,
- NULL, 0);
- if (ret == false) {
- goto done;
- }
+ ret = torture_setup_file(tctx, tree, fname, false);
+ torture_assert_goto(tctx, ret == true, ret, done,
+ "torture_setup_file failed\n");
- ret = torture_setup_local_file(tctx, "localdir", adname_local,
- osx_adouble_w_xattr,
- sizeof(osx_adouble_w_xattr));
- if (ret == false) {
- goto done;
- }
+ ret = torture_setup_file(tctx, tree, adname, false);
+ torture_assert_goto(tctx, ret == true, ret, done,
+ "torture_setup_file failed\n");
+
+ ret = write_stream(tree, __location__, tctx, mem_ctx,
+ adname, NULL,
+ 0, sizeof(osx_adouble_w_xattr), osx_adouble_w_xattr);
+ torture_assert_goto(tctx, ret == true, ret, done,
+ "write_stream failed\n");
torture_comment(tctx, "(%s) test OS X AppleDouble conversion\n",
__location__);