The branch, master has been updated
       via  8c14234 vfs_fruit: Don't unlink the main file
       via  c39ec64 torture: Make sure that fruit_ftruncate only unlinks streams
      from  9c71f61 s3: smbd: Ensure get_real_filename() copes with empty 
pathnames.

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


- Log -----------------------------------------------------------------
commit 8c14234871820eacde46670d722a676fb5f3a46c
Author: Volker Lendecke <[email protected]>
Date:   Tue Aug 7 15:10:31 2018 +0200

    vfs_fruit: Don't unlink the main file
    
    The original fix for bug 13441 was missing a check that verifies that
    fruit_ftruncate() is actually called on a stream.
    
    Follow-up to
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13441
    
    Pair-Programmed-With: Volker Lendecke <[email protected]>
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>
    
    Autobuild-User(master): Volker Lendecke <[email protected]>
    Autobuild-Date(master): Thu Aug 23 15:28:48 CEST 2018 on sn-devel-144

commit c39ec64231b261fe4ada02f1f1b9aa344cf35bb5
Author: Volker Lendecke <[email protected]>
Date:   Tue Aug 7 15:11:22 2018 +0200

    torture: Make sure that fruit_ftruncate only unlinks streams
    
    Follow-up to
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13441
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

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

Summary of changes:
 source3/modules/vfs_fruit.c |  6 +++++-
 source4/torture/vfs/fruit.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index ebf0f98..1102059 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -5570,7 +5570,11 @@ static int fruit_ftruncate(struct vfs_handle_struct 
*handle,
                  (intmax_t)offset);
 
        if (fio == NULL) {
-               if (offset == 0 && global_fruit_config.nego_aapl) {
+               if (offset == 0 &&
+                   global_fruit_config.nego_aapl &&
+                   is_ntfs_stream_smb_fname(fsp->fsp_name) &&
+                   !is_ntfs_default_stream_smb_fname(fsp->fsp_name))
+               {
                        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 fc1760e..a9ae891 100644
--- a/source4/torture/vfs/fruit.c
+++ b/source4/torture/vfs/fruit.c
@@ -4773,6 +4773,51 @@ static bool test_setinfo_stream_eof(struct 
torture_context *tctx,
                tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done,
                "Unexpected status\n");
 
+       torture_comment(
+               tctx, "Setting main file EOF to 1 to force 0-truncate\n");
+
+       status = torture_smb2_testfile_access(
+               tree,
+               fname,
+               &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");
+
+       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 = fname;
+
+       status = smb2_create(tree, tctx, &create);
+       torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+                                       "torture_smb2_testfile failed\n");
+       smb2_util_close(tree, h1);
 done:
        smb2_util_unlink(tree, fname);
        smb2_util_rmdir(tree, BASEDIR);


-- 
Samba Shared Repository

Reply via email to