From: Noel Power Date: Wed, 3 Mar 2021 10:26:39 +0000 (+0000) Subject: VFS: Remove SMB_VFS_SET_DOS_ATTRIBUTE, no longer used X-Git-Tag: tevent-0.11.0~1253 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0332ddde1a1d583c4e7be871c51a4854278951fe;p=thirdparty%2Fsamba.git VFS: Remove SMB_VFS_SET_DOS_ATTRIBUTE, no longer used ------------------- / \ / REST \ / IN \ / PEACE \ / \ | | | SMB_VFS_SET_DOS_ATTRIBUTE | | | | | | 3 March | | 2021 | | | | | *| * * * * * | * _________)/\\_//(\/(/\)/\//\/\////\\/|_)_______ Signed-off-by: Noel Power Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Thu Apr 8 18:38:40 UTC 2021 on sn-devel-184 --- diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index b58cfaffd22..79ed98897be 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -766,13 +766,6 @@ static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle, 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) @@ -1088,7 +1081,6 @@ static struct vfs_fn_pointers skel_opaque_fns = { .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. */ diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 2a92cadd4e2..6c5e9002e16 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -1022,15 +1022,6 @@ static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle, 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) @@ -1395,7 +1386,6 @@ static struct vfs_fn_pointers skel_transparent_fns = { .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. */ diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 678db0b861f..d06a62e5151 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -1161,10 +1161,6 @@ struct vfs_fn_pointers { 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); @@ -1630,9 +1626,6 @@ NTSTATUS smb_vfs_call_fsctl(struct vfs_handle_struct *handle, 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); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index fe26c8fa347..9ec9330095a 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -414,10 +414,6 @@ #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) \ diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c index de291ba7c31..cb06a4de355 100644 --- a/source3/modules/vfs_catia.c +++ b/source3/modules/vfs_catia.c @@ -2075,47 +2075,6 @@ static NTSTATUS catia_readdir_attr(struct vfs_handle_struct *handle, 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, @@ -2246,7 +2205,6 @@ static struct vfs_fn_pointers vfs_catia_fns = { .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, diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index a3557fe2d14..58891a2c1c3 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1865,13 +1865,6 @@ static NTSTATUS vfswrap_fget_dos_attributes(struct vfs_handle_struct *handle, 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) @@ -3836,7 +3829,6 @@ static struct vfs_fn_pointers vfs_default_fns = { .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, diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index bbe5ea55dde..73e83909341 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -185,7 +185,6 @@ typedef enum _vfs_op_type { 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. */ @@ -323,7 +322,6 @@ static struct { { 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" }, @@ -2432,26 +2430,6 @@ static NTSTATUS smb_full_audit_fget_dos_attributes( 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, @@ -3028,7 +3006,6 @@ static struct vfs_fn_pointers vfs_full_audit_fns = { .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, diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 172194dbead..48c9c6d1439 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -1714,41 +1714,6 @@ static NTSTATUS vfs_gpfs_fget_dos_attributes(struct vfs_handle_struct *handle, 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) @@ -2619,7 +2584,6 @@ static struct vfs_fn_pointers vfs_gpfs_fns = { .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, diff --git a/source3/modules/vfs_not_implemented.c b/source3/modules/vfs_not_implemented.c index 2b4e534dffb..0163bed084e 100644 --- a/source3/modules/vfs_not_implemented.c +++ b/source3/modules/vfs_not_implemented.c @@ -770,13 +770,6 @@ NTSTATUS vfs_not_implemented_fget_dos_attributes(struct vfs_handle_struct *handl 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) @@ -1092,7 +1085,6 @@ static struct vfs_fn_pointers vfs_not_implemented_fns = { .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. */ diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 97e893b9ba4..212b2c76d9a 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -1975,30 +1975,6 @@ static NTSTATUS smb_time_fget_dos_attributes(struct vfs_handle_struct *handle, 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) @@ -2874,7 +2850,6 @@ static struct vfs_fn_pointers vfs_time_audit_fns = { .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, diff --git a/source3/modules/vfs_tsmsm.c b/source3/modules/vfs_tsmsm.c index eacbd0f59f0..eda25fa39e3 100644 --- a/source3/modules/vfs_tsmsm.c +++ b/source3/modules/vfs_tsmsm.c @@ -519,37 +519,6 @@ static NTSTATUS tsmsm_set_offline(struct vfs_handle_struct *handle, 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) @@ -590,7 +559,6 @@ static struct vfs_fn_pointers tsmsm_fns = { .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, diff --git a/source3/modules/vfs_vxfs.c b/source3/modules/vfs_vxfs.c index 6c6f92e1f52..adf687b58a5 100644 --- a/source3/modules/vfs_vxfs.c +++ b/source3/modules/vfs_vxfs.c @@ -661,52 +661,6 @@ static ssize_t vxfs_flistxattr(struct vfs_handle_struct *handle, 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) @@ -773,7 +727,6 @@ static struct vfs_fn_pointers vfs_vxfs_fns = { .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, diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 34d8474ff36..ed138514c22 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -2469,14 +2469,6 @@ NTSTATUS smb_vfs_call_fget_dos_attributes(struct vfs_handle_struct *handle, 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)