s3/modules: VFS: fake_acls: Remove fake_acls_chmod() function
authorNoel Power <noel.power@suse.com>
Thu, 8 Apr 2021 11:47:33 +0000 (12:47 +0100)
committerNoel Power <npower@samba.org>
Sun, 11 Apr 2021 22:27:34 +0000 (22:27 +0000)
Also remove fake_acls_sys_acl_set_file() which is no longer called

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_fake_acls.c

index 08e7b667149a1818d6ae3f0aa5ce9b79494462ac..c92deb850970e1092c71dda8d241670c1cd4c5b0 100644 (file)
@@ -321,36 +321,6 @@ static SMB_ACL_T fake_acls_sys_acl_get_fd(struct vfs_handle_struct *handle,
        return acl;
 }
 
-
-static int fake_acls_sys_acl_set_file(vfs_handle_struct *handle,
-                       const struct smb_filename *smb_fname,
-                       SMB_ACL_TYPE_T acltype,
-                       SMB_ACL_T theacl)
-{
-       int ret;
-       const char *name = NULL;
-       TALLOC_CTX *frame = talloc_stackframe();
-       DATA_BLOB blob = fake_acls_acl2blob(frame, theacl);
-       if (!blob.data) {
-               DEBUG(0, ("Failed to convert ACL to linear blob for xattr storage\n"));
-               TALLOC_FREE(frame);
-               errno = EINVAL;
-               return -1;
-       }
-       switch (acltype) {
-       case SMB_ACL_TYPE_ACCESS:
-               name = FAKE_ACL_ACCESS_XATTR;
-               break;
-       case SMB_ACL_TYPE_DEFAULT:
-               name = FAKE_ACL_DEFAULT_XATTR;
-               break;
-       }
-       ret = SMB_VFS_NEXT_FSETXATTR(handle, smb_fname->fsp,
-                       name, blob.data, blob.length, 0);
-       TALLOC_FREE(frame);
-       return ret;
-}
-
 static int fake_acls_sys_acl_set_fd(vfs_handle_struct *handle,
                                    struct files_struct *fsp,
                                    SMB_ACL_TYPE_T type,
@@ -604,70 +574,6 @@ static int fake_acl_process_chmod(SMB_ACL_T *pp_the_acl,
        return 0;
 }
 
-static int fake_acls_chmod(vfs_handle_struct *handle,
-                       const struct smb_filename *smb_fname_in,
-                       mode_t mode)
-{
-       TALLOC_CTX *frame = talloc_stackframe();
-       int ret = -1;
-       SMB_ACL_T the_acl = NULL;
-       struct smb_filename *smb_fname = NULL;
-       NTSTATUS status;
-       status = synthetic_pathref(talloc_tos(),
-                               handle->conn->cwd_fsp,
-                               smb_fname_in->base_name,
-                               NULL,
-                               NULL,
-                               smb_fname_in->twrp,
-                               smb_fname_in->flags,
-                               &smb_fname);
-
-       if (!NT_STATUS_IS_OK(status)) {
-               TALLOC_FREE(frame);
-               return -1;
-       }
-
-       /*
-        * Passthrough first to preserve the
-        * S_ISUID | S_ISGID | S_ISVTX
-        * bits.
-        */
-
-       ret = SMB_VFS_NEXT_CHMOD(handle,
-                               smb_fname,
-                               mode);
-       if (ret == -1) {
-               TALLOC_FREE(frame);
-               return -1;
-       }
-
-       the_acl = fake_acls_sys_acl_get_file(handle,
-                               smb_fname,
-                               SMB_ACL_TYPE_ACCESS,
-                               talloc_tos());
-       if (the_acl == NULL) {
-               TALLOC_FREE(frame);
-               if (errno == ENOATTR) {
-                       /* No ACL on this file. Just passthrough. */
-                       return 0;
-               }
-               return -1;
-       }
-       ret = fake_acl_process_chmod(&the_acl,
-                       smb_fname->st.st_ex_uid,
-                       mode);
-       if (ret == -1) {
-               TALLOC_FREE(frame);
-               return -1;
-       }
-       ret = fake_acls_sys_acl_set_file(handle,
-                               smb_fname,
-                               SMB_ACL_TYPE_ACCESS,
-                               the_acl);
-       TALLOC_FREE(frame);
-       return ret;
-}
-
 static int fake_acls_fchmod(vfs_handle_struct *handle,
                        files_struct *fsp,
                        mode_t mode)
@@ -720,7 +626,6 @@ static struct vfs_fn_pointers vfs_fake_acls_fns = {
        .stat_fn = fake_acls_stat,
        .lstat_fn = fake_acls_lstat,
        .fstat_fn = fake_acls_fstat,
-       .chmod_fn = fake_acls_chmod,
        .fchmod_fn = fake_acls_fchmod,
        .sys_acl_get_file_fn = fake_acls_sys_acl_get_file,
        .sys_acl_get_fd_fn = fake_acls_sys_acl_get_fd,