vfs_fruit: pass stream size to delete_invalid_meta_stream()
authorRalph Boehme <slow@samba.org>
Sat, 20 Oct 2018 21:46:43 +0000 (23:46 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 31 Oct 2018 20:27:22 +0000 (21:27 +0100)
delete_invalid_meta_stream() is meant to guard against random data being
present in the FinderInfo stream. If the stream size is 0, it's likely a
freshly created stream where no data has been written to yet, so don't
delete it.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_fruit.c

index a39f6d41609b8a9d20b1bb9f9ef0274359283437..05b94fcd8087c58a7adaeb17445776e13d29d619 100644 (file)
@@ -5352,7 +5352,8 @@ static NTSTATUS delete_invalid_meta_stream(
        const struct smb_filename *smb_fname,
        TALLOC_CTX *mem_ctx,
        unsigned int *pnum_streams,
-       struct stream_struct **pstreams)
+       struct stream_struct **pstreams,
+       off_t size)
 {
        struct smb_filename *sname = NULL;
        int ret;
@@ -5363,6 +5364,10 @@ static NTSTATUS delete_invalid_meta_stream(
                return NT_STATUS_INTERNAL_ERROR;
        }
 
+       if (size == 0) {
+               return NT_STATUS_OK;
+       }
+
        sname = synthetic_smb_fname(talloc_tos(),
                                    smb_fname->base_name,
                                    AFPINFO_STREAM_NAME,
@@ -5416,8 +5421,12 @@ static NTSTATUS fruit_streaminfo_meta_stream(
                DBG_ERR("Removing invalid AFPINFO_STREAM size [%jd] from [%s]\n",
                        (intmax_t)stream[i].size, smb_fname_str_dbg(smb_fname));
 
-               return delete_invalid_meta_stream(handle, smb_fname, mem_ctx,
-                                                 pnum_streams, pstreams);
+               return delete_invalid_meta_stream(handle,
+                                                 smb_fname,
+                                                 mem_ctx,
+                                                 pnum_streams,
+                                                 pstreams,
+                                                 stream[i].size);
        }
 
        /*