s3: VFS: Change SMB_VFS_SYS_ACL_DELETE_DEF_FILE to use const struct smb_filename...
[sfrench/samba-autobuild/.git] / source3 / modules / vfs_zfsacl.c
index 93a0faa6d5cbbbaa6231396e33f026eaf4df9b6f..c59a910626046803e5f977e8e9edd0b1f9ad9cc3 100644 (file)
  */
 static NTSTATUS zfs_get_nt_acl_common(TALLOC_CTX *mem_ctx,
                                      const char *name,
-                                     SMB4ACL_T **ppacl)
+                                     struct SMB4ACL_T **ppacl)
 {
        int naces, i;
        ace_t *acebuf;
-       SMB4ACL_T *pacl;
+       struct SMB4ACL_T *pacl;
 
        /* read the number of file aces */
        if((naces = acl(name, ACE_GETACLCNT, 0, NULL)) == -1) {
@@ -79,10 +79,10 @@ static NTSTATUS zfs_get_nt_acl_common(TALLOC_CTX *mem_ctx,
        for(i=0; i<naces; i++) {
                SMB_ACE4PROP_T aceprop;
 
-               aceprop.aceType  = (uint32) acebuf[i].a_type;
-               aceprop.aceFlags = (uint32) acebuf[i].a_flags;
-               aceprop.aceMask  = (uint32) acebuf[i].a_access_mask;
-               aceprop.who.id   = (uint32) acebuf[i].a_who;
+               aceprop.aceType  = (uint32_t) acebuf[i].a_type;
+               aceprop.aceFlags = (uint32_t) acebuf[i].a_flags;
+               aceprop.aceMask  = (uint32_t) acebuf[i].a_access_mask;
+               aceprop.who.id   = (uint32_t) acebuf[i].a_who;
 
                if(aceprop.aceFlags & ACE_OWNER) {
                        aceprop.flags = SMB_ACE4_ID_SPECIAL;
@@ -105,11 +105,12 @@ static NTSTATUS zfs_get_nt_acl_common(TALLOC_CTX *mem_ctx,
 }
 
 /* call-back function processing the NT acl -> ZFS acl using NFSv4 conv. */
-static bool zfs_process_smbacl(vfs_handle_struct *handle, files_struct *fsp, SMB4ACL_T *smbacl)
+static bool zfs_process_smbacl(vfs_handle_struct *handle, files_struct *fsp,
+                              struct SMB4ACL_T *smbacl)
 {
        int naces = smb_get_naces(smbacl), i;
        ace_t *acebuf;
-       SMB4ACE_T *smbace;
+       struct SMB4ACE_T *smbace;
        TALLOC_CTX      *mem_ctx;
        bool have_special_id = false;
 
@@ -142,7 +143,7 @@ static bool zfs_process_smbacl(vfs_handle_struct *handle, files_struct *fsp, SMB
                                acebuf[i].a_flags |= ACE_OWNER;
                                break;
                        case SMB_ACE4_WHO_GROUP:
-                               acebuf[i].a_flags |= ACE_GROUP;
+                               acebuf[i].a_flags |= ACE_GROUP|ACE_IDENTIFIER_GROUP;
                                break;
                        default:
                                DEBUG(8, ("unsupported special_id %d\n", \
@@ -183,20 +184,20 @@ static bool zfs_process_smbacl(vfs_handle_struct *handle, files_struct *fsp, SMB
  * using the NFSv4 format conversion
  */
 static NTSTATUS zfs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                          uint32 security_info_sent,
+                          uint32_t security_info_sent,
                           const struct security_descriptor *psd)
 {
-        return smb_set_nt_acl_nfs4(handle, fsp, security_info_sent, psd,
+        return smb_set_nt_acl_nfs4(handle, fsp, NULL, security_info_sent, psd,
                                   zfs_process_smbacl);
 }
 
 static NTSTATUS zfsacl_fget_nt_acl(struct vfs_handle_struct *handle,
                                   struct files_struct *fsp,
-                                  uint32 security_info,
+                                  uint32_t security_info,
                                   TALLOC_CTX *mem_ctx,
                                   struct security_descriptor **ppdesc)
 {
-       SMB4ACL_T *pacl;
+       struct SMB4ACL_T *pacl;
        NTSTATUS status;
        TALLOC_CTX *frame = talloc_stackframe();
 
@@ -208,36 +209,44 @@ static NTSTATUS zfsacl_fget_nt_acl(struct vfs_handle_struct *handle,
                return status;
        }
 
-       status = smb_fget_nt_acl_nfs4(fsp, security_info, mem_ctx, ppdesc, pacl);
+       status = smb_fget_nt_acl_nfs4(fsp, NULL, security_info, mem_ctx,
+                                     ppdesc, pacl);
        TALLOC_FREE(frame);
        return status;
 }
 
 static NTSTATUS zfsacl_get_nt_acl(struct vfs_handle_struct *handle,
-                                 const char *name, uint32 security_info,
-                                 TALLOC_CTX *mem_ctx,
-                                 struct security_descriptor **ppdesc)
+                               const struct smb_filename *smb_fname,
+                               uint32_t security_info,
+                               TALLOC_CTX *mem_ctx,
+                               struct security_descriptor **ppdesc)
 {
-       SMB4ACL_T *pacl;
+       struct SMB4ACL_T *pacl;
        NTSTATUS status;
        TALLOC_CTX *frame = talloc_stackframe();
 
-       status = zfs_get_nt_acl_common(frame, name, &pacl);
+       status = zfs_get_nt_acl_common(frame,
+                                       smb_fname->base_name,
+                                       &pacl);
        if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(frame);
                return status;
        }
 
-       status = smb_get_nt_acl_nfs4(handle->conn, name, security_info,
-                                    mem_ctx, ppdesc,
-                                    pacl);
+       status = smb_get_nt_acl_nfs4(handle->conn,
+                                       smb_fname,
+                                       NULL,
+                                       security_info,
+                                       mem_ctx,
+                                       ppdesc,
+                                       pacl);
        TALLOC_FREE(frame);
        return status;
 }
 
 static NTSTATUS zfsacl_fset_nt_acl(vfs_handle_struct *handle,
                         files_struct *fsp,
-                        uint32 security_info_sent,
+                        uint32_t security_info_sent,
                         const struct security_descriptor *psd)
 {
        return zfs_set_nt_acl(handle, fsp, security_info_sent, psd);
@@ -305,7 +314,7 @@ static int zfsacl_fail__sys_acl_set_fd(vfs_handle_struct *handle,
 }
 
 static int zfsacl_fail__sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                               const char *path)
+                       const struct smb_filename *smb_fname)
 {
        return -1;
 }
@@ -335,8 +344,8 @@ static struct vfs_fn_pointers zfsacl_fns = {
        .fset_nt_acl_fn = zfsacl_fset_nt_acl,
 };
 
-NTSTATUS vfs_zfsacl_init(void);
-NTSTATUS vfs_zfsacl_init(void)
+NTSTATUS vfs_zfsacl_init(TALLOC_CTX *);
+NTSTATUS vfs_zfsacl_init(TALLOC_CTX *ctx)
 {
        return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "zfsacl",
                                &zfsacl_fns);