[PATCH] Display computer symbol in MacOs Finder when using vfs_fruit

Ralph Böhme slow at samba.org
Sun Jul 9 13:55:05 UTC 2017


On Sun, Jul 09, 2017 at 01:45:03PM +0200, Ralph Böhme wrote:
> On Thu, Jul 06, 2017 at 05:54:07PM +0200, Günther Deschner wrote:
> > please review and push.
> 
> nice! Pushed.

failed:

Renaming directory without AAPL, must fail
Enabling AAPL
Comparing returned AAPL capabilities
WARNING!: ../source4/torture/vfs/fruit.c:1255: Expression `aapl->data.length == 50' failed: bad AAPL size
UNEXPECTED(failure): samba3.vfs.fruit metadata_netatalk.rename_dir_openfile(nt4_dc)
REASON: Exception: Exception: ../source4/torture/vfs/fruit.c:2889: Expression
`ret == 1' failed: enable_aapl failed

Attached updated patch fixes the AAPL ctx size check. Please review & push if happy.

Cheerio!
-slow
-------------- next part --------------
From c36beaabb1dbb4c757dbebe7e3ab5e818a0c0474 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Wed, 28 Jun 2017 18:10:28 +0200
Subject: [PATCH] vfs_fruit: add fruit:model = <modelname> parametric option

fruit:model = iMac
fruit:model = MacBook
fruit:model = MacPro
fruit:model = Xserve

will all display a different icon inside Finder.

Formerly, we used "Samba" which resulted in a "?" icon in Finder, with
the new default "MacSamba" we appear with a computer box icon at least.

Guenther

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

Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
---
 docs-xml/manpages/vfs_fruit.8.xml | 9 +++++++++
 source3/modules/vfs_fruit.c       | 6 +++++-
 source4/torture/vfs/fruit.c       | 8 +++++++-
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/docs-xml/manpages/vfs_fruit.8.xml b/docs-xml/manpages/vfs_fruit.8.xml
index 0bddd4a..1637a77 100644
--- a/docs-xml/manpages/vfs_fruit.8.xml
+++ b/docs-xml/manpages/vfs_fruit.8.xml
@@ -160,6 +160,15 @@
 	    </listitem>
 	  </varlistentry>
 
+	  <varlistentry>
+	    <term>fruit:model = MacSamba</term>
+	    <listitem>
+	      <para>This option defines the model string inside the AAPL
+	      extension and will determine the appearance of the icon representing the
+	      Samba server in the Finder window.</para>
+	      <para>The default is <emphasis>MacSamba</emphasis>.</para>
+	    </listitem>
+	  </varlistentry>
 	</variablelist>
 </refsect1>
 
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index b49ee1c..3482d4e 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -138,6 +138,7 @@ struct fruit_config_data {
 	bool veto_appledouble;
 	bool posix_rename;
 	bool aapl_zero_file_id;
+	const char *model;
 
 	/*
 	 * Additional options, all enabled by default,
@@ -1628,6 +1629,9 @@ static int init_fruit_config(vfs_handle_struct *handle)
 	config->readdir_attr_max_access = lp_parm_bool(
 		SNUM(handle->conn), "readdir_attr", "aapl_max_access", true);
 
+	config->model = lp_parm_const_string(
+		-1, FRUIT_PARAM_TYPE_NAME, "model", "MacSamba");
+
 	SMB_VFS_HANDLE_SET_DATA(handle, config,
 				NULL, struct fruit_config_data,
 				return -1);
@@ -2272,7 +2276,7 @@ static NTSTATUS check_aapl(vfs_handle_struct *handle,
 	if (req_bitmap & SMB2_CRTCTX_AAPL_MODEL_INFO) {
 		ok = convert_string_talloc(req,
 					   CH_UNIX, CH_UTF16LE,
-					   "Samba", strlen("Samba"),
+					   config->model, strlen(config->model),
 					   &model, &modellen);
 		if (!ok) {
 			return NT_STATUS_UNSUCCESSFUL;
diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c
index 2ab153a..c78c906 100644
--- a/source4/torture/vfs/fruit.c
+++ b/source4/torture/vfs/fruit.c
@@ -1252,7 +1252,13 @@ static bool enable_aapl(struct torture_context *tctx,
 	torture_assert_goto(tctx, aapl != NULL, ret, done, "missing AAPL context");
 
 	if (!is_osx_server) {
-		torture_assert_goto(tctx, aapl->data.length == 50, ret, done, "bad AAPL size");
+		size_t exptected_aapl_ctx_size;
+
+		exptected_aapl_ctx_size = strlen("MacSamba") * 2 + 40;
+
+		torture_assert_goto(
+			tctx, aapl->data.length == exptected_aapl_ctx_size,
+			ret, done, "bad AAPL size");
 	}
 
 	aapl_server_caps = BVAL(aapl->data.data, 16);
-- 
2.9.4



More information about the samba-technical mailing list