mirror of
https://github.com/samba-team/samba.git
synced 2025-02-08 05:57:51 +03:00
s3: VFS: solarisacl: Add solarisacl_sys_acl_delete_def_fd().
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Noel Power <npower@samba.org>
This commit is contained in:
parent
c72c4b5b32
commit
88a2e9f980
@ -351,6 +351,59 @@ int solarisacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* delete the default ACL of a directory
|
||||||
|
*
|
||||||
|
* This is achieved by fetching the access ACL and rewriting it
|
||||||
|
* directly, via the solaris system call: the SETACL call on
|
||||||
|
* directories writes both the access and the default ACL as provided.
|
||||||
|
*
|
||||||
|
* XXX: posix acl_delete_def_file returns an error if
|
||||||
|
* the file referred to by path is not a directory.
|
||||||
|
* this function does not complain but the actions
|
||||||
|
* have no effect on a file other than a directory.
|
||||||
|
* But sys_acl_delete_default_file is only called in
|
||||||
|
* smbd/posixacls.c after having checked that the file
|
||||||
|
* is a directory, anyways. So implementing the extra
|
||||||
|
* check is considered unnecessary. --- Agreed? XXX
|
||||||
|
*/
|
||||||
|
int solarisacl_sys_acl_delete_def_fd(vfs_handle_struct *handle,
|
||||||
|
files_struct *fsp)
|
||||||
|
{
|
||||||
|
SMB_ACL_T smb_acl;
|
||||||
|
int ret = -1;
|
||||||
|
SOLARIS_ACL_T solaris_acl = NULL;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
DBG_DEBUG("entering solarisacl_sys_acl_delete_def_fd.\n");
|
||||||
|
|
||||||
|
smb_acl = solarisacl_sys_acl_get_file(handle, fsp->fsp_name->base_name,
|
||||||
|
SMB_ACL_TYPE_ACCESS, talloc_tos());
|
||||||
|
if (smb_acl == NULL) {
|
||||||
|
DBG_DEBUG("getting file acl failed!\n");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
if (!smb_acl_to_solaris_acl(smb_acl, &solaris_acl, &count,
|
||||||
|
SMB_ACL_TYPE_ACCESS))
|
||||||
|
{
|
||||||
|
DBG_DEBUG("conversion smb_acl -> solaris_acl failed.\n");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
if (!solaris_acl_sort(solaris_acl, count)) {
|
||||||
|
DBG_DEBUG("resulting acl is not valid!\n");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
ret = acl(fsp->fsp_name->base_name, SETACL, count, solaris_acl);
|
||||||
|
if (ret != 0) {
|
||||||
|
DBG_DEBG("settinge file acl failed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
DBG_DEBUG("solarisacl_sys_acl_delete_def_fd %s.\n",
|
||||||
|
((ret != 0) ? "failed" : "succeeded" ));
|
||||||
|
TALLOC_FREE(smb_acl);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* private functions */
|
/* private functions */
|
||||||
|
|
||||||
@ -779,6 +832,7 @@ static struct vfs_fn_pointers solarisacl_fns = {
|
|||||||
.sys_acl_blob_get_fd_fn = posix_sys_acl_blob_get_fd,
|
.sys_acl_blob_get_fd_fn = posix_sys_acl_blob_get_fd,
|
||||||
.sys_acl_set_fd_fn = solarisacl_sys_acl_set_fd,
|
.sys_acl_set_fd_fn = solarisacl_sys_acl_set_fd,
|
||||||
.sys_acl_delete_def_file_fn = solarisacl_sys_acl_delete_def_file,
|
.sys_acl_delete_def_file_fn = solarisacl_sys_acl_delete_def_file,
|
||||||
|
.sys_acl_delete_def_fd_fn = solarisacl_sys_acl_delete_def_fd,
|
||||||
};
|
};
|
||||||
|
|
||||||
static_decl_vfs;
|
static_decl_vfs;
|
||||||
|
@ -41,6 +41,9 @@ int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle,
|
|||||||
int solarisacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
|
int solarisacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
|
||||||
const struct smb_filename *smb_fname);
|
const struct smb_filename *smb_fname);
|
||||||
|
|
||||||
|
int solarisacl_sys_acl_delete_def_fd(vfs_handle_struct *handle,
|
||||||
|
files_struct *fsp);
|
||||||
|
|
||||||
NTSTATUS vfs_solarisacl_init(TALLOC_CTX *);
|
NTSTATUS vfs_solarisacl_init(TALLOC_CTX *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user