vfs_fruit: move zero file-id to vfs_fruit
authorRalph Boehme <slow@samba.org>
Sat, 29 Jun 2019 12:35:49 +0000 (14:35 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 1 Jul 2019 21:43:24 +0000 (21:43 +0000)
Now that this stuff goes through the VFS, let's do it right. :)

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_default.c
source3/modules/vfs_fruit.c
source3/smbd/globals.h
source3/smbd/proto.h
source3/smbd/trans2.c

index bcad1c8a73694811aaf6824417970c75d1ee7e3a..68d9200ce889b33aa63389b6d83297f084629a94 100644 (file)
@@ -2733,10 +2733,6 @@ static uint64_t vfswrap_fs_file_id(struct vfs_handle_struct *handle,
 {
        uint64_t file_id;
 
-       if (handle->conn->sconn->aapl_zero_file_id) {
-               return 0;
-       }
-
        if (!(psbuf->st_ex_iflags & ST_EX_IFLAG_CALCULATED_ITIME)) {
                return psbuf->st_ex_file_id;
        }
index 9916bd12f5a465a8717a4653690502df58be8fec..02b6d0dc0f673a9b72fb867187482ca007e8053e 100644 (file)
@@ -2980,9 +2980,6 @@ static NTSTATUS check_aapl(vfs_handle_struct *handle,
                                      blob);
        if (NT_STATUS_IS_OK(status)) {
                global_fruit_config.nego_aapl = true;
-               if (config->aapl_zero_file_id) {
-                       aapl_force_zero_file_id(handle->conn->sconn);
-               }
        }
 
        return status;
@@ -7135,6 +7132,22 @@ static uint64_t fruit_disk_free(vfs_handle_struct *handle,
        return dfree / 2;
 }
 
+static uint64_t fruit_fs_file_id(struct vfs_handle_struct *handle,
+                                const SMB_STRUCT_STAT *psbuf)
+{
+       struct fruit_config_data *config = NULL;
+
+       SMB_VFS_HANDLE_GET_DATA(handle, config,
+                               struct fruit_config_data,
+                               return 0);
+
+       if (config->aapl_zero_file_id) {
+               return 0;
+       }
+
+       return SMB_VFS_NEXT_FS_FILE_ID(handle, psbuf);
+}
+
 static struct vfs_fn_pointers vfs_fruit_fns = {
        .connect_fn = fruit_connect,
        .disk_free_fn = fruit_disk_free,
@@ -7166,6 +7179,7 @@ static struct vfs_fn_pointers vfs_fruit_fns = {
        .offload_read_recv_fn = fruit_offload_read_recv,
        .offload_write_send_fn = fruit_offload_write_send,
        .offload_write_recv_fn = fruit_offload_write_recv,
+       .fs_file_id_fn = fruit_fs_file_id,
 
        /* NT ACL operations */
        .fget_nt_acl_fn = fruit_fget_nt_acl,
index f0c1624babe6beff97e9219c7df53691c8d6b042..03d50882d163bff0793d00522254bb8322f8e8fb 100644 (file)
@@ -858,7 +858,6 @@ struct smbd_server_connection {
        struct messaging_context *msg_ctx;
        struct notify_context *notify_ctx;
        bool using_smb2;
-       bool aapl_zero_file_id; /* Apple-specific */
        int trans_num;
 
        size_t num_users;
index 1dd1a8dbef4d1d6c6f3ccdddfdeb81b44388f0a7..112acfa4ad409a604b3ee259a5d439530d1881de 100644 (file)
@@ -1161,7 +1161,6 @@ int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf);
 NTSTATUS check_access_fsp(const struct files_struct *fsp,
                          uint32_t access_mask);
 uint64_t smb_roundup(connection_struct *conn, uint64_t val);
-void aapl_force_zero_file_id(struct smbd_server_connection *sconn);
 bool samba_private_attr_name(const char *unix_ea_name);
 NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn,
                        files_struct *fsp,
index 9a2ae9b2f47f99d8150d53b6ab3844b1b46a08f7..4f183ecd6017bb9c54116244e662a91f3307d815 100644 (file)
@@ -213,16 +213,6 @@ uint64_t smb_roundup(connection_struct *conn, uint64_t val)
        return val;
 }
 
-/********************************************************************
- Globally (for this connection / multi-channel) disable file-ID
- calculation. This is required to be global because it serves
- Macs in AAPL mode, which is globally set.
-********************************************************************/
-void aapl_force_zero_file_id(struct smbd_server_connection *sconn)
-{
-       sconn->aapl_zero_file_id = true;
-}
-
 /****************************************************************************
  Utility functions for dealing with extended attributes.
 ****************************************************************************/