mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
s3: VFS: Change SMB_VFS_SYS_ACL_GET_FILE to use const struct smb_filename * instead of const char *.
We need to migrate all pathname based VFS calls to use a struct to finish modernising the VFS with extra timestamp and flags parameters. Requires a few extra cleanups in calling code. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
85c8780581
commit
cea8e57eac
@ -741,7 +741,7 @@ static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
|
||||
}
|
||||
|
||||
static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
|
@ -881,11 +881,11 @@ static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
|
||||
}
|
||||
|
||||
static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
|
||||
return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname, type, mem_ctx);
|
||||
}
|
||||
|
||||
static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
|
||||
|
@ -53,8 +53,9 @@ int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
|
||||
int sys_acl_free_text(char *text);
|
||||
int sys_acl_valid(SMB_ACL_T acl_d);
|
||||
SMB_ACL_T sys_acl_get_file(struct vfs_handle_struct *handle,
|
||||
const char *path_p, SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx);
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx);
|
||||
SMB_ACL_T sys_acl_get_fd(struct vfs_handle_struct *handle, struct files_struct *fsp,
|
||||
TALLOC_CTX *mem_ctx);
|
||||
int sys_acl_set_file(struct vfs_handle_struct *handle,
|
||||
|
@ -199,6 +199,8 @@
|
||||
/* Version 37 - Add vfs_copy_chunk_flags for DUP_EXTENTS_TO_FILE */
|
||||
/* Version 37 - Change sys_acl_delete_def_file from const char *
|
||||
to const struct smb_filename * */
|
||||
/* Version 37 - Change sys_acl_get_file from const char *
|
||||
to const struct smb_filename * */
|
||||
|
||||
#define SMB_VFS_INTERFACE_VERSION 37
|
||||
|
||||
@ -858,7 +860,7 @@ struct vfs_fn_pointers {
|
||||
int (*fchmod_acl_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode);
|
||||
|
||||
SMB_ACL_T (*sys_acl_get_file_fn)(struct vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx);
|
||||
SMB_ACL_T (*sys_acl_get_fd_fn)(struct vfs_handle_struct *handle,
|
||||
@ -1314,7 +1316,7 @@ int smb_vfs_call_chmod_acl(struct vfs_handle_struct *handle,
|
||||
int smb_vfs_call_fchmod_acl(struct vfs_handle_struct *handle,
|
||||
struct files_struct *fsp, mode_t mode);
|
||||
SMB_ACL_T smb_vfs_call_sys_acl_get_file(struct vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx);
|
||||
SMB_ACL_T smb_vfs_call_sys_acl_get_fd(struct vfs_handle_struct *handle,
|
||||
|
@ -480,10 +480,10 @@
|
||||
#define SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode) \
|
||||
smb_vfs_call_fchmod_acl((handle)->next, (fsp), (mode))
|
||||
|
||||
#define SMB_VFS_SYS_ACL_GET_FILE(conn, path_p, type, mem_ctx) \
|
||||
smb_vfs_call_sys_acl_get_file((conn)->vfs_handles, (path_p), (type), (mem_ctx))
|
||||
#define SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx) \
|
||||
smb_vfs_call_sys_acl_get_file((handle)->next, (path_p), (type), (mem_ctx))
|
||||
#define SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname, type, mem_ctx) \
|
||||
smb_vfs_call_sys_acl_get_file((conn)->vfs_handles, (smb_fname), (type), (mem_ctx))
|
||||
#define SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname, type, mem_ctx) \
|
||||
smb_vfs_call_sys_acl_get_file((handle)->next, (smb_fname), (type), (mem_ctx))
|
||||
|
||||
#define SMB_VFS_SYS_ACL_GET_FD(fsp, mem_ctx) \
|
||||
smb_vfs_call_sys_acl_get_fd((fsp)->conn->vfs_handles, (fsp), (mem_ctx))
|
||||
|
@ -362,9 +362,11 @@ int sys_acl_valid(SMB_ACL_T acl_d)
|
||||
#if defined(HAVE_POSIX_ACLS)
|
||||
|
||||
SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p, SMB_ACL_TYPE_T type, TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
return posixacl_sys_acl_get_file(handle, path_p, type, mem_ctx);
|
||||
return posixacl_sys_acl_get_file(handle, smb_fname, type, mem_ctx);
|
||||
}
|
||||
|
||||
SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, TALLOC_CTX *mem_ctx)
|
||||
@ -393,10 +395,11 @@ int sys_acl_delete_def_file(vfs_handle_struct *handle,
|
||||
#elif defined(HAVE_AIX_ACLS)
|
||||
|
||||
SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p, SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
return aixacl_sys_acl_get_file(handle, path_p, type, mem_ctx);
|
||||
return aixacl_sys_acl_get_file(handle, smb_fname, type, mem_ctx);
|
||||
}
|
||||
|
||||
SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp,
|
||||
@ -426,10 +429,11 @@ int sys_acl_delete_def_file(vfs_handle_struct *handle,
|
||||
#elif defined(HAVE_TRU64_ACLS)
|
||||
|
||||
SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p, SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
return tru64acl_sys_acl_get_file(handle, path_p, type,
|
||||
return tru64acl_sys_acl_get_file(handle, smb_fname, type,
|
||||
mem_ctx);
|
||||
}
|
||||
|
||||
@ -460,10 +464,11 @@ int sys_acl_delete_def_file(vfs_handle_struct *handle,
|
||||
#elif defined(HAVE_SOLARIS_UNIXWARE_ACLS)
|
||||
|
||||
SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p, SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
return solarisacl_sys_acl_get_file(handle, path_p, type,
|
||||
return solarisacl_sys_acl_get_file(handle, smb_fname, type,
|
||||
mem_ctx);
|
||||
}
|
||||
|
||||
@ -495,10 +500,11 @@ int sys_acl_delete_def_file(vfs_handle_struct *handle,
|
||||
#elif defined(HAVE_HPUX_ACLS)
|
||||
|
||||
SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p, SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
return hpuxacl_sys_acl_get_file(handle, path_p, type, mem_ctx);
|
||||
return hpuxacl_sys_acl_get_file(handle, smb_fname, type, mem_ctx);
|
||||
}
|
||||
|
||||
SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp,
|
||||
@ -528,8 +534,9 @@ int sys_acl_delete_def_file(vfs_handle_struct *handle,
|
||||
#else /* No ACLs. */
|
||||
|
||||
SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p, SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
#ifdef ENOTSUP
|
||||
errno = ENOTSUP;
|
||||
|
@ -336,7 +336,7 @@ static int smb_acl_to_posixacl_xattr(SMB_ACL_T theacl, char *buf, size_t len)
|
||||
}
|
||||
|
||||
SMB_ACL_T posixacl_xattr_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
@ -360,16 +360,18 @@ SMB_ACL_T posixacl_xattr_acl_get_file(vfs_handle_struct *handle,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = SMB_VFS_GETXATTR(handle->conn, path_p, name, buf, size);
|
||||
ret = SMB_VFS_GETXATTR(handle->conn, smb_fname->base_name,
|
||||
name, buf, size);
|
||||
if (ret < 0 && errno == ERANGE) {
|
||||
size = SMB_VFS_GETXATTR(handle->conn, path_p, name,
|
||||
NULL, 0);
|
||||
size = SMB_VFS_GETXATTR(handle->conn, smb_fname->base_name,
|
||||
name, NULL, 0);
|
||||
if (size > 0) {
|
||||
buf = alloca(size);
|
||||
if (!buf) {
|
||||
return NULL;
|
||||
}
|
||||
ret = SMB_VFS_GETXATTR(handle->conn, path_p, name,
|
||||
ret = SMB_VFS_GETXATTR(handle->conn,
|
||||
smb_fname->base_name, name,
|
||||
buf, size);
|
||||
}
|
||||
}
|
||||
@ -380,15 +382,15 @@ SMB_ACL_T posixacl_xattr_acl_get_file(vfs_handle_struct *handle,
|
||||
if (ret == 0 || errno == ENOATTR || errno == ENODATA) {
|
||||
mode_t mode = 0;
|
||||
TALLOC_CTX *frame = talloc_stackframe();
|
||||
struct smb_filename *smb_fname =
|
||||
synthetic_smb_fname(frame, path_p, NULL, NULL, 0);
|
||||
struct smb_filename *smb_fname_tmp =
|
||||
cp_smb_filename_nostream(frame, smb_fname);
|
||||
if (smb_fname == NULL) {
|
||||
errno = ENOMEM;
|
||||
ret = -1;
|
||||
} else {
|
||||
ret = SMB_VFS_STAT(handle->conn, smb_fname);
|
||||
ret = SMB_VFS_STAT(handle->conn, smb_fname_tmp);
|
||||
if (ret == 0) {
|
||||
mode = smb_fname->st.st_ex_mode;
|
||||
mode = smb_fname_tmp->st.st_ex_mode;
|
||||
}
|
||||
}
|
||||
TALLOC_FREE(frame);
|
||||
|
@ -22,7 +22,7 @@
|
||||
#define __POSIXACL_XATTR_H__
|
||||
|
||||
SMB_ACL_T posixacl_xattr_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx);
|
||||
|
||||
|
@ -23,10 +23,11 @@
|
||||
#include "vfs_aixacl_util.h"
|
||||
|
||||
SMB_ACL_T aixacl_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
const char *path_p = smb_fname->base_name;
|
||||
struct acl *file_acl = (struct acl *)NULL;
|
||||
struct smb_acl_t *result = (struct smb_acl_t *)NULL;
|
||||
|
||||
|
@ -291,9 +291,9 @@ static SMB_ACL_T aixjfs2_get_posix_acl(const char *path, acl_type_t type, TALLOC
|
||||
}
|
||||
|
||||
SMB_ACL_T aixjfs2_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
acl_type_t aixjfs2_type;
|
||||
|
||||
@ -309,7 +309,8 @@ SMB_ACL_T aixjfs2_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
smb_panic("exiting");
|
||||
}
|
||||
|
||||
return aixjfs2_get_posix_acl(path_p, aixjfs2_type, mem_ctx);
|
||||
return aixjfs2_get_posix_acl(smb_fname->base_name,
|
||||
aixjfs2_type, mem_ctx);
|
||||
}
|
||||
|
||||
SMB_ACL_T aixjfs2_sys_acl_get_fd(vfs_handle_struct *handle,
|
||||
|
@ -545,16 +545,40 @@ static int cap_chmod_acl(vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
static SMB_ACL_T cap_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path, SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
char *cappath = capencode(talloc_tos(), path);
|
||||
struct smb_filename *cap_smb_fname = NULL;
|
||||
char *cappath = capencode(talloc_tos(), smb_fname->base_name);
|
||||
SMB_ACL_T ret;
|
||||
int saved_errno = 0;
|
||||
|
||||
if (!cappath) {
|
||||
errno = ENOMEM;
|
||||
return (SMB_ACL_T)NULL;
|
||||
}
|
||||
return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, cappath, type, mem_ctx);
|
||||
cap_smb_fname = synthetic_smb_fname(talloc_tos(),
|
||||
cappath,
|
||||
NULL,
|
||||
NULL,
|
||||
smb_fname->flags);
|
||||
if (cap_smb_fname == NULL) {
|
||||
TALLOC_FREE(cappath);
|
||||
errno = ENOMEM;
|
||||
return (SMB_ACL_T)NULL;
|
||||
}
|
||||
ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, cap_smb_fname,
|
||||
type, mem_ctx);
|
||||
if (ret == NULL) {
|
||||
saved_errno = errno;
|
||||
}
|
||||
TALLOC_FREE(cappath);
|
||||
TALLOC_FREE(cap_smb_fname);
|
||||
if (saved_errno != 0) {
|
||||
errno = saved_errno;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cap_sys_acl_set_file(vfs_handle_struct *handle, const char *path, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
|
||||
|
@ -1246,24 +1246,46 @@ catia_chmod_acl(vfs_handle_struct *handle,
|
||||
|
||||
static SMB_ACL_T
|
||||
catia_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
char *mapped_name = NULL;
|
||||
struct smb_filename *mapped_smb_fname = NULL;
|
||||
NTSTATUS status;
|
||||
SMB_ACL_T ret;
|
||||
int saved_errno = 0;
|
||||
|
||||
status = catia_string_replace_allocate(handle->conn,
|
||||
path, &mapped_name, vfs_translate_to_unix);
|
||||
smb_fname->base_name,
|
||||
&mapped_name,
|
||||
vfs_translate_to_unix);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
errno = map_errno_from_nt_status(status);
|
||||
return NULL;
|
||||
return (SMB_ACL_T)NULL;
|
||||
}
|
||||
|
||||
ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, mapped_name, type, mem_ctx);
|
||||
TALLOC_FREE(mapped_name);
|
||||
mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
|
||||
mapped_name,
|
||||
NULL,
|
||||
NULL,
|
||||
smb_fname->flags);
|
||||
if (mapped_smb_fname == NULL) {
|
||||
TALLOC_FREE(mapped_name);
|
||||
errno = ENOMEM;
|
||||
return (SMB_ACL_T)NULL;
|
||||
}
|
||||
|
||||
ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, mapped_smb_fname,
|
||||
type, mem_ctx);
|
||||
if (ret == (SMB_ACL_T)NULL) {
|
||||
saved_errno = errno;
|
||||
}
|
||||
TALLOC_FREE(mapped_smb_fname);
|
||||
TALLOC_FREE(mapped_name);
|
||||
if (saved_errno != 0) {
|
||||
errno = saved_errno;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2688,7 +2688,7 @@ static int vfswrap_chmod_acl(vfs_handle_struct *handle,
|
||||
int result;
|
||||
|
||||
START_PROFILE(chmod_acl);
|
||||
result = chmod_acl(handle->conn, smb_fname->base_name, mode);
|
||||
result = chmod_acl(handle->conn, smb_fname, mode);
|
||||
END_PROFILE(chmod_acl);
|
||||
return result;
|
||||
#endif
|
||||
@ -2710,11 +2710,11 @@ static int vfswrap_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode
|
||||
}
|
||||
|
||||
static SMB_ACL_T vfswrap_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
return sys_acl_get_file(handle, path_p, type, mem_ctx);
|
||||
return sys_acl_get_file(handle, smb_fname, type, mem_ctx);
|
||||
}
|
||||
|
||||
static SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct *handle,
|
||||
|
@ -242,14 +242,15 @@ static DATA_BLOB fake_acls_acl2blob(TALLOC_CTX *mem_ctx, SMB_ACL_T acl)
|
||||
}
|
||||
|
||||
static SMB_ACL_T fake_acls_sys_acl_get_file(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
DATA_BLOB blob = data_blob_null;
|
||||
ssize_t length;
|
||||
const char *name = NULL;
|
||||
struct smb_acl_t *acl = NULL;
|
||||
const char *path = smb_fname->base_name;
|
||||
TALLOC_CTX *frame = talloc_stackframe();
|
||||
switch (type) {
|
||||
case SMB_ACL_TYPE_ACCESS:
|
||||
|
@ -2152,16 +2152,17 @@ static int smb_full_audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fs
|
||||
}
|
||||
|
||||
static SMB_ACL_T smb_full_audit_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
SMB_ACL_T result;
|
||||
|
||||
result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
|
||||
result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname,
|
||||
type, mem_ctx);
|
||||
|
||||
do_log(SMB_VFS_OP_SYS_ACL_GET_FILE, (result != NULL), handle,
|
||||
"%s", path_p);
|
||||
"%s", smb_fname->base_name);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -961,7 +961,7 @@ static SMB_ACL_T gpfsacl_get_posix_acl(const char *path, gpfs_aclType_t type,
|
||||
}
|
||||
|
||||
static SMB_ACL_T gpfsacl_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
@ -973,7 +973,7 @@ static SMB_ACL_T gpfsacl_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
return NULL);
|
||||
|
||||
if (!config->acl) {
|
||||
return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p,
|
||||
return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname,
|
||||
type, mem_ctx);
|
||||
}
|
||||
|
||||
@ -989,7 +989,7 @@ static SMB_ACL_T gpfsacl_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
smb_panic("exiting");
|
||||
}
|
||||
|
||||
return gpfsacl_get_posix_acl(path_p, gpfs_type, mem_ctx);
|
||||
return gpfsacl_get_posix_acl(smb_fname->base_name, gpfs_type, mem_ctx);
|
||||
}
|
||||
|
||||
static SMB_ACL_T gpfsacl_sys_acl_get_fd(vfs_handle_struct *handle,
|
||||
|
@ -139,13 +139,14 @@ static bool hpux_aclsort_call_present(void);
|
||||
/* public functions - the api */
|
||||
|
||||
SMB_ACL_T hpuxacl_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
SMB_ACL_T result = NULL;
|
||||
int count;
|
||||
HPUX_ACL_T hpux_acl = NULL;
|
||||
const char *path_p = smb_fname->base_name;
|
||||
|
||||
DEBUG(10, ("hpuxacl_sys_acl_get_file called for file '%s'.\n",
|
||||
path_p));
|
||||
|
@ -34,7 +34,7 @@
|
||||
#define __VFS_HPUXACL_H__
|
||||
|
||||
SMB_ACL_T hpuxacl_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type);
|
||||
|
||||
SMB_ACL_T hpuxacl_sys_acl_get_fd(vfs_handle_struct *handle,
|
||||
|
@ -2101,35 +2101,33 @@ out:
|
||||
* Failure: set errno, return NULL
|
||||
*/
|
||||
static SMB_ACL_T mh_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
SMB_ACL_T ret;
|
||||
char *clientPath;
|
||||
TALLOC_CTX *ctx;
|
||||
int status;
|
||||
struct smb_filename *clientFname = NULL;
|
||||
|
||||
DEBUG(MH_INFO_DEBUG, ("Entering mh_sys_acl_get_file\n"));
|
||||
if (!is_in_media_files(path_p))
|
||||
{
|
||||
ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
|
||||
if (!is_in_media_files(smb_fname->base_name)) {
|
||||
ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname,
|
||||
type, mem_ctx);
|
||||
goto out;
|
||||
}
|
||||
|
||||
clientPath = NULL;
|
||||
ctx = talloc_tos();
|
||||
|
||||
if (alloc_get_client_path(handle, ctx,
|
||||
path_p,
|
||||
&clientPath))
|
||||
{
|
||||
ret = NULL;
|
||||
status = alloc_get_client_smb_fname(handle,
|
||||
talloc_tos(),
|
||||
smb_fname,
|
||||
&clientFname);
|
||||
if (status != 0) {
|
||||
ret = (SMB_ACL_T)NULL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, clientPath, type, mem_ctx);
|
||||
ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, clientFname, type, mem_ctx);
|
||||
err:
|
||||
TALLOC_FREE(clientPath);
|
||||
TALLOC_FREE(clientFname);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
@ -585,9 +585,9 @@ static NTSTATUS nfs4acl_xattr_fset_nt_acl(vfs_handle_struct *handle,
|
||||
*/
|
||||
|
||||
static SMB_ACL_T nfs4acl_xattr_fail__sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
return (SMB_ACL_T)NULL;
|
||||
}
|
||||
|
@ -34,9 +34,9 @@ static acl_t smb_acl_to_posix(const struct smb_acl_t *acl);
|
||||
/* public functions - the api */
|
||||
|
||||
SMB_ACL_T posixacl_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
struct smb_acl_t *result;
|
||||
acl_type_t acl_type;
|
||||
@ -54,7 +54,7 @@ SMB_ACL_T posixacl_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
acl = acl_get_file(path_p, acl_type);
|
||||
acl = acl_get_file(smb_fname->base_name, acl_type);
|
||||
|
||||
if (acl == NULL) {
|
||||
return NULL;
|
||||
|
@ -22,7 +22,7 @@
|
||||
#define __VFS_POSIXACL_H__
|
||||
|
||||
SMB_ACL_T posixacl_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx);
|
||||
|
||||
|
@ -63,12 +63,14 @@ static bool solaris_acl_check(SOLARIS_ACL_T solaris_acl, int count);
|
||||
/* public functions - the api */
|
||||
|
||||
SMB_ACL_T solarisacl_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
SMB_ACL_TYPE_T type, TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
SMB_ACL_T result = NULL;
|
||||
int count;
|
||||
SOLARIS_ACL_T solaris_acl = NULL;
|
||||
const char *path_p = smb_fname->base_name;
|
||||
|
||||
DEBUG(10, ("solarisacl_sys_acl_get_file called for file '%s'.\n",
|
||||
path_p));
|
||||
|
@ -21,9 +21,9 @@
|
||||
#define __VFS_SOLARISACL_H__
|
||||
|
||||
SMB_ACL_T solarisacl_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx);
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx);
|
||||
|
||||
SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle,
|
||||
files_struct *fsp,
|
||||
|
@ -2169,21 +2169,23 @@ static int smb_time_audit_fchmod_acl(vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
static SMB_ACL_T smb_time_audit_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
SMB_ACL_T result;
|
||||
struct timespec ts1,ts2;
|
||||
double timediff;
|
||||
|
||||
clock_gettime_mono(&ts1);
|
||||
result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
|
||||
result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname,
|
||||
type, mem_ctx);
|
||||
clock_gettime_mono(&ts2);
|
||||
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
|
||||
|
||||
if (timediff > audit_timeout) {
|
||||
smb_time_audit_log_fname("sys_acl_get_file", timediff, path_p);
|
||||
smb_time_audit_log_fname("sys_acl_get_file", timediff,
|
||||
smb_fname->base_name);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -38,9 +38,9 @@ static SMB_ACL_PERM_T tru64_permset_to_smb(const acl_perm_t tru64_permset);
|
||||
/* public functions - the api */
|
||||
|
||||
SMB_ACL_T tru64acl_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
struct smb_acl_t *result;
|
||||
acl_type_t the_acl_type;
|
||||
@ -60,7 +60,7 @@ SMB_ACL_T tru64acl_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tru64_acl = acl_get_file((char *)path_p, the_acl_type);
|
||||
tru64_acl = acl_get_file((char *)smb_fname->base_name, the_acl_type);
|
||||
|
||||
if (tru64_acl == NULL) {
|
||||
return NULL;
|
||||
|
@ -21,8 +21,8 @@
|
||||
#define __VFS_TRU64ACL_H__
|
||||
|
||||
SMB_ACL_T tru64acl_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
SMB_ACL_TYPE_T type);
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type);
|
||||
|
||||
SMB_ACL_T tru64acl_sys_acl_get_fd(vfs_handle_struct *handle,
|
||||
files_struct *fsp);
|
||||
|
@ -1609,32 +1609,42 @@ err:
|
||||
}
|
||||
|
||||
static SMB_ACL_T um_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
SMB_ACL_T ret;
|
||||
char *client_path = NULL;
|
||||
int saved_errno = 0;
|
||||
struct smb_filename *client_fname = NULL;
|
||||
int status;
|
||||
|
||||
DEBUG(10, ("Entering um_sys_acl_get_file\n"));
|
||||
|
||||
if (!is_in_media_files(path_p)) {
|
||||
return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p,
|
||||
if (!is_in_media_files(smb_fname->base_name)) {
|
||||
return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname,
|
||||
type, mem_ctx);
|
||||
}
|
||||
|
||||
status = alloc_get_client_path(handle, talloc_tos(),
|
||||
path_p, &client_path);
|
||||
status = alloc_get_client_smb_fname(handle,
|
||||
talloc_tos(),
|
||||
smb_fname,
|
||||
&client_fname);
|
||||
if (status != 0) {
|
||||
ret = NULL;
|
||||
ret = (SMB_ACL_T)NULL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, client_path, type, mem_ctx);
|
||||
ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, client_fname,
|
||||
type, mem_ctx);
|
||||
|
||||
err:
|
||||
TALLOC_FREE(client_path);
|
||||
if (ret == (SMB_ACL_T)NULL) {
|
||||
saved_errno = errno;
|
||||
}
|
||||
TALLOC_FREE(client_fname);
|
||||
if (saved_errno != 0) {
|
||||
errno = saved_errno;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,14 @@ static bool vxfs_compare(connection_struct *conn, char *name, SMB_ACL_T the_acl,
|
||||
int status;
|
||||
|
||||
DEBUG(10, ("vfs_vxfs: Getting existing ACL for %s\n", name));
|
||||
existing_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, name, the_acl_type,
|
||||
|
||||
smb_fname = synthetic_smb_fname(mem_ctx, name, NULL, NULL, 0);
|
||||
if (smb_fname == NULL) {
|
||||
DEBUG(10, ("vfs_vxfs: Failed to create smb_fname\n"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
existing_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname, the_acl_type,
|
||||
mem_ctx);
|
||||
if (existing_acl == NULL) {
|
||||
DEBUG(10, ("vfs_vxfs: Failed to get ACL\n"));
|
||||
@ -423,12 +430,6 @@ static bool vxfs_compare(connection_struct *conn, char *name, SMB_ACL_T the_acl,
|
||||
goto out;
|
||||
}
|
||||
|
||||
smb_fname = synthetic_smb_fname(mem_ctx, name, NULL, NULL, 0);
|
||||
if (smb_fname == NULL) {
|
||||
DEBUG(10, ("vfs_vxfs: Failed to create smb_fname\n"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
status = SMB_VFS_STAT(conn, smb_fname);
|
||||
if (status == -1) {
|
||||
DEBUG(10, ("vfs_vxfs: stat failed!\n"));
|
||||
|
@ -284,9 +284,9 @@ static NTSTATUS zfsacl_fset_nt_acl(vfs_handle_struct *handle,
|
||||
*/
|
||||
|
||||
static SMB_ACL_T zfsacl_fail__sys_acl_get_file(vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
return (SMB_ACL_T)NULL;
|
||||
}
|
||||
|
@ -679,8 +679,8 @@ int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
|
||||
|
||||
unixmode = smb_fname->st.st_ex_mode;
|
||||
|
||||
get_acl_group_bits(conn, smb_fname->base_name,
|
||||
&smb_fname->st.st_ex_mode);
|
||||
get_acl_group_bits(conn, smb_fname,
|
||||
&smb_fname->st.st_ex_mode);
|
||||
|
||||
if (S_ISDIR(smb_fname->st.st_ex_mode))
|
||||
dosmode |= FILE_ATTRIBUTE_DIRECTORY;
|
||||
|
@ -1224,7 +1224,7 @@ static NTSTATUS open_file(files_struct *fsp,
|
||||
/* Inherit the ACL if required */
|
||||
if (lp_inherit_permissions(SNUM(conn))) {
|
||||
inherit_access_posix_acl(conn, parent_dir,
|
||||
smb_fname->base_name,
|
||||
smb_fname,
|
||||
unx_mode);
|
||||
need_re_stat = true;
|
||||
}
|
||||
@ -3832,7 +3832,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
|
||||
|
||||
if (lp_inherit_permissions(SNUM(conn))) {
|
||||
inherit_access_posix_acl(conn, parent_dir,
|
||||
smb_dname->base_name, mode);
|
||||
smb_dname, mode);
|
||||
need_re_stat = true;
|
||||
}
|
||||
|
||||
|
@ -3583,12 +3583,12 @@ NTSTATUS posix_get_nt_acl(struct connection_struct *conn,
|
||||
}
|
||||
|
||||
/* Get the ACL from the path. */
|
||||
posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname->base_name,
|
||||
posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname,
|
||||
SMB_ACL_TYPE_ACCESS, frame);
|
||||
|
||||
/* If it's a directory get the default POSIX ACL. */
|
||||
if(S_ISDIR(smb_fname->st.st_ex_mode)) {
|
||||
def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname->base_name,
|
||||
def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname,
|
||||
SMB_ACL_TYPE_DEFAULT, frame);
|
||||
def_acl = free_empty_sys_acl(conn, def_acl);
|
||||
}
|
||||
@ -4044,14 +4044,16 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32_t security_info_sent, const struct
|
||||
the mask bits, not the real group bits, for a file with an ACL.
|
||||
****************************************************************************/
|
||||
|
||||
int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode )
|
||||
int get_acl_group_bits( connection_struct *conn,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t *mode )
|
||||
{
|
||||
int entry_id = SMB_ACL_FIRST_ENTRY;
|
||||
SMB_ACL_ENTRY_T entry;
|
||||
SMB_ACL_T posix_acl;
|
||||
int result = -1;
|
||||
|
||||
posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, fname,
|
||||
posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname,
|
||||
SMB_ACL_TYPE_ACCESS, talloc_tos());
|
||||
if (posix_acl == (SMB_ACL_T)NULL)
|
||||
return -1;
|
||||
@ -4155,12 +4157,15 @@ static int chmod_acl_internals( connection_struct *conn, SMB_ACL_T posix_acl, mo
|
||||
resulting ACL on TO. Note that name is in UNIX character set.
|
||||
****************************************************************************/
|
||||
|
||||
static int copy_access_posix_acl(connection_struct *conn, const char *from, const char *to, mode_t mode)
|
||||
static int copy_access_posix_acl(connection_struct *conn,
|
||||
const struct smb_filename *smb_fname_from,
|
||||
const struct smb_filename *smb_fname_to,
|
||||
mode_t mode)
|
||||
{
|
||||
SMB_ACL_T posix_acl = NULL;
|
||||
int ret = -1;
|
||||
|
||||
if ((posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, from,
|
||||
if ((posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname_from,
|
||||
SMB_ACL_TYPE_ACCESS,
|
||||
talloc_tos())) == NULL)
|
||||
return -1;
|
||||
@ -4168,7 +4173,8 @@ static int copy_access_posix_acl(connection_struct *conn, const char *from, cons
|
||||
if ((ret = chmod_acl_internals(conn, posix_acl, mode)) == -1)
|
||||
goto done;
|
||||
|
||||
ret = SMB_VFS_SYS_ACL_SET_FILE(conn, to, SMB_ACL_TYPE_ACCESS, posix_acl);
|
||||
ret = SMB_VFS_SYS_ACL_SET_FILE(conn, smb_fname_to->base_name,
|
||||
SMB_ACL_TYPE_ACCESS, posix_acl);
|
||||
|
||||
done:
|
||||
|
||||
@ -4182,18 +4188,21 @@ static int copy_access_posix_acl(connection_struct *conn, const char *from, cons
|
||||
Note that name is in UNIX character set.
|
||||
****************************************************************************/
|
||||
|
||||
int chmod_acl(connection_struct *conn, const char *name, mode_t mode)
|
||||
int chmod_acl(connection_struct *conn,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode)
|
||||
{
|
||||
return copy_access_posix_acl(conn, name, name, mode);
|
||||
return copy_access_posix_acl(conn, smb_fname, smb_fname, mode);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Check for an existing default POSIX ACL on a directory.
|
||||
****************************************************************************/
|
||||
|
||||
static bool directory_has_default_posix_acl(connection_struct *conn, const char *fname)
|
||||
static bool directory_has_default_posix_acl(connection_struct *conn,
|
||||
const struct smb_filename *smb_fname)
|
||||
{
|
||||
SMB_ACL_T def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, fname,
|
||||
SMB_ACL_T def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname,
|
||||
SMB_ACL_TYPE_DEFAULT,
|
||||
talloc_tos());
|
||||
bool has_acl = False;
|
||||
@ -4214,13 +4223,25 @@ static bool directory_has_default_posix_acl(connection_struct *conn, const char
|
||||
inherit this Access ACL to file name.
|
||||
****************************************************************************/
|
||||
|
||||
int inherit_access_posix_acl(connection_struct *conn, const char *inherit_from_dir,
|
||||
const char *name, mode_t mode)
|
||||
int inherit_access_posix_acl(connection_struct *conn,
|
||||
const char *inherit_from_dir,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode)
|
||||
{
|
||||
if (directory_has_default_posix_acl(conn, inherit_from_dir))
|
||||
struct smb_filename *inherit_from_fname =
|
||||
synthetic_smb_fname(talloc_tos(),
|
||||
smb_fname->base_name,
|
||||
NULL,
|
||||
NULL,
|
||||
smb_fname->flags);
|
||||
if (inherit_from_fname == NULL) {
|
||||
return-1;
|
||||
}
|
||||
|
||||
if (directory_has_default_posix_acl(conn, inherit_from_fname))
|
||||
return 0;
|
||||
|
||||
return copy_access_posix_acl(conn, inherit_from_dir, name, mode);
|
||||
return copy_access_posix_acl(conn, inherit_from_fname, smb_fname, mode);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -4467,12 +4488,15 @@ bool set_unix_posix_default_acl(connection_struct *conn,
|
||||
FIXME ! How does the share mask/mode fit into this.... ?
|
||||
****************************************************************************/
|
||||
|
||||
static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname)
|
||||
static bool remove_posix_acl(connection_struct *conn,
|
||||
files_struct *fsp,
|
||||
const struct smb_filename *smb_fname)
|
||||
{
|
||||
SMB_ACL_T file_acl = NULL;
|
||||
int entry_id = SMB_ACL_FIRST_ENTRY;
|
||||
SMB_ACL_ENTRY_T entry;
|
||||
bool ret = False;
|
||||
const char *fname = smb_fname->base_name;
|
||||
/* Create a new ACL with only 3 entries, u/g/w. */
|
||||
SMB_ACL_T new_file_acl = sys_acl_init(talloc_tos());
|
||||
SMB_ACL_ENTRY_T user_ent = NULL;
|
||||
@ -4522,7 +4546,7 @@ static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const c
|
||||
if (fsp && fsp->fh->fd != -1) {
|
||||
file_acl = SMB_VFS_SYS_ACL_GET_FD(fsp, talloc_tos());
|
||||
} else {
|
||||
file_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, fname,
|
||||
file_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname,
|
||||
SMB_ACL_TYPE_ACCESS,
|
||||
talloc_tos());
|
||||
}
|
||||
@ -4605,13 +4629,17 @@ static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const c
|
||||
except SMB_ACL_USER_OBJ, SMB_ACL_GROUP_OBJ, SMB_ACL_OTHER.
|
||||
****************************************************************************/
|
||||
|
||||
bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname, uint16_t num_acls, const char *pdata)
|
||||
bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
uint16_t num_acls,
|
||||
const char *pdata)
|
||||
{
|
||||
SMB_ACL_T file_acl = NULL;
|
||||
const char *fname = smb_fname->base_name;
|
||||
|
||||
if (!num_acls) {
|
||||
/* Remove the ACL from the file. */
|
||||
return remove_posix_acl(conn, fsp, fname);
|
||||
return remove_posix_acl(conn, fsp, smb_fname);
|
||||
}
|
||||
|
||||
if ((file_acl = create_posix_acl_from_wire(conn, num_acls,
|
||||
@ -4728,7 +4756,7 @@ int posix_sys_acl_blob_get_file(vfs_handle_struct *handle,
|
||||
|
||||
acl_wrapper.access_acl
|
||||
= smb_vfs_call_sys_acl_get_file(handle,
|
||||
path_p,
|
||||
smb_fname,
|
||||
SMB_ACL_TYPE_ACCESS,
|
||||
frame);
|
||||
|
||||
@ -4741,7 +4769,7 @@ int posix_sys_acl_blob_get_file(vfs_handle_struct *handle,
|
||||
if (S_ISDIR(smb_fname->st.st_ex_mode)) {
|
||||
acl_wrapper.default_acl
|
||||
= smb_vfs_call_sys_acl_get_file(handle,
|
||||
path_p,
|
||||
smb_fname,
|
||||
SMB_ACL_TYPE_DEFAULT,
|
||||
frame);
|
||||
}
|
||||
@ -4789,8 +4817,10 @@ int posix_sys_acl_blob_get_fd(vfs_handle_struct *handle,
|
||||
|
||||
acl_wrapper.default_acl = NULL;
|
||||
|
||||
acl_wrapper.access_acl = smb_vfs_call_sys_acl_get_file(handle, fsp->fsp_name->base_name,
|
||||
SMB_ACL_TYPE_ACCESS, frame);
|
||||
acl_wrapper.access_acl = smb_vfs_call_sys_acl_get_file(handle,
|
||||
fsp->fsp_name,
|
||||
SMB_ACL_TYPE_ACCESS,
|
||||
frame);
|
||||
|
||||
ret = smb_vfs_call_fstat(handle, fsp, &sbuf);
|
||||
if (ret == -1) {
|
||||
|
@ -778,15 +778,24 @@ NTSTATUS posix_get_nt_acl(struct connection_struct *conn,
|
||||
struct security_descriptor **ppdesc);
|
||||
NTSTATUS try_chown(files_struct *fsp, uid_t uid, gid_t gid);
|
||||
NTSTATUS set_nt_acl(files_struct *fsp, uint32_t security_info_sent, const struct security_descriptor *psd);
|
||||
int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode );
|
||||
int chmod_acl(connection_struct *conn, const char *name, mode_t mode);
|
||||
int inherit_access_posix_acl(connection_struct *conn, const char *inherit_from_dir,
|
||||
const char *name, mode_t mode);
|
||||
int get_acl_group_bits( connection_struct *conn,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t *mode);
|
||||
int chmod_acl(connection_struct *conn,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode);
|
||||
int inherit_access_posix_acl(connection_struct *conn,
|
||||
const char *inherit_from_dir,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode);
|
||||
int fchmod_acl(files_struct *fsp, mode_t mode);
|
||||
bool set_unix_posix_default_acl(connection_struct *conn,
|
||||
const struct smb_filename *smb_fname,
|
||||
uint16_t num_def_acls, const char *pdata);
|
||||
bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname, uint16_t num_acls, const char *pdata);
|
||||
bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
uint16_t num_acls,
|
||||
const char *pdata);
|
||||
NTSTATUS get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname,
|
||||
uint32_t security_info_wanted,
|
||||
struct security_descriptor **sd);
|
||||
|
@ -622,6 +622,8 @@ static PyObject *py_smbd_get_sys_acl(PyObject *self, PyObject *args, PyObject *k
|
||||
TALLOC_CTX *tmp_ctx = talloc_new(NULL);
|
||||
connection_struct *conn;
|
||||
char *service = NULL;
|
||||
struct smb_filename *smb_fname = NULL;
|
||||
|
||||
if (!tmp_ctx) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
@ -642,7 +644,15 @@ static PyObject *py_smbd_get_sys_acl(PyObject *self, PyObject *args, PyObject *k
|
||||
return NULL;
|
||||
}
|
||||
|
||||
acl = SMB_VFS_SYS_ACL_GET_FILE( conn, fname, acl_type, tmp_ctx);
|
||||
smb_fname = synthetic_smb_fname_split(frame,
|
||||
fname,
|
||||
lp_posix_pathnames());
|
||||
if (smb_fname == NULL) {
|
||||
TALLOC_FREE(frame);
|
||||
TALLOC_FREE(tmp_ctx);
|
||||
return NULL;
|
||||
}
|
||||
acl = SMB_VFS_SYS_ACL_GET_FILE( conn, smb_fname, acl_type, tmp_ctx);
|
||||
if (!acl) {
|
||||
TALLOC_FREE(frame);
|
||||
TALLOC_FREE(tmp_ctx);
|
||||
|
@ -5519,7 +5519,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
|
||||
} else {
|
||||
file_acl =
|
||||
SMB_VFS_SYS_ACL_GET_FILE(conn,
|
||||
smb_fname->base_name,
|
||||
smb_fname,
|
||||
SMB_ACL_TYPE_ACCESS,
|
||||
talloc_tos());
|
||||
}
|
||||
@ -5537,14 +5537,14 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
|
||||
def_acl =
|
||||
SMB_VFS_SYS_ACL_GET_FILE(
|
||||
conn,
|
||||
fsp->fsp_name->base_name,
|
||||
fsp->fsp_name,
|
||||
SMB_ACL_TYPE_DEFAULT,
|
||||
talloc_tos());
|
||||
} else {
|
||||
def_acl =
|
||||
SMB_VFS_SYS_ACL_GET_FILE(
|
||||
conn,
|
||||
smb_fname->base_name,
|
||||
smb_fname,
|
||||
SMB_ACL_TYPE_DEFAULT,
|
||||
talloc_tos());
|
||||
}
|
||||
@ -7151,7 +7151,7 @@ static NTSTATUS smb_set_posix_acl(connection_struct *conn,
|
||||
(unsigned int)num_def_acls));
|
||||
|
||||
if (valid_file_acls && !set_unix_posix_acl(conn, fsp,
|
||||
smb_fname->base_name, num_file_acls,
|
||||
smb_fname, num_file_acls,
|
||||
pdata + SMB_POSIX_ACL_HEADER_SIZE)) {
|
||||
return map_nt_error_from_unix(errno);
|
||||
}
|
||||
@ -7590,7 +7590,7 @@ static NTSTATUS smb_unix_mknod(connection_struct *conn,
|
||||
&parent, NULL)) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
inherit_access_posix_acl(conn, parent, smb_fname->base_name,
|
||||
inherit_access_posix_acl(conn, parent, smb_fname,
|
||||
unixmode);
|
||||
TALLOC_FREE(parent);
|
||||
}
|
||||
|
@ -2441,12 +2441,12 @@ int smb_vfs_call_fchmod_acl(struct vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
SMB_ACL_T smb_vfs_call_sys_acl_get_file(struct vfs_handle_struct *handle,
|
||||
const char *path_p,
|
||||
const struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
VFS_FIND(sys_acl_get_file);
|
||||
return handle->fns->sys_acl_get_file_fn(handle, path_p, type, mem_ctx);
|
||||
return handle->fns->sys_acl_get_file_fn(handle, smb_fname, type, mem_ctx);
|
||||
}
|
||||
|
||||
SMB_ACL_T smb_vfs_call_sys_acl_get_fd(struct vfs_handle_struct *handle,
|
||||
|
@ -1683,13 +1683,22 @@ static NTSTATUS cmd_sys_acl_get_file(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
|
||||
SMB_ACL_T acl;
|
||||
char *acl_text;
|
||||
int type;
|
||||
struct smb_filename *smb_fname = NULL;
|
||||
|
||||
if (argc != 3) {
|
||||
printf("Usage: sys_acl_get_file <path> <type>\n");
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
smb_fname = synthetic_smb_fname_split(talloc_tos(),
|
||||
argv[1],
|
||||
lp_posix_pathnames());
|
||||
if (smb_fname == NULL) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
type = atoi(argv[2]);
|
||||
acl = SMB_VFS_SYS_ACL_GET_FILE(vfs->conn, argv[1], type, talloc_tos());
|
||||
acl = SMB_VFS_SYS_ACL_GET_FILE(vfs->conn, smb_fname,
|
||||
type, talloc_tos());
|
||||
if (!acl) {
|
||||
printf("sys_acl_get_file failed (%s)\n", strerror(errno));
|
||||
return NT_STATUS_UNSUCCESSFUL;
|
||||
|
Loading…
Reference in New Issue
Block a user