<member>sys_acl_get_fd</member>
<member>sys_acl_get_file</member>
<member>sys_acl_set_fd</member>
- <member>sys_acl_set_file</member>
<member>telldir</member>
<member>translate_name</member>
<member>unlinkat</member>
return -1;
}
-static int skel_sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T acltype,
- SMB_ACL_T theacl)
-{
- errno = ENOSYS;
- return -1;
-}
-
static int skel_sys_acl_set_fd(vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_ACL_TYPE_T type,
.sys_acl_get_fd_fn = skel_sys_acl_get_fd,
.sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = skel_sys_acl_set_file,
.sys_acl_set_fd_fn = skel_sys_acl_set_fd,
.sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
blob_description, blob);
}
-static int skel_sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T acltype,
- SMB_ACL_T theacl)
-{
- return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname,
- acltype, theacl);
-}
-
static int skel_sys_acl_set_fd(vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_ACL_TYPE_T type,
.sys_acl_get_fd_fn = skel_sys_acl_get_fd,
.sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = skel_sys_acl_set_file,
.sys_acl_set_fd_fn = skel_sys_acl_set_fd,
.sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
* 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()
+ * Version 44 - Remove SMB_VFS_SYS_ACL_SET_FILE()
*/
#define SMB_VFS_INTERFACE_VERSION 44
int (*sys_acl_blob_get_fd_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp,
TALLOC_CTX *mem_ctx, char **blob_description,
DATA_BLOB *blob);
- int (*sys_acl_set_file_fn)(struct vfs_handle_struct *handle,
- 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_TYPE_T type,
TALLOC_CTX *mem_ctx,
char **blob_description,
DATA_BLOB *blob);
-int smb_vfs_call_sys_acl_set_file(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- 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_TYPE_T type,
int vfs_not_implemented_sys_acl_blob_get_fd(vfs_handle_struct *handle,
files_struct *fsp, TALLOC_CTX *mem_ctx,
char **blob_description, DATA_BLOB *blob);
-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,
struct files_struct *fsp,
SMB_ACL_TYPE_T type,
#define SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx, blob_description, blob) \
smb_vfs_call_sys_acl_blob_get_fd((handle)->next, (fsp), mem_ctx, (blob_description), (blob))
-#define SMB_VFS_SYS_ACL_SET_FILE(conn, smb_fname, acltype, theacl) \
- smb_vfs_call_sys_acl_set_file((conn)->vfs_handles, (smb_fname), (acltype), (theacl))
-#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, 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) \
Remove a Windows ACL - we're setting the underlying POSIX ACL.
*********************************************************************/
-static int sys_acl_set_file_tdb(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname_in,
- SMB_ACL_TYPE_T type,
- SMB_ACL_T theacl)
-{
- struct db_context *db = acl_db;
- int ret = -1;
- int saved_errno = 0;
- struct smb_filename *smb_fname = NULL;
-
- smb_fname = cp_smb_filename_nostream(talloc_tos(), smb_fname_in);
- if (smb_fname == NULL) {
- return -1;
- };
-
- ret = SMB_VFS_STAT(handle->conn, smb_fname);
- if (ret == -1) {
- saved_errno = errno;
- goto fail;
- }
-
- ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle,
- smb_fname,
- type,
- theacl);
- if (ret == -1) {
- saved_errno = errno;
- goto fail;
- }
-
- acl_tdb_delete(handle, db, &smb_fname->st);
-
-fail:
- TALLOC_FREE(smb_fname);
-
- if (saved_errno != 0) {
- errno = saved_errno;
- }
- return ret;
-}
-
-/*********************************************************************
- Remove a Windows ACL - we're setting the underlying POSIX ACL.
-*********************************************************************/
-
static int sys_acl_set_fd_tdb(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
.fget_nt_acl_fn = acl_tdb_fget_nt_acl,
.get_nt_acl_at_fn = acl_tdb_get_nt_acl_at,
.fset_nt_acl_fn = acl_tdb_fset_nt_acl,
- .sys_acl_set_file_fn = sys_acl_set_file_tdb,
.sys_acl_set_fd_fn = sys_acl_set_fd_tdb
};
Remove a Windows ACL - we're setting the underlying POSIX ACL.
*********************************************************************/
-static int sys_acl_set_file_xattr(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T type,
- SMB_ACL_T theacl)
-{
- int ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle,
- smb_fname,
- type,
- theacl);
- if (ret == -1) {
- return -1;
- }
-
- become_root();
- SMB_VFS_REMOVEXATTR(handle->conn, smb_fname,
- XATTR_NTACL_NAME);
- unbecome_root();
-
- return ret;
-}
-
-/*********************************************************************
- Remove a Windows ACL - we're setting the underlying POSIX ACL.
-*********************************************************************/
-
static int sys_acl_set_fd_xattr(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
.fget_nt_acl_fn = acl_xattr_fget_nt_acl,
.get_nt_acl_at_fn = acl_xattr_get_nt_acl_at,
.fset_nt_acl_fn = acl_xattr_fset_nt_acl,
- .sys_acl_set_file_fn = sys_acl_set_file_xattr,
.sys_acl_set_fd_fn = sys_acl_set_fd_xattr
};
return NULL;*/
}
-int aixacl_sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T type,
- SMB_ACL_T theacl)
-{
- struct acl *file_acl = NULL;
- unsigned int rc;
-
- file_acl = aixacl_smb_to_aixacl(type, theacl);
- if (!file_acl)
- return -1;
-
- rc = chacl((char *)smb_fname->base_name,file_acl,file_acl->acl_len);
- DEBUG(10,("errno is %d\n",errno));
- DEBUG(10,("return code is %d\n",rc));
- SAFE_FREE(file_acl);
- DEBUG(10,("Exiting the aixacl_sys_acl_set_file\n"));
-
- return rc;
-}
-
int aixacl_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
.sys_acl_get_fd_fn = aixacl_sys_acl_get_fd,
.sys_acl_blob_get_file_fn = posix_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = posix_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = aixacl_sys_acl_set_file,
.sys_acl_set_fd_fn = aixacl_sys_acl_set_fd,
.sys_acl_delete_def_file_fn = aixacl_sys_acl_delete_def_file,
};
return aixjfs2_set_nt_acl_common(handle, fsp, security_info_sent, psd);
}
-int aixjfs2_sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T type,
- SMB_ACL_T theacl)
-{
- struct acl *acl_aixc;
- acl_type_t acl_type_info;
- int rc;
-
- DEBUG(10, ("aixjfs2_sys_acl_set_file invoked for %s",
- smb_fname->base_name));
-
- rc = aixjfs2_query_acl_support((char *)smb_fname->base_name,
- ACL_AIXC, &acl_type_info);
- if (rc) {
- DEBUG(8, ("jfs2_set_nt_acl: AIXC support not found\n"));
- return -1;
- }
-
- acl_aixc = aixacl_smb_to_aixacl(type, theacl);
- if (!acl_aixc)
- return -1;
-
- rc = aclx_put(
- (char *)smb_fname->base_name,
- SET_ACL, /* set only the ACL, not mode bits */
- acl_type_info,
- acl_aixc,
- acl_aixc->acl_len,
- 0
- );
- if (rc) {
- DEBUG(2, ("aclx_put failed with %s for %s\n",
- strerror(errno), smb_fname->base_name));
- return -1;
- }
-
- return 0;
-}
-
int aixjfs2_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
.sys_acl_get_fd_fn = aixjfs2_sys_acl_get_fd,
.sys_acl_blob_get_file_fn = aixjfs2_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = aixjfs2_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = aixjfs2_sys_acl_set_file,
.sys_acl_set_fd_fn = aixjfs2_sys_acl_set_fd,
.sys_acl_delete_def_file_fn = aixjfs2_sys_acl_delete_def_file
};
return ret;
}
-static int cap_sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T acltype,
- SMB_ACL_T theacl)
-{
- struct smb_filename *cap_smb_fname = NULL;
- char *cappath = capencode(talloc_tos(), smb_fname->base_name);
- int ret;
- int saved_errno = 0;
-
- if (!cappath) {
- errno = ENOMEM;
- return -1;
- }
- cap_smb_fname = synthetic_smb_fname(talloc_tos(),
- cappath,
- NULL,
- NULL,
- smb_fname->twrp,
- smb_fname->flags);
- if (cap_smb_fname == NULL) {
- TALLOC_FREE(cappath);
- errno = ENOMEM;
- return -1;
- }
- ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, cap_smb_fname,
- acltype, theacl);
- if (ret == -1) {
- 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_delete_def_file(vfs_handle_struct *handle,
const struct smb_filename *smb_fname)
{
.mknodat_fn = cap_mknodat,
.realpath_fn = cap_realpath,
.sys_acl_get_file_fn = cap_sys_acl_get_file,
- .sys_acl_set_file_fn = cap_sys_acl_set_file,
.sys_acl_delete_def_file_fn = cap_sys_acl_delete_def_file,
.getxattr_fn = cap_getxattr,
.getxattrat_send_fn = vfs_not_implemented_getxattrat_send,
return ret;
}
-static int
-catia_sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T type,
- SMB_ACL_T theacl)
-{
- struct smb_filename *mapped_smb_fname = NULL;
- int saved_errno = 0;
- char *mapped_name = NULL;
- NTSTATUS status;
- int ret;
-
- status = catia_string_replace_allocate(handle->conn,
- smb_fname->base_name,
- &mapped_name,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
- return -1;
- }
-
- mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
- mapped_name,
- NULL,
- &smb_fname->st,
- smb_fname->twrp,
- smb_fname->flags);
- if (mapped_smb_fname == NULL) {
- TALLOC_FREE(mapped_name);
- errno = ENOMEM;
- return -1;
- }
-
- ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, mapped_smb_fname,
- type, theacl);
- if (ret == -1) {
- saved_errno = errno;
- }
- TALLOC_FREE(mapped_smb_fname);
- TALLOC_FREE(mapped_name);
- if (saved_errno != 0) {
- errno = saved_errno;
- }
- return ret;
-}
-
static int
catia_sys_acl_delete_def_file(vfs_handle_struct *handle,
const struct smb_filename *smb_fname)
.sys_acl_get_file_fn = catia_sys_acl_get_file,
.sys_acl_get_fd_fn = catia_sys_acl_get_fd,
.sys_acl_blob_get_fd_fn = catia_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = catia_sys_acl_set_file,
.sys_acl_set_fd_fn = catia_sys_acl_set_fd,
.sys_acl_delete_def_file_fn = catia_sys_acl_delete_def_file,
.sys_acl_get_fd_fn = posixacl_xattr_acl_get_fd,
.sys_acl_blob_get_file_fn = posix_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = posix_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = posixacl_xattr_acl_set_file,
.sys_acl_set_fd_fn = posixacl_xattr_acl_set_fd,
.sys_acl_delete_def_file_fn = posixacl_xattr_acl_delete_def_file,
return sys_acl_get_fd(handle, fsp, mem_ctx);
}
-static int vfswrap_sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T acltype,
- SMB_ACL_T theacl)
-{
- 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_TYPE_T type,
.sys_acl_get_fd_fn = vfswrap_sys_acl_get_fd,
.sys_acl_blob_get_file_fn = posix_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = posix_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = vfswrap_sys_acl_set_file,
.sys_acl_set_fd_fn = vfswrap_sys_acl_set_fd,
.sys_acl_delete_def_file_fn = vfswrap_sys_acl_delete_def_file,
.sys_acl_get_fd_fn = fake_acls_sys_acl_get_fd,
.sys_acl_blob_get_file_fn = posix_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = posix_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = fake_acls_sys_acl_set_file,
.sys_acl_set_fd_fn = fake_acls_sys_acl_set_fd,
.sys_acl_delete_def_file_fn = fake_acls_sys_acl_delete_def_file,
.lchown_fn = fake_acls_lchown,
SMB_VFS_OP_SYS_ACL_GET_FD,
SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE,
SMB_VFS_OP_SYS_ACL_BLOB_GET_FD,
- SMB_VFS_OP_SYS_ACL_SET_FILE,
SMB_VFS_OP_SYS_ACL_SET_FD,
SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE,
{ SMB_VFS_OP_SYS_ACL_GET_FD, "sys_acl_get_fd" },
{ SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE, "sys_acl_blob_get_file" },
{ SMB_VFS_OP_SYS_ACL_BLOB_GET_FD, "sys_acl_blob_get_fd" },
- { SMB_VFS_OP_SYS_ACL_SET_FILE, "sys_acl_set_file" },
{ SMB_VFS_OP_SYS_ACL_SET_FD, "sys_acl_set_fd" },
{ SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, "sys_acl_delete_def_file" },
{ SMB_VFS_OP_GETXATTR, "getxattr" },
return result;
}
-static int smb_full_audit_sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T acltype,
- SMB_ACL_T theacl)
-{
- int result;
-
- result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, acltype,
- theacl);
-
- do_log(SMB_VFS_OP_SYS_ACL_SET_FILE,
- (result >= 0),
- handle,
- "%s",
- smb_fname_str_do_log(handle->conn, smb_fname));
-
- return result;
-}
-
static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_ACL_TYPE_T type,
.sys_acl_get_fd_fn = smb_full_audit_sys_acl_get_fd,
.sys_acl_blob_get_file_fn = smb_full_audit_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = smb_full_audit_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = smb_full_audit_sys_acl_set_file,
.sys_acl_set_fd_fn = smb_full_audit_sys_acl_set_fd,
.sys_acl_delete_def_file_fn = smb_full_audit_sys_acl_delete_def_file,
.getxattr_fn = smb_full_audit_getxattr,
.sys_acl_get_fd_fn = posixacl_xattr_acl_get_fd,
.sys_acl_blob_get_file_fn = posix_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = posix_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = posixacl_xattr_acl_set_file,
.sys_acl_set_fd_fn = posixacl_xattr_acl_set_fd,
.sys_acl_delete_def_file_fn = posixacl_xattr_acl_delete_def_file,
return result;
}
-static int gpfsacl_sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T type,
- SMB_ACL_T theacl)
+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_acl *gpfs_acl;
- int result;
struct gpfs_config_data *config;
+ struct gpfs_acl *gpfs_acl = NULL;
+ int result;
SMB_VFS_HANDLE_GET_DATA(handle, config,
struct gpfs_config_data,
return -1);
if (!config->acl) {
- return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname,
- type, theacl);
+ return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl);
}
gpfs_acl = smb2gpfs_acl(theacl, type);
return -1;
}
- result = gpfswrap_putacl(smb_fname->base_name,
+ /*
+ * This is no longer a handle based call.
+ */
+ result = gpfswrap_putacl(fsp->fsp_name->base_name,
GPFS_PUTACL_STRUCT|GPFS_ACL_SAMBA,
gpfs_acl);
-
SAFE_FREE(gpfs_acl);
return result;
}
-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;
-
- SMB_VFS_HANDLE_GET_DATA(handle, config,
- struct gpfs_config_data,
- return -1);
-
- if (!config->acl) {
- return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl);
- }
-
- /*
- * This is no longer a handle based call.
- */
- return gpfsacl_sys_acl_set_file(handle, fsp->fsp_name,
- type, theacl);
-}
-
static int gpfsacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
const struct smb_filename *smb_fname)
{
.sys_acl_get_fd_fn = gpfsacl_sys_acl_get_fd,
.sys_acl_blob_get_file_fn = gpfsacl_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = gpfsacl_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = gpfsacl_sys_acl_set_file,
.sys_acl_set_fd_fn = gpfsacl_sys_acl_set_fd,
.sys_acl_delete_def_file_fn = gpfsacl_sys_acl_delete_def_file,
.chmod_fn = vfs_gpfs_chmod,
.sys_acl_get_fd_fn = hpuxacl_sys_acl_get_fd,
.sys_acl_blob_get_file_fn = posix_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = posix_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = hpuxacl_sys_acl_set_file,
.sys_acl_set_fd_fn = hpuxacl_sys_acl_set_fd,
.sys_acl_delete_def_file_fn = hpuxacl_sys_acl_delete_def_file,
};
return ret;
}
-/*
- * Success: return 0
- * Failure: set errno, return -1
- * In this case, "name" is a path.
- */
-static int mh_sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T acltype,
- SMB_ACL_T theacl)
-{
- int status;
- struct smb_filename *clientFname = NULL;
-
- DEBUG(MH_INFO_DEBUG, ("Entering mh_sys_acl_set_file\n"));
- if (!is_in_media_files(smb_fname->base_name)) {
- status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname,
- acltype, theacl);
- goto out;
- }
-
- status = alloc_get_client_smb_fname(handle,
- talloc_tos(),
- smb_fname,
- &clientFname);
- if (status != 0) {
- goto err;
- }
-
- status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, clientFname,
- acltype, theacl);
-err:
- TALLOC_FREE(clientFname);
-out:
- return status;
-}
-
/*
* Success: return 0
* Failure: set errno, return -1
/* POSIX ACL operations. */
.sys_acl_get_file_fn = mh_sys_acl_get_file,
- .sys_acl_set_file_fn = mh_sys_acl_set_file,
.sys_acl_delete_def_file_fn = mh_sys_acl_delete_def_file,
/* EA operations. */
return (SMB_ACL_T)NULL;
}
-static int nfs4acl_xattr_fail__sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T type,
- SMB_ACL_T theacl)
-{
- return -1;
-}
-
static int nfs4acl_xattr_fail__sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
.sys_acl_get_fd_fn = nfs4acl_xattr_fail__sys_acl_get_fd,
.sys_acl_blob_get_file_fn = nfs4acl_xattr_fail__sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = nfs4acl_xattr_fail__sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = nfs4acl_xattr_fail__sys_acl_set_file,
.sys_acl_set_fd_fn = nfs4acl_xattr_fail__sys_acl_set_fd,
.sys_acl_delete_def_file_fn = nfs4acl_xattr_fail__sys_acl_delete_def_file,
};
return -1;
}
-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)
-{
- errno = ENOSYS;
- return -1;
-}
-
int vfs_not_implemented_sys_acl_set_fd(vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_ACL_TYPE_T type,
.sys_acl_get_fd_fn = vfs_not_implemented_sys_acl_get_fd,
.sys_acl_blob_get_file_fn = vfs_not_implemented_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = vfs_not_implemented_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = vfs_not_implemented_sys_acl_set_file,
.sys_acl_set_fd_fn = vfs_not_implemented_sys_acl_set_fd,
.sys_acl_delete_def_file_fn = vfs_not_implemented_sys_acl_delete_def_file,
.sys_acl_get_fd_fn = posixacl_sys_acl_get_fd,
.sys_acl_blob_get_file_fn = posix_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = posix_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = posixacl_sys_acl_set_file,
.sys_acl_set_fd_fn = posixacl_sys_acl_set_fd,
.sys_acl_delete_def_file_fn = posixacl_sys_acl_delete_def_file,
};
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
*/
.sys_acl_get_fd_fn = solarisacl_sys_acl_get_fd,
.sys_acl_blob_get_file_fn = posix_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = posix_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = solarisacl_sys_acl_set_file,
.sys_acl_set_fd_fn = solarisacl_sys_acl_set_fd,
.sys_acl_delete_def_file_fn = solarisacl_sys_acl_delete_def_file,
};
return result;
}
-static int smb_time_audit_sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T acltype,
- SMB_ACL_T theacl)
-{
- int result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, acltype,
- theacl);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log_fname("sys_acl_set_file", timediff,
- smb_fname->base_name);
- }
-
- return result;
-}
-
static int smb_time_audit_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
.sys_acl_get_fd_fn = smb_time_audit_sys_acl_get_fd,
.sys_acl_blob_get_file_fn = smb_time_audit_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = smb_time_audit_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = smb_time_audit_sys_acl_set_file,
.sys_acl_set_fd_fn = smb_time_audit_sys_acl_set_fd,
.sys_acl_delete_def_file_fn = smb_time_audit_sys_acl_delete_def_file,
.getxattr_fn = smb_time_audit_getxattr,
return result;
}
-int tru64acl_sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T type,
- SMB_ACL_T theacl)
-{
- int res;
- acl_type_t the_acl_type;
- acl_t tru64_acl;
-
- DEBUG(10, ("tru64acl_sys_acl_set_file called with name %s, type %d\n",
- smb_fname->base_name, type));
-
- switch(type) {
- case SMB_ACL_TYPE_ACCESS:
- DEBUGADD(10, ("got acl type ACL_TYPE_ACCESS\n"));
- the_acl_type = ACL_TYPE_ACCESS;
- break;
- case SMB_ACL_TYPE_DEFAULT:
- DEBUGADD(10, ("got acl type ACL_TYPE_DEFAULT\n"));
- the_acl_type = ACL_TYPE_DEFAULT;
- break;
- default:
- DEBUGADD(10, ("invalid acl type\n"));
- errno = EINVAL;
- goto fail;
- }
-
- tru64_acl = smb_acl_to_tru64_acl(theacl);
- if (tru64_acl == NULL) {
- DEBUG(10, ("smb_acl_to_tru64_acl failed!\n"));
- goto fail;
- }
- DEBUG(10, ("got tru64 acl...\n"));
- res = acl_set_file((char *)smb_fname->base_name,
- the_acl_type, tru64_acl);
- acl_free(tru64_acl);
- if (res != 0) {
- DEBUG(10, ("acl_set_file failed: %s\n", strerror(errno)));
- goto fail;
- }
- return res;
-fail:
- DEBUG(1, ("tru64acl_sys_acl_set_file failed!\n"));
- return -1;
-}
-
int tru64acl_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
.sys_acl_get_fd_fn = tru64acl_sys_acl_get_fd,
.sys_acl_blob_get_file_fn = posix_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = posix_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = tru64acl_sys_acl_set_file,
.sys_acl_set_fd_fn = tru64acl_sys_acl_set_fd,
.sys_acl_delete_def_file_fn = tru64acl_sys_acl_delete_def_file,
};
return ret;
}
-static int um_sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T acltype,
- SMB_ACL_T theacl)
-{
- int status;
- int saved_errno = 0;
- struct smb_filename *client_fname = NULL;
-
- DEBUG(10, ("Entering um_sys_acl_set_file\n"));
-
- if (!is_in_media_files(smb_fname->base_name)) {
- return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname,
- acltype, theacl);
- }
-
- status = alloc_get_client_smb_fname(handle,
- talloc_tos(),
- smb_fname,
- &client_fname);
- if (status != 0) {
- goto err;
- }
-
- status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, client_fname,
- acltype, theacl);
-
-err:
- if (status == -1) {
- saved_errno = errno;
- }
- TALLOC_FREE(client_fname);
- if (saved_errno != 0) {
- errno = saved_errno;
- }
- return status;
-}
-
static int um_sys_acl_delete_def_file(vfs_handle_struct *handle,
const struct smb_filename *smb_fname)
{
/* POSIX ACL operations. */
.sys_acl_get_file_fn = um_sys_acl_get_file,
- .sys_acl_set_file_fn = um_sys_acl_set_file,
.sys_acl_delete_def_file_fn = um_sys_acl_delete_def_file,
/* EA operations. */
return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl);
}
-static int vxfs_sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T acltype,
- SMB_ACL_T theacl)
-{
- if (vxfs_compare(handle->conn, smb_fname,
- theacl, acltype)) {
- return 0;
- }
-
- return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname,
- acltype, theacl);
-}
-
static int vxfs_set_xattr(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname_in,
const char *name,
.connect_fn = vfs_vxfs_connect,
#ifdef VXFS_ACL_SHARE
- .sys_acl_set_file_fn = vxfs_sys_acl_set_file,
.sys_acl_set_fd_fn = vxfs_sys_acl_set_fd,
#endif
return (SMB_ACL_T)NULL;
}
-static int zfsacl_fail__sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T type,
- SMB_ACL_T theacl)
-{
- return -1;
-}
-
static int zfsacl_fail__sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
SMB_ACL_TYPE_T type,
.sys_acl_get_fd_fn = zfsacl_fail__sys_acl_get_fd,
.sys_acl_blob_get_file_fn = zfsacl_fail__sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = zfsacl_fail__sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = zfsacl_fail__sys_acl_set_file,
.sys_acl_set_fd_fn = zfsacl_fail__sys_acl_set_fd,
.sys_acl_delete_def_file_fn = zfsacl_fail__sys_acl_delete_def_file,
.fget_nt_acl_fn = zfsacl_fget_nt_acl,
return handle->fns->sys_acl_blob_get_fd_fn(handle, fsp, mem_ctx, blob_description, blob);
}
-int smb_vfs_call_sys_acl_set_file(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T acltype,
- SMB_ACL_T theacl)
-{
- VFS_FIND(sys_acl_set_file);
- return handle->fns->sys_acl_set_file_fn(handle, smb_fname,
- acltype, theacl);
-}
-
int smb_vfs_call_sys_acl_set_fd(struct vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_ACL_TYPE_T type,