vfs_fruit: make "fruit:zero_file_id" a per share option
authorRalph Boehme <slow@samba.org>
Sun, 30 Jun 2019 12:24:59 +0000 (14:24 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 1 Jul 2019 21:43:24 +0000 (21:43 +0000)
Now that File-ID calculation goes through the VFS, we can nicely make a
per-share option out of it.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
docs-xml/manpages/vfs_fruit.8.xml
selftest/target/Samba3.pm
source3/modules/vfs_fruit.c
source3/selftest/tests.py

index c5bd593a1392e7a3fe5de43ea67bb707e411439c..364b1536f66b92178d600e098846369309eb9305 100644 (file)
            </listitem>
          </varlistentry>
 
-         <varlistentry>
-           <term>fruit:zero_file_id = yes | no</term>
-           <listitem>
-             <para>A <emphasis>global</emphasis> option whether to return
-             zero to queries of on-disk file identifier, if the client
-             has negotiated AAPL.</para>
-             <para>Mac applications and / or the Mac SMB
-             client code expect the on-disk file identifier to have the
-             semantics of HFS+ Catalog Node Identifier (CNID). Samba
-             doesn't provide those semantics, and that occasionally cause
-             usability issues or even data loss. Returning a file identifier
-             of zero causes the Mac client to stop using and trusting the
-             file id returned from the server.</para>
-             <para>The default is <emphasis>yes</emphasis>.</para>
-           </listitem>
-         </varlistentry>
-
          <varlistentry>
            <term>fruit:model = MacSamba</term>
            <listitem>
            </listitem>
          </varlistentry>
 
+         <varlistentry>
+           <term>fruit:zero_file_id = yes | no</term>
+           <listitem>
+             <para>Whether to return zero to queries of on-disk file
+             identifier if the client has negotiated AAPL.</para>
+             <para>Mac applications and / or the Mac SMB client code expect the
+             on-disk file identifier to have the semantics of HFS+ Catalog Node
+             Identifier (CNID). Samba provides File-IDs based on a file's
+             initial creation date if the option <smbconfoption name="store dos
+             attributes"/> is enabled.  Returning a file identifier of
+             zero causes the Mac client to stop using and trusting the file id
+             returned from the server.</para>
+             <para>The default is <emphasis>yes</emphasis>.</para>
+           </listitem>
+         </varlistentry>
+
        </variablelist>
 </refsect1>
 
index 34a9864cd4894a407c7ce20adb6e866dc4cbbd9c..6ce61a8b4ed9e511de66eafc25f505ba4bb03626 100755 (executable)
@@ -1995,6 +1995,13 @@ sub provision($$$$$$$$$)
        fruit:delete_empty_adfiles = true
        fruit:veto_appledouble = no
 
+[vfs_fruit_zero_fileid]
+       path = $shrdir
+       vfs objects = fruit streams_xattr acl_xattr xattr_tdb
+       fruit:resource = file
+       fruit:metadata = stream
+       fruit:zero_file_id=yes
+
 [badname-tmp]
        path = $badnames_shrdir
        guest ok = yes
index 02b6d0dc0f673a9b72fb867187482ca007e8053e..ea97cb93b30336ae1bb9dc11fc2f3aafc0ee4e10 100644 (file)
@@ -2225,7 +2225,8 @@ static int init_fruit_config(vfs_handle_struct *handle)
                SNUM(handle->conn), FRUIT_PARAM_TYPE_NAME, "posix_rename", true);
 
        config->aapl_zero_file_id =
-           lp_parm_bool(-1, FRUIT_PARAM_TYPE_NAME, "zero_file_id", true);
+           lp_parm_bool(SNUM(handle->conn), FRUIT_PARAM_TYPE_NAME,
+                        "zero_file_id", true);
 
        config->readdir_attr_rsize = lp_parm_bool(
                SNUM(handle->conn), "readdir_attr", "aapl_rsize", true);
@@ -7141,7 +7142,9 @@ static uint64_t fruit_fs_file_id(struct vfs_handle_struct *handle,
                                struct fruit_config_data,
                                return 0);
 
-       if (config->aapl_zero_file_id) {
+       if (global_fruit_config.nego_aapl &&
+           config->aapl_zero_file_id)
+       {
                return 0;
        }
 
index a3cd890e9034e9c8d64b3a500bba745e99d8669f..5ef227732bee7d865f02138ae0f3f2832ed565b1 100755 (executable)
@@ -616,7 +616,7 @@ for t in tests:
     elif t == "vfs.fruit_timemachine":
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit_timemachine -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share')
     elif t == "vfs.fruit_file_id":
-        plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit -U$USERNAME%$PASSWORD')
+        plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit_zero_fileid -U$USERNAME%$PASSWORD')
     elif t == "vfs.fruit_conversion":
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --option=torture:share2=vfs_fruit_wipe_intentionally_left_blank_rfork --option=torture:delete_empty_adfiles=false', 'wipe_intentionally_left_blank_rfork')
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --option=torture:share2=vfs_fruit_delete_empty_adfiles --option=torture:delete_empty_adfiles=true', 'delete_empty_adfiles')