1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-24 21:49:29 +03:00

vfs: add acl type arg to SMB_VFS_SYS_ACL_SET_FD()

No change in behaviour, the new arg is not yet used in any module.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme
2020-12-14 16:28:26 +01:00
committed by Jeremy Allison
parent ebf37cfc3c
commit 8d0ea8bafa
28 changed files with 80 additions and 32 deletions

View File

@ -848,7 +848,9 @@ static int skel_sys_acl_set_file(vfs_handle_struct *handle,
return -1;
}
static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
static int skel_sys_acl_set_fd(vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
errno = ENOSYS;

View File

@ -1112,10 +1112,12 @@ static int skel_sys_acl_set_file(vfs_handle_struct *handle,
acltype, theacl);
}
static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
static int skel_sys_acl_set_fd(vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl);
}
static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,

View File

@ -340,6 +340,7 @@
* Version 44 - Add dirfsp arg to SMB_VFS_READDIR()
* Version 44 - Remove SMB_VFS_GET_DOS_ATTRIBUTES()
* Version 44 - Replace SMB_VFS_GET_COMPRESSION() with SMB_VFS_FGET_COMPRESSION()
* Version 44 - Add type argument to SMB_VFS_SYS_ACL_SET_FD()
*/
#define SMB_VFS_INTERFACE_VERSION 44
@ -1219,7 +1220,10 @@ struct vfs_fn_pointers {
const struct smb_filename *smb_fname,
SMB_ACL_TYPE_T acltype,
SMB_ACL_T theacl);
int (*sys_acl_set_fd_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_ACL_T theacl);
int (*sys_acl_set_fd_fn)(struct vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl);
int (*sys_acl_delete_def_file_fn)(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname);
@ -1746,7 +1750,9 @@ int smb_vfs_call_sys_acl_set_file(struct vfs_handle_struct *handle,
SMB_ACL_TYPE_T acltype,
SMB_ACL_T theacl);
int smb_vfs_call_sys_acl_set_fd(struct vfs_handle_struct *handle,
struct files_struct *fsp, SMB_ACL_T theacl);
struct files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl);
int smb_vfs_call_sys_acl_delete_def_file(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname);
ssize_t smb_vfs_call_getxattr(struct vfs_handle_struct *handle,
@ -2164,7 +2170,9 @@ int vfs_not_implemented_sys_acl_set_file(vfs_handle_struct *handle,
const struct smb_filename *smb_fname,
SMB_ACL_TYPE_T acltype,
SMB_ACL_T theacl);
int vfs_not_implemented_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
int vfs_not_implemented_sys_acl_set_fd(vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl);
int vfs_not_implemented_sys_acl_delete_def_file(vfs_handle_struct *handle,
const struct smb_filename *smb_fname);

View File

@ -513,10 +513,10 @@
#define SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, acltype, theacl) \
smb_vfs_call_sys_acl_set_file((handle)->next, (smb_fname), (acltype), (theacl))
#define SMB_VFS_SYS_ACL_SET_FD(fsp, theacl) \
smb_vfs_call_sys_acl_set_fd((fsp)->conn->vfs_handles, (fsp), (theacl))
#define SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl) \
smb_vfs_call_sys_acl_set_fd((handle)->next, (fsp), (theacl))
#define SMB_VFS_SYS_ACL_SET_FD(fsp, type, theacl) \
smb_vfs_call_sys_acl_set_fd((fsp)->conn->vfs_handles, (fsp), (type), (theacl))
#define SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl) \
smb_vfs_call_sys_acl_set_fd((handle)->next, (fsp), (type), (theacl))
#define SMB_VFS_SYS_ACL_DELETE_DEF_FILE(conn, smb_fname) \
smb_vfs_call_sys_acl_delete_def_file((conn)->vfs_handles, (smb_fname))

View File

@ -387,7 +387,7 @@ int sys_acl_set_file(vfs_handle_struct *handle,
int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
SMB_ACL_T acl_d)
{
return posixacl_sys_acl_set_fd(handle, fsp, acl_d);
return posixacl_sys_acl_set_fd(handle, fsp, SMB_ACL_TYPE_ACCESS, acl_d);
}
int sys_acl_delete_def_file(vfs_handle_struct *handle,

View File

@ -479,7 +479,9 @@ int posixacl_xattr_acl_set_file(vfs_handle_struct *handle,
}
int posixacl_xattr_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp, SMB_ACL_T theacl)
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
char *buf;
ssize_t size;

View File

@ -37,6 +37,7 @@ int posixacl_xattr_acl_set_file(vfs_handle_struct *handle,
int posixacl_xattr_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl);
int posixacl_xattr_acl_delete_def_file(vfs_handle_struct *handle,

View File

@ -416,6 +416,7 @@ fail:
static int sys_acl_set_fd_tdb(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
struct db_context *db = acl_db;
@ -428,8 +429,9 @@ static int sys_acl_set_fd_tdb(vfs_handle_struct *handle,
}
ret = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle,
fsp,
theacl);
fsp,
type,
theacl);
if (ret == -1) {
return -1;
}

View File

@ -250,10 +250,12 @@ static int sys_acl_set_file_xattr(vfs_handle_struct *handle,
static int sys_acl_set_fd_xattr(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
int ret = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle,
fsp,
type,
theacl);
if (ret == -1) {
return -1;

View File

@ -156,6 +156,7 @@ int aixacl_sys_acl_set_file(vfs_handle_struct *handle,
int aixacl_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
struct acl *file_acl = NULL;

View File

@ -513,6 +513,7 @@ int aixjfs2_sys_acl_set_file(vfs_handle_struct *handle,
int aixjfs2_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
struct acl *acl_aixc;

View File

@ -1673,6 +1673,7 @@ static int catia_sys_acl_blob_get_fd(vfs_handle_struct *handle,
static int catia_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
struct catia_cache *cc = NULL;
@ -1683,7 +1684,7 @@ static int catia_sys_acl_set_fd(vfs_handle_struct *handle,
return ret;
}
ret = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
ret = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl);
CATIA_FETCH_FSP_POST_NEXT(&cc, fsp);

View File

@ -3231,7 +3231,10 @@ static int vfswrap_sys_acl_set_file(vfs_handle_struct *handle,
return sys_acl_set_file(handle, smb_fname, acltype, theacl);
}
static int vfswrap_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl)
static int vfswrap_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
return sys_acl_set_fd(handle, fsp, theacl);
}

View File

@ -351,7 +351,10 @@ static int fake_acls_sys_acl_set_file(vfs_handle_struct *handle,
return ret;
}
static int fake_acls_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl)
static int fake_acls_sys_acl_set_fd(vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
int ret;
const char *name = FAKE_ACL_ACCESS_XATTR;
@ -703,6 +706,7 @@ static int fake_acls_fchmod(vfs_handle_struct *handle,
}
ret = fake_acls_sys_acl_set_fd(handle,
fsp,
SMB_ACL_TYPE_ACCESS,
the_acl);
TALLOC_FREE(frame);
return ret;

View File

@ -2576,12 +2576,14 @@ static int smb_full_audit_sys_acl_set_file(vfs_handle_struct *handle,
return result;
}
static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
SMB_ACL_T theacl)
static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
int result;
result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl);
do_log(SMB_VFS_OP_SYS_ACL_SET_FD, (result >= 0), handle,
"%s", fsp_str_do_log(fsp));

View File

@ -1343,6 +1343,7 @@ static int gpfsacl_sys_acl_set_file(vfs_handle_struct *handle,
static int gpfsacl_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
struct gpfs_config_data *config;
@ -1352,7 +1353,7 @@ static int gpfsacl_sys_acl_set_fd(vfs_handle_struct *handle,
return -1);
if (!config->acl) {
return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl);
}
return gpfsacl_sys_acl_set_file(handle, fsp->fsp_name,

View File

@ -630,6 +630,7 @@ static int nfs4acl_xattr_fail__sys_acl_set_file(vfs_handle_struct *handle,
static int nfs4acl_xattr_fail__sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
return -1;

View File

@ -852,7 +852,9 @@ int vfs_not_implemented_sys_acl_set_file(vfs_handle_struct *handle,
return -1;
}
int vfs_not_implemented_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
int vfs_not_implemented_sys_acl_set_fd(vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
errno = ENOSYS;

View File

@ -137,6 +137,7 @@ int posixacl_sys_acl_set_file(vfs_handle_struct *handle,
int posixacl_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
int res;

View File

@ -37,6 +37,7 @@ int posixacl_sys_acl_set_file(vfs_handle_struct *handle,
int posixacl_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl);
int posixacl_sys_acl_delete_def_file(vfs_handle_struct *handle,

View File

@ -237,6 +237,7 @@ int solarisacl_sys_acl_set_file(vfs_handle_struct *handle,
*/
int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
SOLARIS_ACL_T solaris_acl = NULL;

View File

@ -1409,13 +1409,14 @@ static SMB_ACL_T streams_xattr_sys_acl_get_fd(vfs_handle_struct *handle,
static int streams_xattr_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
struct stream_io *sio =
(struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
if (sio == NULL) {
return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl);
}
return 0;

View File

@ -2409,6 +2409,7 @@ static int smb_time_audit_sys_acl_set_file(vfs_handle_struct *handle,
static int smb_time_audit_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
int result;
@ -2416,7 +2417,7 @@ static int smb_time_audit_sys_acl_set_fd(vfs_handle_struct *handle,
double timediff;
clock_gettime_mono(&ts1);
result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;

View File

@ -135,6 +135,7 @@ fail:
int tru64acl_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
int res;

View File

@ -485,7 +485,9 @@ out:
return ret;
}
static int vxfs_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
static int vxfs_sys_acl_set_fd(vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
@ -494,7 +496,7 @@ static int vxfs_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
return 0;
}
return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl);
}
static int vxfs_sys_acl_set_file(vfs_handle_struct *handle,

View File

@ -545,6 +545,7 @@ static int zfsacl_fail__sys_acl_set_file(vfs_handle_struct *handle,
static int zfsacl_fail__sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
return -1;

View File

@ -3061,7 +3061,7 @@ static bool set_canon_ace_list(files_struct *fsp,
}
}
} else {
if (SMB_VFS_SYS_ACL_SET_FD(fsp, the_acl) == -1) {
if (SMB_VFS_SYS_ACL_SET_FD(fsp, SMB_ACL_TYPE_ACCESS, the_acl) == -1) {
/*
* Some systems allow all the above calls and only fail with no ACL support
* when attempting to apply the acl. HPUX with HFS is an example of this. JRA.
@ -3079,7 +3079,9 @@ static bool set_canon_ace_list(files_struct *fsp,
fsp_str_dbg(fsp)));
become_root();
sret = SMB_VFS_SYS_ACL_SET_FD(fsp, the_acl);
sret = SMB_VFS_SYS_ACL_SET_FD(fsp,
SMB_ACL_TYPE_ACCESS,
the_acl);
unbecome_root();
if (sret == 0) {
ret = True;
@ -4559,7 +4561,7 @@ static NTSTATUS remove_posix_acl(connection_struct *conn,
}
/* Set the new empty file ACL. */
ret = SMB_VFS_SYS_ACL_SET_FD(fsp, new_file_acl);
ret = SMB_VFS_SYS_ACL_SET_FD(fsp, SMB_ACL_TYPE_ACCESS, new_file_acl);
if (ret == -1) {
status = map_nt_error_from_unix(errno);
DBG_INFO("acl_set_file failed on %s (%s)\n",
@ -4605,7 +4607,7 @@ NTSTATUS set_unix_posix_acl(connection_struct *conn,
return map_nt_error_from_unix(errno);
}
ret = SMB_VFS_SYS_ACL_SET_FD(fsp, file_acl);
ret = SMB_VFS_SYS_ACL_SET_FD(fsp, SMB_ACL_TYPE_ACCESS, file_acl);
if (ret == -1) {
status = map_nt_error_from_unix(errno);
DBG_INFO("acl_set_file failed on %s (%s)\n",

View File

@ -2776,10 +2776,12 @@ int smb_vfs_call_sys_acl_set_file(struct vfs_handle_struct *handle,
}
int smb_vfs_call_sys_acl_set_fd(struct vfs_handle_struct *handle,
struct files_struct *fsp, SMB_ACL_T theacl)
struct files_struct *fsp,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
VFS_FIND(sys_acl_set_fd);
return handle->fns->sys_acl_set_fd_fn(handle, fsp, theacl);
return handle->fns->sys_acl_set_fd_fn(handle, fsp, type, theacl);
}
int smb_vfs_call_sys_acl_delete_def_file(struct vfs_handle_struct *handle,