From 076f26dd5c9d5b2c5836f2cb66c9b2d895076ab6 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Sat, 29 Jun 2019 14:35:49 +0200 Subject: [PATCH] vfs_fruit: move zero file-id to vfs_fruit Now that this stuff goes through the VFS, let's do it right. :) Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/modules/vfs_default.c | 4 ---- source3/modules/vfs_fruit.c | 20 +++++++++++++++++--- source3/smbd/globals.h | 1 - source3/smbd/proto.h | 1 - source3/smbd/trans2.c | 10 ---------- 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index bcad1c8a736..68d9200ce88 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -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; } diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index 9916bd12f5a..02b6d0dc0f6 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -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, diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index f0c1624babe..03d50882d16 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -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; diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 1dd1a8dbef4..112acfa4ad4 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -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, diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 9a2ae9b2f47..4f183ecd601 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -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. ****************************************************************************/ -- 2.34.1