[PATCH] Small (*cough*) patchset for vfs_fruit bug #12427

Ralph Böhme slow at samba.org
Wed Feb 8 08:41:41 UTC 2017


On Mon, Feb 06, 2017 at 07:35:27AM +0200, Uri Simchoni wrote:
> Continuing from 36/56 with some minor comments, then responding to last
> email. Everything else LGTM.
> 
> Thanks for bearing with me,
> Uri.

thanks for taking the stab! :)

Just a quick update, still working through your review feedback, also adding
caching to catia handle based ops.

I also have two fixups that I will squash into the apporpiate patch, attaching
them here so you can take a look before I squash them.

Cheerio!
-slow
-------------- next part --------------
From 8dc7ba34c069fb8a62477df1e3dfd81fb61b51d9 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Tue, 7 Feb 2017 15:01:53 +0100
Subject: [PATCH 1/2] FIXUP: use stat info from base_fsp, this is also supposed
 to be valid in the VFS stack

Fingers crossed...
---
 source3/modules/vfs_fruit.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 15bb319..8547161 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -2839,15 +2839,9 @@ static int fruit_open_rsrc_adouble(vfs_handle_struct *handle,
 	SMB_VFS_HANDLE_GET_DATA(handle, config,
 				struct fruit_config_data, return -1);
 
-	if (!(flags & O_CREAT) && !VALID_STAT(smb_fname->st)) {
-		rc = SMB_VFS_NEXT_STAT(handle, smb_fname);
-		if (rc != 0) {
-			rc = -1;
-			goto exit;
-		}
-	}
-
-	if (VALID_STAT(smb_fname->st) && S_ISDIR(smb_fname->st.st_ex_mode)) {
+	if ((!(flags & O_CREAT)) &&
+	    S_ISDIR(fsp->base_fsp->fsp_name->st.st_ex_mode))
+	{
 		/* sorry, but directories don't habe a resource fork */
 		rc = -1;
 		goto exit;
-- 
2.9.3


From 82a64e09d57e329071a7e4bde94693af71c172d4 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Tue, 7 Feb 2017 15:45:06 +0100
Subject: [PATCH 2/2] FIXUP: fruit_streaminfo_rsrc_adouble: AFPRESOURCE_STREAM

Remove AFPRESOURCE_STREAM streams returned from the next VFS module in
the stack.
---
 source3/modules/vfs_fruit.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 8547161..3315d44 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -4574,9 +4574,33 @@ static NTSTATUS fruit_streaminfo_rsrc_adouble(
 	unsigned int *pnum_streams,
 	struct stream_struct **pstreams)
 {
+	struct stream_struct *stream = *pstreams;
+	unsigned int num_streams = *pnum_streams;
 	struct adouble *ad = NULL;
 	bool ok;
 	size_t rlen;
+	int i;
+
+	/*
+	 * Check if there's a AFPRESOURCE_STREAM from the VFS streams backend
+	 * and if yes, remove it from the list
+	 */
+	for (i = 0; i < num_streams; i++) {
+		if (strequal_m(stream[i].name, AFPRESOURCE_STREAM)) {
+			break;
+		}
+	}
+
+	if (i < num_streams) {
+		DBG_WARNING("Unexpected AFPINFO_STREAM on [%s]\n",
+			    smb_fname_str_dbg(smb_fname));
+
+		ok = del_fruit_stream(mem_ctx, pnum_streams, pstreams,
+				      AFPRESOURCE_STREAM);
+		if (!ok) {
+			return NT_STATUS_INTERNAL_ERROR;
+		}
+	}
 
 	ad = ad_get(talloc_tos(), handle, smb_fname->base_name,
 		    ADOUBLE_RSRC);
-- 
2.9.3



More information about the samba-technical mailing list