return NT_STATUS_NOT_IMPLEMENTED;
}
-static NTSTATUS skel_get_dos_attributes(struct vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- uint32_t *dosmode)
-{
- return NT_STATUS_NOT_IMPLEMENTED;
-}
-
struct skel_get_dos_attributes_state {
struct vfs_aio_state aio_state;
uint32_t dosmode;
.audit_file_fn = skel_audit_file,
/* DOS attributes. */
- .get_dos_attributes_fn = skel_get_dos_attributes,
.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,
return SMB_VFS_NEXT_READDIR_ATTR(handle, fname, mem_ctx, pattr_data);
}
-static NTSTATUS skel_get_dos_attributes(struct vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- uint32_t *dosmode)
-{
- return SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle,
- smb_fname,
- dosmode);
-}
-
struct skel_get_dos_attributes_state {
struct vfs_aio_state aio_state;
uint32_t dosmode;
.audit_file_fn = skel_audit_file,
/* DOS attributes. */
- .get_dos_attributes_fn = skel_get_dos_attributes,
.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,
* Version 44 - Add 'have_proc_fds' flag to struct connection_struct.
* Version 44 - Add 'have_proc_fds' flag to struct files_struct.
* Version 44 - Add dirfsp arg to SMB_VFS_READDIR()
+ * Version 44 - Remove SMB_VFS_GET_DOS_ATTRIBUTES()
*/
#define SMB_VFS_INTERFACE_VERSION 44
uint32_t max_out_len,
uint32_t *out_len);
- NTSTATUS (*get_dos_attributes_fn)(struct vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- uint32_t *dosmode);
-
NTSTATUS (*fget_dos_attributes_fn)(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t *dosmode);
uint8_t **_out_data,
uint32_t max_out_len,
uint32_t *out_len);
-NTSTATUS smb_vfs_call_get_dos_attributes(struct vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- uint32_t *dosmode);
NTSTATUS smb_vfs_call_fget_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t *dosmode);
const struct smb_filename *fname,
TALLOC_CTX *mem_ctx,
struct readdir_attr_data **pattr_data);
-NTSTATUS vfs_not_implemented_get_dos_attributes(struct vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- uint32_t *dosmode);
struct tevent_req *vfs_not_implemented_get_dos_attributes_send(
TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
#define SMB_VFS_NEXT_FSCTL(handle, fsp, ctx, function, req_flags, in_data, in_len, out_data, max_out_len, out_len) \
smb_vfs_call_fsctl((handle)->next, (fsp), (ctx), (function), (req_flags), (in_data), (in_len), (out_data), (max_out_len), (out_len))
-#define SMB_VFS_GET_DOS_ATTRIBUTES(conn, smb_fname, attributes) \
- smb_vfs_call_get_dos_attributes((conn)->vfs_handles, (smb_fname), (attributes))
-#define SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle, smb_fname, attributes) \
- smb_vfs_call_get_dos_attributes((handle)->next, (smb_fname), (attributes))
#define SMB_VFS_FGET_DOS_ATTRIBUTES(conn, fsp, attributes) \
smb_vfs_call_fget_dos_attributes((conn)->vfs_handles, (fsp), (attributes))
#define SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle, fsp, attributes) \
return status;
}
-static NTSTATUS catia_get_dos_attributes(struct vfs_handle_struct *handle,
- 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;
- }
- 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);
- return NT_STATUS_NO_MEMORY;
- }
-
- status = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle,
- mapped_smb_fname,
- dosmode);
- if (NT_STATUS_IS_OK(status)) {
- smb_fname->st = mapped_smb_fname->st;
- }
-
- TALLOC_FREE(mapped_name);
- TALLOC_FREE(mapped_smb_fname);
-
- return status;
-}
-
static NTSTATUS catia_set_dos_attributes(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname,
uint32_t dosmode)
.strict_lock_check_fn = catia_strict_lock_check,
.translate_name_fn = catia_translate_name,
.fsctl_fn = catia_fsctl,
- .get_dos_attributes_fn = catia_get_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,
.set_dos_attributes_fn = catia_set_dos_attributes,
static bool vfswrap_is_offline(struct connection_struct *conn,
const struct smb_filename *fname);
-static NTSTATUS vfswrap_get_dos_attributes(struct vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- uint32_t *dosmode)
-{
- bool offline;
-
- offline = vfswrap_is_offline(handle->conn, smb_fname);
- if (offline) {
- *dosmode |= FILE_ATTRIBUTE_OFFLINE;
- }
-
- return get_ea_dos_attribute(handle->conn, smb_fname, dosmode);
-}
-
struct vfswrap_get_dos_attributes_state {
struct vfs_aio_state aio_state;
connection_struct *conn;
.fsctl_fn = vfswrap_fsctl,
.set_dos_attributes_fn = vfswrap_set_dos_attributes,
.fset_dos_attributes_fn = vfswrap_fset_dos_attributes,
- .get_dos_attributes_fn = vfswrap_get_dos_attributes,
.get_dos_attributes_send_fn = vfswrap_get_dos_attributes_send,
.get_dos_attributes_recv_fn = vfswrap_get_dos_attributes_recv,
.fget_dos_attributes_fn = vfswrap_fget_dos_attributes,
SMB_VFS_OP_SNAP_DELETE,
/* DOS attribute operations. */
- SMB_VFS_OP_GET_DOS_ATTRIBUTES,
SMB_VFS_OP_GET_DOS_ATTRIBUTES_SEND,
SMB_VFS_OP_GET_DOS_ATTRIBUTES_RECV,
SMB_VFS_OP_FGET_DOS_ATTRIBUTES,
{ SMB_VFS_OP_SNAP_CHECK_PATH, "snap_check_path" },
{ SMB_VFS_OP_SNAP_CREATE, "snap_create" },
{ SMB_VFS_OP_SNAP_DELETE, "snap_delete" },
- { SMB_VFS_OP_GET_DOS_ATTRIBUTES, "get_dos_attributes" },
{ 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" },
return status;
}
-static NTSTATUS smb_full_audit_get_dos_attributes(
- struct vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- uint32_t *dosmode)
-{
- NTSTATUS status;
-
- status = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle,
- smb_fname,
- dosmode);
-
- do_log(SMB_VFS_OP_GET_DOS_ATTRIBUTES,
- NT_STATUS_IS_OK(status),
- handle,
- "%s",
- smb_fname_str_do_log(handle->conn, smb_fname));
-
- return status;
-}
-
struct smb_full_audit_get_dos_attributes_state {
struct vfs_aio_state aio_state;
vfs_handle_struct *handle;
.strict_lock_check_fn = smb_full_audit_strict_lock_check,
.translate_name_fn = smb_full_audit_translate_name,
.fsctl_fn = smb_full_audit_fsctl,
- .get_dos_attributes_fn = smb_full_audit_get_dos_attributes,
.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,
return winattrs;
}
-static int get_dos_attr_with_capability(struct smb_filename *smb_fname,
- unsigned int *litemask,
- struct gpfs_iattr64 *iattr)
-{
- int saved_errno = 0;
- int ret;
-
- /*
- * According to MS-FSA 2.1.5.1.2.1 "Algorithm to Check Access to an
- * Existing File" FILE_LIST_DIRECTORY on a directory implies
- * FILE_READ_ATTRIBUTES for directory entries. Being able to stat() a
- * file implies FILE_LIST_DIRECTORY for the directory containing the
- * file.
- */
-
- if (!VALID_STAT(smb_fname->st)) {
- /*
- * Safety net: dos_mode() already checks this, but as we set
- * DAC_OVERRIDE_CAPABILITY based on this, add an additional
- * layer of defense.
- */
- DBG_ERR("Rejecting DAC override, invalid stat [%s]\n",
- smb_fname_str_dbg(smb_fname));
- errno = EACCES;
- return -1;
- }
-
- set_effective_capability(DAC_OVERRIDE_CAPABILITY);
-
- ret = gpfswrap_stat_x(smb_fname->base_name, litemask,
- iattr, sizeof(*iattr));
- if (ret == -1) {
- saved_errno = errno;
- }
-
- drop_effective_capability(DAC_OVERRIDE_CAPABILITY);
-
- if (saved_errno != 0) {
- errno = saved_errno;
- }
- return ret;
-}
-
static NTSTATUS vfs_gpfs_get_file_id(struct gpfs_iattr64 *iattr,
uint64_t *fileid)
{
return (struct timespec) { .tv_sec = g.tv_sec, .tv_nsec = g.tv_nsec };
}
-static NTSTATUS vfs_gpfs_get_dos_attributes(struct vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- uint32_t *dosmode)
-{
- struct gpfs_config_data *config;
- struct gpfs_iattr64 iattr = { };
- unsigned int litemask = 0;
- struct timespec ts;
- uint64_t file_id;
- NTSTATUS status;
- 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_GET_DOS_ATTRIBUTES(handle,
- smb_fname, dosmode);
- }
-
- ret = gpfswrap_stat_x(smb_fname->base_name, &litemask,
- &iattr, sizeof(iattr));
- if (ret == -1 && errno == ENOSYS) {
- return SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle, smb_fname,
- dosmode);
- }
- if (ret == -1 && errno == EACCES) {
- ret = get_dos_attr_with_capability(smb_fname, &litemask,
- &iattr);
- }
-
- if (ret == -1 && errno == EBADF) {
- /*
- * Returned for directory listings in gpfs root for
- * .. entry which steps out of gpfs.
- */
- DBG_DEBUG("Getting winattrs for %s returned EBADF.\n",
- smb_fname->base_name);
- return map_nt_error_from_unix(errno);
- } else if (ret == -1) {
- DBG_WARNING("Getting winattrs failed for %s: %s\n",
- smb_fname->base_name, strerror(errno));
- return map_nt_error_from_unix(errno);
- }
-
- status = vfs_gpfs_get_file_id(&iattr, &file_id);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
-
- ts = gpfs_timestruc64_to_timespec(iattr.ia_createtime);
-
- *dosmode |= vfs_gpfs_winattrs_to_dosmode(iattr.ia_winflags);
- update_stat_ex_create_time(&smb_fname->st, ts);
- update_stat_ex_file_id(&smb_fname->st, file_id);
-
- return NT_STATUS_OK;
-}
-
static NTSTATUS vfs_gpfs_fget_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t *dosmode)
.kernel_flock_fn = vfs_gpfs_kernel_flock,
.linux_setlease_fn = vfs_gpfs_setlease,
.get_real_filename_fn = vfs_gpfs_get_real_filename,
- .get_dos_attributes_fn = vfs_gpfs_get_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,
.fget_dos_attributes_fn = vfs_gpfs_fget_dos_attributes,
return NT_STATUS_NOT_IMPLEMENTED;
}
-NTSTATUS vfs_not_implemented_get_dos_attributes(struct vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- uint32_t *dosmode)
-{
- return NT_STATUS_NOT_IMPLEMENTED;
-}
-
struct vfs_not_implemented_get_dos_attributes_state {
struct vfs_aio_state aio_state;
uint32_t dosmode;
.audit_file_fn = vfs_not_implemented_audit_file,
/* DOS attributes. */
- .get_dos_attributes_fn = vfs_not_implemented_get_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,
.fget_dos_attributes_fn = vfs_not_implemented_fget_dos_attributes,
FILE_SUPPORTS_REMOTE_STORAGE;
}
-static NTSTATUS offline_get_dos_attributes(struct vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- uint32_t *dosmode)
-{
- *dosmode |= FILE_ATTRIBUTE_OFFLINE;
- return SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle, smb_fname, dosmode);
-}
-
static NTSTATUS offline_fget_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t *dosmode)
static struct vfs_fn_pointers offline_fns = {
.fs_capabilities_fn = offline_fs_capabilities,
- .get_dos_attributes_fn = offline_get_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,
.fget_dos_attributes_fn = offline_fget_dos_attributes,
return result;
}
-static NTSTATUS smb_time_get_dos_attributes(struct vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- uint32_t *dosmode)
-{
- NTSTATUS result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_GET_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("get_dos_attributes",
- timediff,
- smb_fname->base_name);
- }
-
- return result;
-}
-
struct smb_time_audit_get_dos_attributes_state {
struct vfs_aio_state aio_state;
files_struct *dir_fsp;
.strict_lock_check_fn = smb_time_audit_strict_lock_check,
.translate_name_fn = smb_time_audit_translate_name,
.fsctl_fn = smb_time_audit_fsctl,
- .get_dos_attributes_fn = smb_time_get_dos_attributes,
.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,
return offline;
}
-static NTSTATUS tsmsm_get_dos_attributes(struct vfs_handle_struct *handle,
- struct smb_filename *fname,
- uint32_t *dosmode)
-{
- bool offline;
-
- offline = tsmsm_is_offline(handle, fname, &fname->st);
- if (offline) {
- *dosmode |= FILE_ATTRIBUTE_OFFLINE;
- }
-
- return SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle, fname, dosmode);
-}
-
static NTSTATUS tsmsm_fget_dos_attributes(struct vfs_handle_struct *handle,
files_struct *fsp,
uint32_t *dosmode)
.sendfile_fn = tsmsm_sendfile,
.set_dos_attributes_fn = tsmsm_set_dos_attributes,
.fset_dos_attributes_fn = tsmsm_fset_dos_attributes,
- .get_dos_attributes_fn = tsmsm_get_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,
.fget_dos_attributes_fn = tsmsm_fget_dos_attributes,
out_len);
}
-NTSTATUS smb_vfs_call_get_dos_attributes(struct vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- uint32_t *dosmode)
-{
- VFS_FIND(get_dos_attributes);
- return handle->fns->get_dos_attributes_fn(handle, smb_fname, dosmode);
-}
-
NTSTATUS smb_vfs_call_fget_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t *dosmode)