return NT_STATUS_NOT_IMPLEMENTED;
}
-static NTSTATUS skel_set_dos_attributes(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- uint32_t dosmode)
-{
- return NT_STATUS_NOT_IMPLEMENTED;
-}
-
static NTSTATUS skel_fset_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t dosmode)
.get_dos_attributes_send_fn = skel_get_dos_attributes_send,
.get_dos_attributes_recv_fn = skel_get_dos_attributes_recv,
.fget_dos_attributes_fn = skel_fget_dos_attributes,
- .set_dos_attributes_fn = skel_set_dos_attributes,
.fset_dos_attributes_fn = skel_fset_dos_attributes,
/* NT ACL operations. */
dosmode);
}
-static NTSTATUS skel_set_dos_attributes(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- uint32_t dosmode)
-{
- return SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle,
- smb_fname,
- dosmode);
-}
-
static NTSTATUS skel_fset_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t dosmode)
.get_dos_attributes_send_fn = skel_get_dos_attributes_send,
.get_dos_attributes_recv_fn = skel_get_dos_attributes_recv,
.fget_dos_attributes_fn = skel_fget_dos_attributes,
- .set_dos_attributes_fn = skel_set_dos_attributes,
.fset_dos_attributes_fn = skel_fset_dos_attributes,
/* NT ACL operations. */
struct files_struct *fsp,
uint32_t *dosmode);
- NTSTATUS (*set_dos_attributes_fn)(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- uint32_t dosmode);
-
NTSTATUS (*fset_dos_attributes_fn)(struct vfs_handle_struct *hande,
struct files_struct *fsp,
uint32_t dosmode);
NTSTATUS smb_vfs_call_fget_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t *dosmode);
-NTSTATUS smb_vfs_call_set_dos_attributes(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- uint32_t dosmode);
NTSTATUS smb_vfs_call_fset_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t dosmode);
#define SMB_VFS_NEXT_GET_DOS_ATTRIBUTES_RECV(req, aio_state, dosmode) \
smb_vfs_call_get_dos_attributes_recv((req), (aio_state), (dosmode))
-#define SMB_VFS_SET_DOS_ATTRIBUTES(conn, smb_fname, attributes) \
- smb_vfs_call_set_dos_attributes((conn)->vfs_handles, (smb_fname), (attributes))
-#define SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle, smb_fname, attributes) \
- smb_vfs_call_set_dos_attributes((handle)->next, (smb_fname), (attributes))
#define SMB_VFS_FSET_DOS_ATTRIBUTES(conn, fsp, attributes) \
smb_vfs_call_fset_dos_attributes((conn)->vfs_handles, (fsp), (attributes))
#define SMB_VFS_NEXT_FSET_DOS_ATTRIBUTES(handle, fsp, attributes) \
return status;
}
-static NTSTATUS catia_set_dos_attributes(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- uint32_t dosmode)
-{
- char *mapped_name = NULL;
- const char *path = smb_fname->base_name;
- struct smb_filename *mapped_smb_fname = NULL;
- NTSTATUS status;
-
- status = catia_string_replace_allocate(handle->conn,
- path, &mapped_name, vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
- return status;
- }
- status = synthetic_pathref(talloc_tos(),
- handle->conn->cwd_fsp,
- mapped_name,
- NULL,
- &smb_fname->st,
- smb_fname->twrp,
- smb_fname->flags,
- &mapped_smb_fname);
- /*
- * how about NT_STATUS_OBJECT_NAME_NOT_FOUND / link ? not sure
- * if we let that go and return success or not :/
- */
-
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
-
- status = SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle,
- mapped_smb_fname,
- dosmode);
- TALLOC_FREE(mapped_name);
- TALLOC_FREE(mapped_smb_fname);
-
- return status;
-}
-
static NTSTATUS catia_create_dfs_pathat(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
.fsctl_fn = catia_fsctl,
.get_dos_attributes_send_fn = vfs_not_implemented_get_dos_attributes_send,
.get_dos_attributes_recv_fn = vfs_not_implemented_get_dos_attributes_recv,
- .set_dos_attributes_fn = catia_set_dos_attributes,
.fset_dos_attributes_fn = catia_fset_dos_attributes,
.fget_dos_attributes_fn = catia_fget_dos_attributes,
.fget_compression_fn = catia_fget_compression,
return fget_ea_dos_attribute(fsp, dosmode);
}
-static NTSTATUS vfswrap_set_dos_attributes(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- uint32_t dosmode)
-{
- return set_ea_dos_attribute(handle->conn, smb_fname, dosmode);
-}
-
static NTSTATUS vfswrap_fset_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t dosmode)
.strict_lock_check_fn = vfswrap_strict_lock_check,
.translate_name_fn = vfswrap_translate_name,
.fsctl_fn = vfswrap_fsctl,
- .set_dos_attributes_fn = vfswrap_set_dos_attributes,
.fset_dos_attributes_fn = vfswrap_fset_dos_attributes,
.get_dos_attributes_send_fn = vfswrap_get_dos_attributes_send,
.get_dos_attributes_recv_fn = vfswrap_get_dos_attributes_recv,
SMB_VFS_OP_GET_DOS_ATTRIBUTES_SEND,
SMB_VFS_OP_GET_DOS_ATTRIBUTES_RECV,
SMB_VFS_OP_FGET_DOS_ATTRIBUTES,
- SMB_VFS_OP_SET_DOS_ATTRIBUTES,
SMB_VFS_OP_FSET_DOS_ATTRIBUTES,
/* NT ACL operations. */
{ SMB_VFS_OP_GET_DOS_ATTRIBUTES_SEND, "get_dos_attributes_send" },
{ SMB_VFS_OP_GET_DOS_ATTRIBUTES_RECV, "get_dos_attributes_recv" },
{ SMB_VFS_OP_FGET_DOS_ATTRIBUTES, "fget_dos_attributes" },
- { SMB_VFS_OP_SET_DOS_ATTRIBUTES, "set_dos_attributes" },
{ SMB_VFS_OP_FSET_DOS_ATTRIBUTES, "fset_dos_attributes" },
{ SMB_VFS_OP_FGET_NT_ACL, "fget_nt_acl" },
{ SMB_VFS_OP_GET_NT_ACL_AT, "get_nt_acl_at" },
return status;
}
-static NTSTATUS smb_full_audit_set_dos_attributes(
- struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- uint32_t dosmode)
-{
- NTSTATUS status;
-
- status = SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle,
- smb_fname,
- dosmode);
-
- do_log(SMB_VFS_OP_SET_DOS_ATTRIBUTES,
- NT_STATUS_IS_OK(status),
- handle,
- "%s",
- smb_fname_str_do_log(handle->conn, smb_fname));
-
- return status;
-}
-
static NTSTATUS smb_full_audit_fset_dos_attributes(
struct vfs_handle_struct *handle,
struct files_struct *fsp,
.get_dos_attributes_send_fn = smb_full_audit_get_dos_attributes_send,
.get_dos_attributes_recv_fn = smb_full_audit_get_dos_attributes_recv,
.fget_dos_attributes_fn = smb_full_audit_fget_dos_attributes,
- .set_dos_attributes_fn = smb_full_audit_set_dos_attributes,
.fset_dos_attributes_fn = smb_full_audit_fset_dos_attributes,
.fget_nt_acl_fn = smb_full_audit_fget_nt_acl,
.get_nt_acl_at_fn = smb_full_audit_get_nt_acl_at,
return NT_STATUS_OK;
}
-static NTSTATUS vfs_gpfs_set_dos_attributes(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- uint32_t dosmode)
-{
- struct gpfs_config_data *config;
- struct gpfs_winattr attrs = { };
- int ret;
-
- SMB_VFS_HANDLE_GET_DATA(handle, config,
- struct gpfs_config_data,
- return NT_STATUS_INTERNAL_ERROR);
-
- if (!config->winattr) {
- return SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle,
- smb_fname, dosmode);
- }
-
- attrs.winAttrs = vfs_gpfs_dosmode_to_winattrs(dosmode);
- ret = gpfswrap_set_winattrs_path(smb_fname->base_name,
- GPFS_WINATTR_SET_ATTRS, &attrs);
-
- if (ret == -1 && errno == ENOSYS) {
- return SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle,
- smb_fname, dosmode);
- }
-
- if (ret == -1) {
- DBG_WARNING("Setting winattrs failed for %s: %s\n",
- smb_fname->base_name, strerror(errno));
- return map_nt_error_from_unix(errno);
- }
-
- return NT_STATUS_OK;
-}
-
static NTSTATUS vfs_gpfs_fset_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t dosmode)
.get_dos_attributes_send_fn = vfs_not_implemented_get_dos_attributes_send,
.get_dos_attributes_recv_fn = vfs_not_implemented_get_dos_attributes_recv,
.fget_dos_attributes_fn = vfs_gpfs_fget_dos_attributes,
- .set_dos_attributes_fn = vfs_gpfs_set_dos_attributes,
.fset_dos_attributes_fn = vfs_gpfs_fset_dos_attributes,
.fget_nt_acl_fn = gpfsacl_fget_nt_acl,
.get_nt_acl_at_fn = gpfsacl_get_nt_acl_at,
return NT_STATUS_NOT_IMPLEMENTED;
}
-NTSTATUS vfs_not_implemented_set_dos_attributes(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- uint32_t dosmode)
-{
- return NT_STATUS_NOT_IMPLEMENTED;
-}
-
NTSTATUS vfs_not_implemented_fset_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t dosmode)
.get_dos_attributes_send_fn = vfs_not_implemented_get_dos_attributes_send,
.get_dos_attributes_recv_fn = vfs_not_implemented_get_dos_attributes_recv,
.fget_dos_attributes_fn = vfs_not_implemented_fget_dos_attributes,
- .set_dos_attributes_fn = vfs_not_implemented_set_dos_attributes,
.fset_dos_attributes_fn = vfs_not_implemented_fset_dos_attributes,
/* NT ACL operations. */
return result;
}
-static NTSTATUS smb_time_set_dos_attributes(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- uint32_t dosmode)
-{
- NTSTATUS result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle,
- smb_fname,
- dosmode);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log_fname("set_dos_attributes",
- timediff,
- smb_fname->base_name);
- }
-
- return result;
-}
-
static NTSTATUS smb_time_fset_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t dosmode)
.get_dos_attributes_send_fn = smb_time_audit_get_dos_attributes_send,
.get_dos_attributes_recv_fn = smb_time_audit_get_dos_attributes_recv,
.fget_dos_attributes_fn = smb_time_fget_dos_attributes,
- .set_dos_attributes_fn = smb_time_set_dos_attributes,
.fset_dos_attributes_fn = smb_time_fset_dos_attributes,
.fget_nt_acl_fn = smb_time_audit_fget_nt_acl,
.get_nt_acl_at_fn = smb_time_audit_get_nt_acl_at,
return NT_STATUS_OK;
}
-static NTSTATUS tsmsm_set_dos_attributes(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- uint32_t dosmode)
-{
- NTSTATUS status;
- uint32_t old_dosmode;
- struct smb_filename *fname = NULL;
-
- /* dos_mode() doesn't like const smb_fname */
- fname = cp_smb_filename(talloc_tos(), smb_fname);
- if (fname == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
-
- old_dosmode = fdos_mode(smb_fname->fsp);
- TALLOC_FREE(fname);
-
- status = SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle, smb_fname, dosmode);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
-
- if (!(old_dosmode & FILE_ATTRIBUTE_OFFLINE) &&
- (dosmode & FILE_ATTRIBUTE_OFFLINE))
- {
- return NT_STATUS_OK;
- }
-
- return tsmsm_set_offline(handle, smb_fname);
-}
-
static NTSTATUS tsmsm_fset_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t dosmode)
.pwrite_send_fn = tsmsm_pwrite_send,
.pwrite_recv_fn = tsmsm_pwrite_recv,
.sendfile_fn = tsmsm_sendfile,
- .set_dos_attributes_fn = tsmsm_set_dos_attributes,
.fset_dos_attributes_fn = tsmsm_fset_dos_attributes,
.get_dos_attributes_send_fn = vfs_not_implemented_get_dos_attributes_send,
.get_dos_attributes_recv_fn = vfs_not_implemented_get_dos_attributes_recv,
return result;
}
-static NTSTATUS vxfs_set_ea_dos_attributes(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- uint32_t dosmode)
-{
- NTSTATUS err;
- int ret = 0;
- bool attrset = false;
- bool is_dir = false;
-
- DBG_DEBUG("Entered function\n");
-
- is_dir = S_ISDIR(smb_fname->st.st_ex_mode);
- if (!(dosmode & FILE_ATTRIBUTE_READONLY)) {
- ret = vxfs_checkwxattr_path(smb_fname->base_name);
- if (ret == -1) {
- DBG_DEBUG("ret:%d\n", ret);
- if ((errno != EOPNOTSUPP) && (errno != ENOENT)) {
- return map_nt_error_from_unix(errno);
- }
- }
- }
- if (dosmode & FILE_ATTRIBUTE_READONLY) {
- ret = vxfs_setwxattr_path(smb_fname->base_name, is_dir);
- DBG_DEBUG("ret:%d\n", ret);
- if (ret == -1) {
- if ((errno != EOPNOTSUPP) && (errno != EINVAL)) {
- return map_nt_error_from_unix(errno);
- }
- } else {
- attrset = true;
- }
- }
- err = SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle, smb_fname, dosmode);
- if (!NT_STATUS_IS_OK(err)) {
- if (attrset) {
- ret = vxfs_clearwxattr_path(smb_fname->base_name, is_dir);
- DBG_DEBUG("ret:%d\n", ret);
- if ((ret == -1) && (errno != ENOENT)) {
- return map_nt_error_from_unix(errno);
- }
- }
- }
-
- return err;
-}
-
static NTSTATUS vxfs_fset_ea_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t dosmode)
.sys_acl_set_fd_fn = vxfs_sys_acl_set_fd,
#endif
- .set_dos_attributes_fn = vxfs_set_ea_dos_attributes,
.fset_dos_attributes_fn = vxfs_fset_ea_dos_attributes,
.getxattr_fn = vxfs_get_xattr,
.getxattrat_send_fn = vfs_not_implemented_getxattrat_send,
return handle->fns->fget_dos_attributes_fn(handle, fsp, dosmode);
}
-NTSTATUS smb_vfs_call_set_dos_attributes(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- uint32_t dosmode)
-{
- VFS_FIND(set_dos_attributes);
- return handle->fns->set_dos_attributes_fn(handle, smb_fname, dosmode);
-}
-
NTSTATUS smb_vfs_call_fset_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t dosmode)