From: Jeremy Allison Date: Wed, 9 Jun 2021 00:09:51 +0000 (-0700) Subject: s3: VFS: solarisacl: Remove solarisacl_sys_acl_set_file(). X-Git-Tag: tevent-0.11.0~457 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=96ef845430f6f5bb43778c3fbdde57f07a61b575;p=thirdparty%2Fsamba.git s3: VFS: solarisacl: Remove solarisacl_sys_acl_set_file(). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Wed Jun 9 14:04:13 UTC 2021 on sn-devel-184 --- diff --git a/source3/modules/vfs_solarisacl.c b/source3/modules/vfs_solarisacl.c index 1d20354bfbe..4a1d652e385 100644 --- a/source3/modules/vfs_solarisacl.c +++ b/source3/modules/vfs_solarisacl.c @@ -143,103 +143,6 @@ SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle, return result; } -int solarisacl_sys_acl_set_file(vfs_handle_struct *handle, - const struct smb_filename *smb_fname_in, - SMB_ACL_TYPE_T type, - SMB_ACL_T theacl) -{ - int ret = -1; - SOLARIS_ACL_T solaris_acl = NULL; - int count; - struct smb_filename *smb_fname = NULL; - - smb_fname = cp_smb_filename_nostream(talloc_tos(), smb_fname_in); - if (smb_fname == NULL) { - errno = ENOMEM; - goto done; - } - - DEBUG(10, ("solarisacl_sys_acl_set_file called for file '%s'\n", - smb_fname->base_name)); - - if ((type != SMB_ACL_TYPE_ACCESS) && (type != SMB_ACL_TYPE_DEFAULT)) { - errno = EINVAL; - DEBUG(10, ("invalid smb acl type given (%d).\n", type)); - goto done; - } - DEBUGADD(10, ("setting %s acl\n", - ((type == SMB_ACL_TYPE_ACCESS) ? "access" : "default"))); - - if(!smb_acl_to_solaris_acl(theacl, &solaris_acl, &count, type)) { - DEBUG(10, ("conversion smb_acl -> solaris_acl failed (%s).\n", - strerror(errno))); - goto done; - } - - /* - * if the file is a directory, there is extra work to do: - * since the solaris acl call stores both the access acl and - * the default acl as provided, we have to get the acl part - * that has not been specified in "type" from the file first - * and concatenate it with the acl provided. - * - * We can directly use SMB_VFS_STAT here, as if this was a - * POSIX call on a symlink, we've already refused it. - * For a Windows acl mapped call on a symlink, we want to follow - * it. - */ - ret = SMB_VFS_STAT(handle->conn, smb_fname); - if (ret != 0) { - DEBUG(10, ("Error in stat call: %s\n", strerror(errno))); - goto done; - } - if (S_ISDIR(smb_fname->st.st_ex_mode)) { - SOLARIS_ACL_T other_acl = NULL; - int other_count; - SMB_ACL_TYPE_T other_type; - - other_type = (type == SMB_ACL_TYPE_ACCESS) - ? SMB_ACL_TYPE_DEFAULT - : SMB_ACL_TYPE_ACCESS; - DEBUGADD(10, ("getting acl from filesystem\n")); - if (!solaris_acl_get_file(smb_fname->base_name, - &other_acl, &other_count)) { - DEBUG(10, ("error getting acl from directory\n")); - goto done; - } - DEBUG(10, ("adding %s part of fs acl to given acl\n", - ((other_type == SMB_ACL_TYPE_ACCESS) - ? "access" - : "default"))); - if (!solaris_add_to_acl(&solaris_acl, &count, other_acl, - other_count, other_type)) - { - DEBUG(10, ("error adding other acl.\n")); - SAFE_FREE(other_acl); - goto done; - } - SAFE_FREE(other_acl); - } - else if (type != SMB_ACL_TYPE_ACCESS) { - errno = EINVAL; - goto done; - } - - if (!solaris_acl_sort(solaris_acl, count)) { - DEBUG(10, ("resulting acl is not valid!\n")); - goto done; - } - - ret = acl(smb_fname->base_name, SETACL, count, solaris_acl); - - done: - DEBUG(10, ("solarisacl_sys_acl_set_file %s.\n", - ((ret != 0) ? "failed" : "succeeded"))); - SAFE_FREE(solaris_acl); - TALLOC_FREE(smb_fname); - return ret; -} - /* * set the access ACL on the file referred to by a fd */ diff --git a/source3/modules/vfs_solarisacl.h b/source3/modules/vfs_solarisacl.h index a40cbc3fef7..f914304fd24 100644 --- a/source3/modules/vfs_solarisacl.h +++ b/source3/modules/vfs_solarisacl.h @@ -29,11 +29,6 @@ SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, TALLOC_CTX *mem_ctx); -int solarisacl_sys_acl_set_file(vfs_handle_struct *handle, - const struct smb_filename *smb_fname, - SMB_ACL_TYPE_T type, - SMB_ACL_T theacl); - int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_TYPE_T type,