]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_fruit: add fruit:model = <modelname> parametric option
authorGünther Deschner <gd@samba.org>
Wed, 28 Jun 2017 16:10:28 +0000 (18:10 +0200)
committerKarolin Seeger <kseeger@samba.org>
Mon, 24 Jul 2017 00:25:21 +0000 (02:25 +0200)
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@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Wed Jul 12 03:17:57 CEST 2017 on sn-devel-144

(cherry picked from commit 259e1706e3206b215e136ea9d5beef4c9e3fcdee)

docs-xml/manpages/vfs_fruit.8.xml
source3/modules/vfs_fruit.c
source4/torture/vfs/fruit.c

index e2e696c92ebc4bcb212401a9a8d9f4f19b22a58a..08b8700afd0b2b63f4dec8f83b7c2bbb8b5cd8ec 100644 (file)
            </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>
 
index a03f45436fd6877614f93a7a96fc66f1010e8922..5b1636a577d73646ed39f18b19fbea7a7e568007 100644 (file)
@@ -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,
@@ -1589,6 +1590,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);
@@ -2212,7 +2216,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;
index 6c3fee97cc251d45f78e5afa33b86d9229d7b259..1eb5eff70eb4b7e294295243dbf89657de7597fa 100644 (file)
@@ -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);