vfs_fruit: add a flag that tracks whether use of AAPL was negotiated
authorRalph Boehme <slow@samba.org>
Wed, 25 Nov 2015 08:12:55 +0000 (09:12 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 1 Dec 2015 19:45:20 +0000 (20:45 +0100)
Add a flag that tracks whether use of AAPL was negotiated, ensuring we
don't enable AAPL features for clients that didn't negotiate it.

Torture test that need AAPL must call the new function enable_aapl().

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

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

index bd71ff1ec5497597c702219889921c45a06c3763..79c6651dbb6c12a5835c4bd5bfabe392a5e0f023 100644 (file)
@@ -125,7 +125,8 @@ struct fruit_config_data {
        enum fruit_meta meta;
        enum fruit_locking locking;
        enum fruit_encoding encoding;
-       bool use_aapl;
+       bool use_aapl;          /* config from smb.conf */
+       bool nego_aapl;         /* client negotiated AAPL */
        bool use_copyfile;
        bool readdir_attr_enabled;
        bool unix_info_enabled;
@@ -1926,6 +1927,9 @@ static NTSTATUS check_aapl(vfs_handle_struct *handle,
                                      out_context_blobs,
                                      SMB2_CREATE_TAG_AAPL,
                                      blob);
+       if (NT_STATUS_IS_OK(status)) {
+               config->nego_aapl = true;
+       }
 
        return status;
 }
@@ -3386,16 +3390,20 @@ static NTSTATUS fruit_create_file(vfs_handle_struct *handle,
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
+
        fsp = *result;
 
-       if (config->copyfile_enabled) {
-               /*
-                * Set a flag in the fsp. Gets used in copychunk to
-                * check whether the special Apple copyfile semantics
-                * for copychunk should be allowed in a copychunk
-                * request with a count of 0.
-                */
-               fsp->aapl_copyfile_supported = true;
+       if (config->nego_aapl) {
+               if (config->copyfile_enabled) {
+                       /*
+                        * Set a flag in the fsp. Gets used in
+                        * copychunk to check whether the special
+                        * Apple copyfile semantics for copychunk
+                        * should be allowed in a copychunk request
+                        * with a count of 0.
+                        */
+                       fsp->aapl_copyfile_supported = true;
+               }
        }
 
        /*