vfs: Use posix_sys_acl_blob_get_file in vfs_gpfs for posix ACLs
authorAndrew Bartlett <abartlet@samba.org>
Wed, 10 Oct 2012 05:58:59 +0000 (16:58 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 11 Oct 2012 01:25:12 +0000 (12:25 +1100)
source3/modules/vfs_gpfs.c

index 5ab5d4a2ad15c2f88a464d8d6993bed2e07fbecc..b3cdca5cd886b22fe152f02c8197830e9475011a 100644 (file)
@@ -709,6 +709,62 @@ static SMB_ACL_T gpfsacl_sys_acl_get_fd(vfs_handle_struct *handle,
                                     GPFS_ACL_TYPE_ACCESS, mem_ctx);
 }
 
+static int gpfsacl_sys_acl_blob_get_file(vfs_handle_struct *handle, const char *path_p,
+                                     TALLOC_CTX *mem_ctx,
+                                     char **blob_description,
+                                     DATA_BLOB *blob)
+{
+       struct gpfs_config_data *config;
+
+       SMB_VFS_HANDLE_GET_DATA(handle, config,
+                               struct gpfs_config_data,
+                               return NULL);
+
+       if (!config->acl) {
+               return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, path_p, mem_ctx, blob_description, blob);
+       }
+
+       result = gpfs_get_nfs4_acl(name, &pacl);
+       if (result == 0) {
+               /* We don't have a way to linearlise the NFS4 ACL
+                * right now, and it is much closer to the NT ACL
+                * anyway */
+               errno = EINVAL;
+               return -1;
+       }
+
+       return posix_sys_acl_blob_get_file(handle, path_p, mem_ctx,
+                                          blob_description, blob);
+}
+
+static int gpfsacl_sys_acl_blob_get_fd(vfs_handle_struct *handle, files_struct *fsp,
+                                     TALLOC_CTX *mem_ctx,
+                                     char **blob_description,
+                                     DATA_BLOB *blob)
+{
+       struct gpfs_config_data *config;
+
+       SMB_VFS_HANDLE_GET_DATA(handle, config,
+                               struct gpfs_config_data,
+                               return NULL);
+
+       if (!config->acl) {
+               return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx, blob_description, blob);
+       }
+
+       result = gpfs_get_nfs4_acl(fsp->fsp_name->base_name, &pacl);
+       if (result == 0) {
+               /* We don't have a way to linearlise the NFS4 ACL
+                * right now, and it is much closer to the NT ACL
+                * anyway */
+               errno = EINVAL;
+               return -1;
+       }
+
+       return posix_sys_acl_blob_get_fd(handle, fsp, mem_ctx,
+                                        blob_description, blob);
+}
+
 static struct gpfs_acl *smb2gpfs_acl(const SMB_ACL_T pacl,
                                     SMB_ACL_TYPE_T type)
 {
@@ -1916,6 +1972,8 @@ static struct vfs_fn_pointers vfs_gpfs_fns = {
        .fset_nt_acl_fn = gpfsacl_fset_nt_acl,
        .sys_acl_get_file_fn = gpfsacl_sys_acl_get_file,
        .sys_acl_get_fd_fn = gpfsacl_sys_acl_get_fd,
+       .sys_acl_blob_get_file_fn = gpfsacl_sys_acl_blob_get_file,
+       .sys_acl_blob_get_fd_fn = gpfsacl_sys_acl_blob_get_fd,
        .sys_acl_set_file_fn = gpfsacl_sys_acl_set_file,
        .sys_acl_set_fd_fn = gpfsacl_sys_acl_set_fd,
        .sys_acl_delete_def_file_fn = gpfsacl_sys_acl_delete_def_file,