From 67bb7d93ba8fccd030bd8d01536f3222c85134b7 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 14 Apr 2013 17:31:42 +1000 Subject: [PATCH] vfs: Add vfs_handle_struct argument to smb_set_nt_acl_nfs4 and the callback This allows the callback to call xattr based storage functions that need this argument. Andrew Bartlett Reviewed-by: Jeremy Allison --- source3/modules/nfs4_acls.c | 4 ++-- source3/modules/nfs4_acls.h | 4 ++-- source3/modules/vfs_aixacl2.c | 9 +++++---- source3/modules/vfs_gpfs.c | 8 ++++---- source3/modules/vfs_zfsacl.c | 6 +++--- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c index 67db6b023c5..fa9efc12e92 100644 --- a/source3/modules/nfs4_acls.c +++ b/source3/modules/nfs4_acls.c @@ -734,7 +734,7 @@ static SMB4ACL_T *smbacl4_win2nfs4( return theacl; } -NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp, +NTSTATUS smb_set_nt_acl_nfs4(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const struct security_descriptor *psd, set_nfs4acl_native_fn_t set_nfs4_native) @@ -819,7 +819,7 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp, if (set_acl_as_root) { become_root(); } - result = set_nfs4_native(fsp, theacl); + result = set_nfs4_native(handle, fsp, theacl); saved_errno = errno; if (set_acl_as_root) { unbecome_root(); diff --git a/source3/modules/nfs4_acls.h b/source3/modules/nfs4_acls.h index c461229c6c1..f4503963616 100644 --- a/source3/modules/nfs4_acls.h +++ b/source3/modules/nfs4_acls.h @@ -143,9 +143,9 @@ NTSTATUS smb_get_nt_acl_nfs4(connection_struct *conn, /* Callback function needed to set the native acl * when applicable */ -typedef bool (*set_nfs4acl_native_fn_t)(files_struct *, SMB4ACL_T *); +typedef bool (*set_nfs4acl_native_fn_t)(vfs_handle_struct *handle, files_struct *, SMB4ACL_T *); -NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp, +NTSTATUS smb_set_nt_acl_nfs4(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const struct security_descriptor *psd, set_nfs4acl_native_fn_t set_nfs4_native); diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c index 65625d1853e..aca7a652d66 100644 --- a/source3/modules/vfs_aixacl2.c +++ b/source3/modules/vfs_aixacl2.c @@ -338,7 +338,7 @@ static int aixjfs2_query_acl_support( return 1; /* haven't found that ACL type. */ } -static bool aixjfs2_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl) +static bool aixjfs2_process_smbacl(vfs_handle_struct *handle, files_struct *fsp, SMB4ACL_T *smbacl) { SMB4ACE_T *smbace; TALLOC_CTX *mem_ctx; @@ -413,20 +413,21 @@ static bool aixjfs2_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl) return True; } -static NTSTATUS aixjfs2_set_nt_acl_common(files_struct *fsp, uint32 security_info_sent, const struct security_descriptor *psd) +static NTSTATUS aixjfs2_set_nt_acl_common(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const struct security_descriptor *psd) { acl_type_t acl_type_info; NTSTATUS result = NT_STATUS_ACCESS_DENIED; int rc; rc = aixjfs2_query_acl_support( + handle, fsp->fsp_name, ACL_NFS4, &acl_type_info); if (rc==0) { - result = smb_set_nt_acl_nfs4( + result = smb_set_nt_acl_nfs4(handle, fsp, security_info_sent, psd, aixjfs2_process_smbacl); } else if (rc==1) { /* assume POSIX ACL - by default... */ @@ -439,7 +440,7 @@ static NTSTATUS aixjfs2_set_nt_acl_common(files_struct *fsp, uint32 security_inf NTSTATUS aixjfs2_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const struct security_descriptor *psd) { - return aixjfs2_set_nt_acl_common(fsp, security_info_sent, psd); + return aixjfs2_set_nt_acl_common(handle, fsp, security_info_sent, psd); } int aixjfs2_sys_acl_set_file(vfs_handle_struct *handle, diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 674e101c583..33a81a02625 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -453,7 +453,7 @@ static NTSTATUS gpfsacl_get_nt_acl(vfs_handle_struct *handle, return map_nt_error_from_unix(errno); } -static bool gpfsacl_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl) +static bool gpfsacl_process_smbacl(vfs_handle_struct *handle, files_struct *fsp, SMB4ACL_T *smbacl) { int ret; gpfs_aclLen_t gacl_len; @@ -549,7 +549,7 @@ static bool gpfsacl_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl) return True; } -static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_info_sent, const struct security_descriptor *psd) +static NTSTATUS gpfsacl_set_nt_acl_internal(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const struct security_descriptor *psd) { struct gpfs_acl *acl; NTSTATUS result = NT_STATUS_ACCESS_DENIED; @@ -570,7 +570,7 @@ static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_i return NT_STATUS_NOT_SUPPORTED; } - result = smb_set_nt_acl_nfs4( + result = smb_set_nt_acl_nfs4(handle, fsp, security_info_sent, psd, gpfsacl_process_smbacl); } else { /* assume POSIX ACL - by default... */ @@ -593,7 +593,7 @@ static NTSTATUS gpfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd); } - return gpfsacl_set_nt_acl_internal(fsp, security_info_sent, psd); + return gpfsacl_set_nt_acl_internal(handle, fsp, security_info_sent, psd); } static SMB_ACL_T gpfs2smb_acl(const struct gpfs_acl *pacl, TALLOC_CTX *mem_ctx) diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c index 6934ad6cf90..91e31e9c4e0 100644 --- a/source3/modules/vfs_zfsacl.c +++ b/source3/modules/vfs_zfsacl.c @@ -106,7 +106,7 @@ static NTSTATUS zfs_get_nt_acl_common(const char *name, } /* call-back function processing the NT acl -> ZFS acl using NFSv4 conv. */ -static bool zfs_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl) +static bool zfs_process_smbacl(vfs_handle_struct *handle, files_struct *fsp, SMB4ACL_T *smbacl) { int naces = smb_get_naces(smbacl), i; ace_t *acebuf; @@ -187,8 +187,8 @@ static NTSTATUS zfs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const struct security_descriptor *psd) { - return smb_set_nt_acl_nfs4(fsp, security_info_sent, psd, - zfs_process_smbacl); + return smb_set_nt_acl_nfs4(handle, fsp, security_info_sent, psd, + zfs_process_smbacl); } static NTSTATUS zfsacl_fget_nt_acl(struct vfs_handle_struct *handle, -- 2.11.4.GIT