From c70ac29c5441073752da7384b7f3bf54c9986aa0 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 4 Apr 2012 08:34:25 +1000 Subject: s3-vfs: Remove unused lsetxattr call from VFS modules, system.c and configure If this is ever needed again, it would be more appropriate as an options argument to listxattr. Andrew Bartlett --- docs-xml/manpages-3/vfs_full_audit.8.xml | 1 - examples/VFS/skel_opaque.c | 7 ---- examples/VFS/skel_transparent.c | 6 --- source3/configure.in | 6 +-- source3/include/proto.h | 1 - source3/include/vfs.h | 3 +- source3/include/vfs_macros.h | 5 --- source3/lib/system.c | 64 -------------------------------- source3/modules/vfs_cap.c | 13 ------- source3/modules/vfs_catia.c | 24 ------------ source3/modules/vfs_default.c | 6 --- source3/modules/vfs_full_audit.c | 19 ---------- source3/modules/vfs_onefs_shadow_copy.c | 10 ----- source3/modules/vfs_shadow_copy2.c | 32 ---------------- source3/modules/vfs_time_audit.c | 23 ------------ source3/smbd/vfs.c | 9 ----- source3/wscript | 4 +- 17 files changed, 6 insertions(+), 227 deletions(-) diff --git a/docs-xml/manpages-3/vfs_full_audit.8.xml b/docs-xml/manpages-3/vfs_full_audit.8.xml index f142f87b9d..d70fbbf639 100644 --- a/docs-xml/manpages-3/vfs_full_audit.8.xml +++ b/docs-xml/manpages-3/vfs_full_audit.8.xml @@ -80,7 +80,6 @@ lock lremovexattr lseek - lsetxattr lstat mkdir mknod diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 50a8e2908c..e41895c611 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -711,12 +711,6 @@ static int skel_setxattr(vfs_handle_struct *handle, const char *path, const char return -1; } -static int skel_lsetxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) -{ - errno = ENOSYS; - return -1; -} - static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) { errno = ENOSYS; @@ -907,7 +901,6 @@ struct vfs_fn_pointers skel_opaque_fns = { .lremovexattr_fn = skel_lremovexattr, .fremovexattr_fn = skel_fremovexattr, .setxattr_fn = skel_setxattr, - .lsetxattr_fn = skel_lsetxattr, .fsetxattr_fn = skel_fsetxattr, /* aio operations */ diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 932888e2de..5aa3bbb271 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -681,11 +681,6 @@ static int skel_setxattr(vfs_handle_struct *handle, const char *path, const char return SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size, flags); } -static int skel_lsetxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) -{ - return SMB_VFS_NEXT_LSETXATTR(handle, path, name, value, size, flags); -} - static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) { return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags); @@ -865,7 +860,6 @@ struct vfs_fn_pointers skel_transparent_fns = { .lremovexattr_fn = skel_lremovexattr, .fremovexattr_fn = skel_fremovexattr, .setxattr_fn = skel_setxattr, - .lsetxattr_fn = skel_lsetxattr, .fsetxattr_fn = skel_fsetxattr, /* aio operations */ diff --git a/source3/configure.in b/source3/configure.in index c4f724b17d..c369479226 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -1301,16 +1301,16 @@ case "$host_os" in *) AC_SEARCH_LIBS(getxattr, [attr]) AC_CHECK_FUNCS(getxattr,[ - AC_CHECK_FUNCS(fgetxattr listxattr flistxattr removexattr lremovexattr fremovexattr setxattr lsetxattr fsetxattr) + AC_CHECK_FUNCS(fgetxattr listxattr flistxattr removexattr lremovexattr fremovexattr setxattr fsetxattr) ]) AC_CHECK_FUNCS(getea,[ - AC_CHECK_FUNCS(fgetea lgetea listea flistea removeea fremoveea lremoveea setea fsetea lsetea) + AC_CHECK_FUNCS(fgetea lgetea listea flistea removeea fremoveea lremoveea setea fsetea) ]) AC_CHECK_FUNCS(attr_get,[ AC_CHECK_FUNCS(attr_list attr_set attr_remove attr_getf attr_listf attr_setf attr_removef) ]) AC_CHECK_FUNCS(extattr_delete_file,[ - AC_CHECK_FUNCS(extattr_delete_fd extattr_delete_link extattr_get_fd extattr_get_file extattr_get_link extattr_list_fd extattr_list_file extattr_list_link extattr_set_fd extattr_set_file extattr_set_link) + AC_CHECK_FUNCS(extattr_delete_fd extattr_delete_link extattr_get_fd extattr_get_file extattr_get_link extattr_list_fd extattr_list_file extattr_list_link extattr_set_fd extattr_set_file) ]) ;; esac diff --git a/source3/include/proto.h b/source3/include/proto.h index 5bfd05cb53..b4b91e2b18 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -358,7 +358,6 @@ int sys_removexattr (const char *path, const char *name); int sys_lremovexattr (const char *path, const char *name); int sys_fremovexattr (int filedes, const char *name); int sys_setxattr (const char *path, const char *name, const void *value, size_t size, int flags); -int sys_lsetxattr (const char *path, const char *name, const void *value, size_t size, int flags); int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags); uint32 unix_dev_major(SMB_DEV_T dev); uint32 unix_dev_minor(SMB_DEV_T dev); diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 258bec9275..0e42a3e812 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -138,7 +138,7 @@ /* Bump to version 29 - Samba 3.6.0 will ship with interface version 28. */ /* Leave at 29 - not yet releases. Add fsctl. Richard Sharpe */ /* Leave at 29 - not yet released. add SMB_VFS_GET_DFS_REFERRAL() - metze */ -/* Leave at 29 - not yet released. Remove llistxattr and lgetxattr - abartlet */ +/* Leave at 29 - not yet released. Remove l{list,get,set,remove}xattr - abartlet */ #define SMB_VFS_INTERFACE_VERSION 29 /* @@ -406,7 +406,6 @@ struct vfs_fn_pointers { int (*lremovexattr_fn)(struct vfs_handle_struct *handle, const char *path, const char *name); int (*fremovexattr_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name); int (*setxattr_fn)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags); - int (*lsetxattr_fn)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags); int (*fsetxattr_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags); /* aio operations */ diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 6af662c1f4..e568ed0f49 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -554,11 +554,6 @@ #define SMB_VFS_NEXT_SETXATTR(handle,path,name,value,size,flags) \ smb_vfs_call_setxattr((handle)->next,(path),(name),(value),(size),(flags)) -#define SMB_VFS_LSETXATTR(conn,path,name,value,size,flags) \ - smb_vfs_call_lsetxattr((conn)->vfs_handles,(path),(name),(value),(size),(flags)) -#define SMB_VFS_NEXT_LSETXATTR(handle,path,name,value,size,flags) \ - smb_vfs_call_lsetxattr((handle)->next,(path),(name),(value),(size),(flags)) - #define SMB_VFS_FSETXATTR(fsp,name,value,size,flags) \ smb_vfs_call_fsetxattr((fsp)->conn->vfs_handles, (fsp), (name),(value),(size),(flags)) #define SMB_VFS_NEXT_FSETXATTR(handle,fsp,name,value,size,flags) \ diff --git a/source3/lib/system.c b/source3/lib/system.c index ed5cf0cec8..abebb43915 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -1821,70 +1821,6 @@ int sys_setxattr (const char *path, const char *name, const void *value, size_t #endif } -int sys_lsetxattr (const char *path, const char *name, const void *value, size_t size, int flags) -{ -#if defined(HAVE_LSETXATTR) - return lsetxattr(path, name, value, size, flags); -#elif defined(HAVE_SETXATTR) && defined(XATTR_ADD_OPT) - int options = XATTR_NOFOLLOW; - return setxattr(path, name, value, size, 0, options); -#elif defined(LSETEA) - return lsetea(path, name, value, size, flags); -#elif defined(HAVE_EXTATTR_SET_LINK) - char *s; - int retval = 0; - int attrnamespace = (strncmp(name, "system", 6) == 0) ? - EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER; - const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1; - if (flags) { - /* Check attribute existence */ - retval = extattr_get_link(path, attrnamespace, attrname, NULL, 0); - if (retval < 0) { - /* REPLACE attribute, that doesn't exist */ - if (flags & XATTR_REPLACE && errno == ENOATTR) { - errno = ENOATTR; - return -1; - } - /* Ignore other errors */ - } - else { - /* CREATE attribute, that already exists */ - if (flags & XATTR_CREATE) { - errno = EEXIST; - return -1; - } - } - } - - retval = extattr_set_link(path, attrnamespace, attrname, value, size); - return (retval < 0) ? -1 : 0; -#elif defined(HAVE_ATTR_SET) - int myflags = ATTR_DONTFOLLOW; - char *attrname = strchr(name,'.') + 1; - - if (strncmp(name, "system", 6) == 0) myflags |= ATTR_ROOT; - if (flags & XATTR_CREATE) myflags |= ATTR_CREATE; - if (flags & XATTR_REPLACE) myflags |= ATTR_REPLACE; - - return attr_set(path, attrname, (const char *)value, size, myflags); -#elif defined(HAVE_ATTROPEN) - int ret = -1; - int myflags = O_RDWR | AT_SYMLINK_NOFOLLOW; - int attrfd; - if (flags & XATTR_CREATE) myflags |= O_EXCL; - if (!(flags & XATTR_REPLACE)) myflags |= O_CREAT; - attrfd = solaris_attropen(path, name, myflags, (mode_t) SOLARIS_ATTRMODE); - if (attrfd >= 0) { - ret = solaris_write_xattr(attrfd, value, size); - close(attrfd); - } - return ret; -#else - errno = ENOSYS; - return -1; -#endif -} - int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags) { #if defined(HAVE_FSETXATTR) diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 125b5f43da..406126cade 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -523,18 +523,6 @@ static int cap_setxattr(vfs_handle_struct *handle, const char *path, const char return SMB_VFS_NEXT_SETXATTR(handle, cappath, capname, value, size, flags); } -static int cap_lsetxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) -{ - char *cappath = capencode(talloc_tos(), path); - char *capname = capencode(talloc_tos(), name); - - if (!cappath || !capname) { - errno = ENOMEM; - return -1; - } - return SMB_VFS_NEXT_LSETXATTR(handle, cappath, capname, value, size, flags); -} - static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *path, const void *value, size_t size, int flags) { char *cappath = capencode(talloc_tos(), path); @@ -578,7 +566,6 @@ static struct vfs_fn_pointers vfs_cap_fns = { .lremovexattr_fn = cap_lremovexattr, .fremovexattr_fn = cap_fremovexattr, .setxattr_fn = cap_setxattr, - .lsetxattr_fn = cap_lsetxattr, .fsetxattr_fn = cap_fsetxattr }; diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c index 687547dc17..6979dc6c8d 100644 --- a/source3/modules/vfs_catia.c +++ b/source3/modules/vfs_catia.c @@ -919,29 +919,6 @@ catia_setxattr(vfs_handle_struct *handle, const char *path, return ret; } -static int -catia_lsetxattr(vfs_handle_struct *handle, const char *path, - const char *name, const void *value, size_t size, - int flags) -{ - char *mapped_name = NULL; - NTSTATUS status; - ssize_t ret; - - status = catia_string_replace_allocate(handle->conn, - name, &mapped_name, vfs_translate_to_unix); - if (!NT_STATUS_IS_OK(status)) { - errno = map_errno_from_nt_status(status); - return -1; - } - - - ret = SMB_VFS_NEXT_LSETXATTR(handle, path, mapped_name, value, size, flags); - TALLOC_FREE(mapped_name); - - return ret; -} - static struct vfs_fn_pointers vfs_catia_fns = { .mkdir_fn = catia_mkdir, .rmdir_fn = catia_rmdir, @@ -969,7 +946,6 @@ static struct vfs_fn_pointers vfs_catia_fns = { .removexattr_fn = catia_removexattr, .lremovexattr_fn = catia_lremovexattr, .setxattr_fn = catia_setxattr, - .lsetxattr_fn = catia_lsetxattr, }; NTSTATUS vfs_catia_init(void) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index a7abe0ba42..08ad80f8d3 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -2043,11 +2043,6 @@ static int vfswrap_setxattr(struct vfs_handle_struct *handle, const char *path, return sys_setxattr(path, name, value, size, flags); } -static int vfswrap_lsetxattr(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) -{ - return sys_lsetxattr(path, name, value, size, flags); -} - static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) { return sys_fsetxattr(fsp->fh->fd, name, value, size, flags); @@ -2276,7 +2271,6 @@ static struct vfs_fn_pointers vfs_default_fns = { .lremovexattr_fn = vfswrap_lremovexattr, .fremovexattr_fn = vfswrap_fremovexattr, .setxattr_fn = vfswrap_setxattr, - .lsetxattr_fn = vfswrap_lsetxattr, .fsetxattr_fn = vfswrap_fsetxattr, /* aio operations */ diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 8c7e0f36cc..73e41ed265 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -198,7 +198,6 @@ typedef enum _vfs_op_type { SMB_VFS_OP_LREMOVEXATTR, SMB_VFS_OP_FREMOVEXATTR, SMB_VFS_OP_SETXATTR, - SMB_VFS_OP_LSETXATTR, SMB_VFS_OP_FSETXATTR, /* aio operations */ @@ -327,7 +326,6 @@ static struct { { SMB_VFS_OP_LREMOVEXATTR, "lremovexattr" }, { SMB_VFS_OP_FREMOVEXATTR, "fremovexattr" }, { SMB_VFS_OP_SETXATTR, "setxattr" }, - { SMB_VFS_OP_LSETXATTR, "lsetxattr" }, { SMB_VFS_OP_FSETXATTR, "fsetxattr" }, { SMB_VFS_OP_AIO_READ, "aio_read" }, { SMB_VFS_OP_AIO_WRITE, "aio_write" }, @@ -2068,22 +2066,6 @@ static int smb_full_audit_setxattr(struct vfs_handle_struct *handle, return result; } -static int smb_full_audit_lsetxattr(struct vfs_handle_struct *handle, - const char *path, - const char *name, const void *value, size_t size, - int flags) -{ - int result; - - result = SMB_VFS_NEXT_LSETXATTR(handle, path, name, value, size, - flags); - - do_log(SMB_VFS_OP_LSETXATTR, (result >= 0), handle, - "%s|%s", path, name); - - return result; -} - static int smb_full_audit_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) @@ -2315,7 +2297,6 @@ static struct vfs_fn_pointers vfs_full_audit_fns = { .lremovexattr_fn = smb_full_audit_lremovexattr, .fremovexattr_fn = smb_full_audit_fremovexattr, .setxattr_fn = smb_full_audit_setxattr, - .lsetxattr_fn = smb_full_audit_lsetxattr, .fsetxattr_fn = smb_full_audit_fsetxattr, .aio_read_fn = smb_full_audit_aio_read, .aio_write_fn = smb_full_audit_aio_write, diff --git a/source3/modules/vfs_onefs_shadow_copy.c b/source3/modules/vfs_onefs_shadow_copy.c index 410859a046..531f9b4b83 100644 --- a/source3/modules/vfs_onefs_shadow_copy.c +++ b/source3/modules/vfs_onefs_shadow_copy.c @@ -605,16 +605,6 @@ onefs_shadow_copy_setxattr(vfs_handle_struct *handle, const char *path, int); } -static int -onefs_shadow_copy_lsetxattr(vfs_handle_struct *handle, const char *path, - const char *name, const void *value, size_t size, - int flags) -{ - SHADOW_NEXT(LSETXATTR, - (handle, cpath ?: path, name, value, size, flags), - int); -} - static bool onefs_shadow_copy_is_offline(struct vfs_handle_struct *handle, const struct smb_fname *fname, diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 441a68a30c..544baa44f7 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -1435,37 +1435,6 @@ static int shadow_copy2_setxattr(struct vfs_handle_struct *handle, return ret; } -static int shadow_copy2_lsetxattr(struct vfs_handle_struct *handle, - const char *fname, - const char *aname, const void *value, - size_t size, int flags) -{ - time_t timestamp; - char *stripped; - ssize_t ret; - int saved_errno; - char *conv; - - if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname, - ×tamp, &stripped)) { - return -1; - } - if (timestamp == 0) { - return SMB_VFS_NEXT_LSETXATTR(handle, fname, aname, value, - size, flags); - } - conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp); - TALLOC_FREE(stripped); - if (conv == NULL) { - return -1; - } - ret = SMB_VFS_NEXT_LSETXATTR(handle, conv, aname, value, size, flags); - saved_errno = errno; - TALLOC_FREE(conv); - errno = saved_errno; - return ret; -} - static int shadow_copy2_chmod_acl(vfs_handle_struct *handle, const char *fname, mode_t mode) { @@ -1563,7 +1532,6 @@ static struct vfs_fn_pointers vfs_shadow_copy2_fns = { .removexattr_fn = shadow_copy2_removexattr, .lremovexattr_fn = shadow_copy2_lremovexattr, .setxattr_fn = shadow_copy2_setxattr, - .lsetxattr_fn = shadow_copy2_lsetxattr, .chmod_acl_fn = shadow_copy2_chmod_acl, .chflags_fn = shadow_copy2_chflags, .get_real_filename_fn = shadow_copy2_get_real_filename, diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 4064bccfbc..747fc79bd2 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -2093,28 +2093,6 @@ static int smb_time_audit_setxattr(struct vfs_handle_struct *handle, return result; } -static int smb_time_audit_lsetxattr(struct vfs_handle_struct *handle, - const char *path, const char *name, - const void *value, size_t size, - int flags) -{ - int result; - struct timespec ts1,ts2; - double timediff; - - clock_gettime_mono(&ts1); - result = SMB_VFS_NEXT_LSETXATTR(handle, path, name, value, size, - flags); - clock_gettime_mono(&ts2); - timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9; - - if (timediff > audit_timeout) { - smb_time_audit_log("lsetxattr", timediff); - } - - return result; -} - static int smb_time_audit_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) @@ -2401,7 +2379,6 @@ static struct vfs_fn_pointers vfs_time_audit_fns = { .lremovexattr_fn = smb_time_audit_lremovexattr, .fremovexattr_fn = smb_time_audit_fremovexattr, .setxattr_fn = smb_time_audit_setxattr, - .lsetxattr_fn = smb_time_audit_lsetxattr, .fsetxattr_fn = smb_time_audit_fsetxattr, .aio_read_fn = smb_time_audit_aio_read, .aio_write_fn = smb_time_audit_aio_write, diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 2c5a0b8a89..923bd7c9a2 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -2202,15 +2202,6 @@ int smb_vfs_call_setxattr(struct vfs_handle_struct *handle, const char *path, return handle->fns->setxattr_fn(handle, path, name, value, size, flags); } -int smb_vfs_call_lsetxattr(struct vfs_handle_struct *handle, const char *path, - const char *name, const void *value, size_t size, - int flags) -{ - VFS_FIND(lsetxattr); - return handle->fns->lsetxattr_fn(handle, path, name, value, size, - flags); -} - int smb_vfs_call_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) diff --git a/source3/wscript b/source3/wscript index 3eabed0e43..62f777fc54 100644 --- a/source3/wscript +++ b/source3/wscript @@ -232,7 +232,7 @@ __closedir crypt16 delproplist devnm dgettext dirfd DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl extattr_delete_fd extattr_delete_link extattr_get_fd extattr_get_file extattr_get_link extattr_list_fd extattr_list_file extattr_list_link -extattr_set_fd extattr_set_file extattr_set_link _facl __facl _fchdir +extattr_set_fd extattr_set_file _facl __facl _fchdir __fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr _fork __fork fremoveea fremovexattr fseeko fsetea @@ -244,7 +244,7 @@ getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext glob grantpt hstrerror initgroups innetgr inotify_init listea listxattr llseek _llseek __llseek lremoveea lremovexattr _lseek __lseek -lsetea lsetxattr _lstat __lstat lutimes +_lstat __lstat lutimes __lxstat memalign mknod mlock mlockall munlock munlockall _open __open _opendir __opendir pathconf poll posix_fallocate -- cgit