summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-06-01 13:29:38 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-06-02 02:13:49 +0200
commitc290cdb9349220ba70b54143e1432da0230e2cee (patch)
tree4ebf0aa557376557eaec362eaa14f587c53ea1ec /source3
parent664af060ac9ea83b565fbb817bb63d67d83843ef (diff)
downloadsamba-c290cdb9349220ba70b54143e1432da0230e2cee.tar.gz
samba-c290cdb9349220ba70b54143e1432da0230e2cee.tar.bz2
samba-c290cdb9349220ba70b54143e1432da0230e2cee.zip
lib/replace: xattr wrappers in lib/replace rather than source3/lib/system.c
This also moves all the still-used configure tests etc. The unused OSF API is also removed at this time. Andrew Bartlett
Diffstat (limited to 'source3')
-rw-r--r--source3/configure.in59
-rw-r--r--source3/include/includes.h23
-rw-r--r--source3/lib/system.c678
-rw-r--r--source3/modules/vfs_default.c16
-rwxr-xr-xsource3/wscript33
5 files changed, 19 insertions, 790 deletions
diff --git a/source3/configure.in b/source3/configure.in
index 06b51dba6e..af0f7c85be 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -668,9 +668,6 @@ AC_CHECK_HEADERS(shadow.h)
AC_CHECK_HEADERS(nss.h nss_common.h nsswitch.h ns_api.h sys/security.h)
AC_CHECK_HEADERS(syscall.h sys/syscall.h)
-AC_CHECK_HEADERS(sys/attributes.h attr/xattr.h sys/xattr.h sys/extattr.h sys/uio.h)
-AC_CHECK_HEADERS(sys/ea.h sys/proplist.h)
-
AC_CHECK_HEADERS(sys/cdefs.h glob.h)
# For experimental utmp support (lastlog on some BSD-like systems)
@@ -1259,62 +1256,6 @@ AC_LIBTESTFUNC(sec, getprpwnam)
AC_CHECK_FUNCS(strsignal)
-############################################
-# Check for EA implementations
-case "$host_os" in
- *osf*)
- AC_SEARCH_LIBS(getproplist, [proplist])
- AC_CHECK_FUNCS(getproplist fgetproplist setproplist fsetproplist)
- AC_CHECK_FUNCS(delproplist fdelproplist add_proplist_entry get_proplist_entry)
- AC_CHECK_FUNCS(sizeof_proplist_entry)
- ;;
- *freebsd4* | *dragonfly* )
- AC_DEFINE(BROKEN_EXTATTR, 1, [Does extattr API work])
- ;;
- *solaris*)
- AC_CHECK_FUNCS(attropen)
- ;;
- *)
- AC_SEARCH_LIBS(getxattr, [attr])
- AC_CHECK_FUNCS(getxattr,[
- AC_CHECK_FUNCS(fgetxattr listxattr flistxattr removexattr fremovexattr setxattr fsetxattr)
- ])
- AC_CHECK_FUNCS(getea,[
- AC_CHECK_FUNCS(fgetea listea flistea removeea fremoveea 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_get_fd extattr_get_file extattr_list_fd extattr_list_file extattr_set_fd extattr_set_file)
- ])
- ;;
-esac
-
-########################################################
-# Do xattr functions take additional options like on Darwin?
-if test x"$ac_cv_func_getxattr" = x"yes" ; then
- AC_CACHE_CHECK([whether xattr interface takes additional options], smb_attr_cv_xattr_add_opt, [
- old_LIBS=$LIBS
- LIBS="$LIBS $ACL_LIBS"
- AC_TRY_COMPILE([
- #include <sys/types.h>
- #if HAVE_ATTR_XATTR_H
- #include <attr/xattr.h>
- #elif HAVE_SYS_XATTR_H
- #include <sys/xattr.h>
- #endif
- ],[
- getxattr(0, 0, 0, 0, 0, 0);
- ],
- [smb_attr_cv_xattr_add_opt=yes],
- [smb_attr_cv_xattr_add_opt=no;LIBS=$old_LIBS])
- ])
- if test x"$smb_attr_cv_xattr_add_opt" = x"yes"; then
- AC_DEFINE(XATTR_ADD_OPT, 1, [xattr functions have additional options])
- fi
-fi
-
AC_DISABLE_STATIC
AC_ENABLE_SHARED
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 88b8b4fef2..f25d1c2fcf 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -137,21 +137,6 @@
#endif
#endif
-/* mutually exclusive (SuSE 8.2) */
-#if HAVE_ATTR_XATTR_H
-#include <attr/xattr.h>
-#elif HAVE_SYS_XATTR_H
-#include <sys/xattr.h>
-#endif
-
-#ifdef HAVE_SYS_EA_H
-#include <sys/ea.h>
-#endif
-
-#ifdef HAVE_SYS_EXTATTR_H
-#include <sys/extattr.h>
-#endif
-
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
@@ -501,14 +486,6 @@ char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...) PRINTF_ATT
#define VXFS_QUOTA
#endif
-#ifndef XATTR_CREATE
-#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
-#endif
-
-#ifndef XATTR_REPLACE
-#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
-#endif
-
#ifdef TRUE
#undef TRUE
#endif
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 8a0b0f154e..8c1ae94e19 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -1292,684 +1292,6 @@ int sys_pclose(int fd)
SAFE_FREE(msgbuf);
}
-/******** Solaris EA helper function prototypes ********/
-#ifdef HAVE_ATTROPEN
-#define SOLARIS_ATTRMODE S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP
-static int solaris_write_xattr(int attrfd, const char *value, size_t size);
-static ssize_t solaris_read_xattr(int attrfd, void *value, size_t size);
-static ssize_t solaris_list_xattr(int attrdirfd, char *list, size_t size);
-static int solaris_unlinkat(int attrdirfd, const char *name);
-static int solaris_attropen(const char *path, const char *attrpath, int oflag, mode_t mode);
-static int solaris_openat(int fildes, const char *path, int oflag, mode_t mode);
-#endif
-
-/**************************************************************************
- Wrappers for extented attribute calls. Based on the Linux package with
- support for IRIX and (Net|Free)BSD also. Expand as other systems have them.
-****************************************************************************/
-
-ssize_t sys_getxattr (const char *path, const char *name, void *value, size_t size)
-{
-#if defined(HAVE_GETXATTR)
-#ifndef XATTR_ADD_OPT
- return getxattr(path, name, value, size);
-#else
- int options = 0;
- return getxattr(path, name, value, size, 0, options);
-#endif
-#elif defined(HAVE_GETEA)
- return getea(path, name, value, size);
-#elif defined(HAVE_EXTATTR_GET_FILE)
- char *s;
- ssize_t retval;
- int attrnamespace = (strncmp(name, "system", 6) == 0) ?
- EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
- const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
- /*
- * The BSD implementation has a nasty habit of silently truncating
- * the returned value to the size of the buffer, so we have to check
- * that the buffer is large enough to fit the returned value.
- */
- if((retval=extattr_get_file(path, attrnamespace, attrname, NULL, 0)) >= 0) {
- if(retval > size) {
- errno = ERANGE;
- return -1;
- }
- if((retval=extattr_get_file(path, attrnamespace, attrname, value, size)) >= 0)
- return retval;
- }
-
- DEBUG(10,("sys_getxattr: extattr_get_file() failed with: %s\n", strerror(errno)));
- return -1;
-#elif defined(HAVE_ATTR_GET)
- int retval, flags = 0;
- int valuelength = (int)size;
- char *attrname = strchr(name,'.') + 1;
-
- if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT;
-
- retval = attr_get(path, attrname, (char *)value, &valuelength, flags);
-
- return retval ? retval : valuelength;
-#elif defined(HAVE_ATTROPEN)
- ssize_t ret = -1;
- int attrfd = solaris_attropen(path, name, O_RDONLY, 0);
- if (attrfd >= 0) {
- ret = solaris_read_xattr(attrfd, value, size);
- close(attrfd);
- }
- return ret;
-#else
- errno = ENOSYS;
- return -1;
-#endif
-}
-
-ssize_t sys_fgetxattr (int filedes, const char *name, void *value, size_t size)
-{
-#if defined(HAVE_FGETXATTR)
-#ifndef XATTR_ADD_OPT
- return fgetxattr(filedes, name, value, size);
-#else
- int options = 0;
- return fgetxattr(filedes, name, value, size, 0, options);
-#endif
-#elif defined(HAVE_FGETEA)
- return fgetea(filedes, name, value, size);
-#elif defined(HAVE_EXTATTR_GET_FD)
- char *s;
- ssize_t retval;
- 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((retval=extattr_get_fd(filedes, attrnamespace, attrname, NULL, 0)) >= 0) {
- if(retval > size) {
- errno = ERANGE;
- return -1;
- }
- if((retval=extattr_get_fd(filedes, attrnamespace, attrname, value, size)) >= 0)
- return retval;
- }
-
- DEBUG(10,("sys_fgetxattr: extattr_get_fd() failed with: %s\n", strerror(errno)));
- return -1;
-#elif defined(HAVE_ATTR_GETF)
- int retval, flags = 0;
- int valuelength = (int)size;
- char *attrname = strchr(name,'.') + 1;
-
- if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT;
-
- retval = attr_getf(filedes, attrname, (char *)value, &valuelength, flags);
-
- return retval ? retval : valuelength;
-#elif defined(HAVE_ATTROPEN)
- ssize_t ret = -1;
- int attrfd = solaris_openat(filedes, name, O_RDONLY|O_XATTR, 0);
- if (attrfd >= 0) {
- ret = solaris_read_xattr(attrfd, value, size);
- close(attrfd);
- }
- return ret;
-#else
- errno = ENOSYS;
- return -1;
-#endif
-}
-
-#if defined(HAVE_EXTATTR_LIST_FILE)
-
-#define EXTATTR_PREFIX(s) (s), (sizeof((s))-1)
-
-static struct {
- int space;
- const char *name;
- size_t len;
-}
-extattr[] = {
- { EXTATTR_NAMESPACE_SYSTEM, EXTATTR_PREFIX("system.") },
- { EXTATTR_NAMESPACE_USER, EXTATTR_PREFIX("user.") },
-};
-
-typedef union {
- const char *path;
- int filedes;
-} extattr_arg;
-
-static ssize_t bsd_attr_list (int type, extattr_arg arg, char *list, size_t size)
-{
- ssize_t list_size, total_size = 0;
- int i, t, len;
- char *buf;
- /* Iterate through extattr(2) namespaces */
- for(t = 0; t < ARRAY_SIZE(extattr); t++) {
- switch(type) {
-#if defined(HAVE_EXTATTR_LIST_FILE)
- case 0:
- list_size = extattr_list_file(arg.path, extattr[t].space, list, size);
- break;
-#endif
-#if defined(HAVE_EXTATTR_LIST_LINK)
- case 1:
- list_size = extattr_list_link(arg.path, extattr[t].space, list, size);
- break;
-#endif
-#if defined(HAVE_EXTATTR_LIST_FD)
- case 2:
- list_size = extattr_list_fd(arg.filedes, extattr[t].space, list, size);
- break;
-#endif
- default:
- errno = ENOSYS;
- return -1;
- }
- /* Some error happend. Errno should be set by the previous call */
- if(list_size < 0)
- return -1;
- /* No attributes */
- if(list_size == 0)
- continue;
- /* XXX: Call with an empty buffer may be used to calculate
- necessary buffer size. Unfortunately, we can't say, how
- many attributes were returned, so here is the potential
- problem with the emulation.
- */
- if(list == NULL) {
- /* Take the worse case of one char attribute names -
- two bytes per name plus one more for sanity.
- */
- total_size += list_size + (list_size/2 + 1)*extattr[t].len;
- continue;
- }
- /* Count necessary offset to fit namespace prefixes */
- len = 0;
- for(i = 0; i < list_size; i += list[i] + 1)
- len += extattr[t].len;
-
- total_size += list_size + len;
- /* Buffer is too small to fit the results */
- if(total_size > size) {
- errno = ERANGE;
- return -1;
- }
- /* Shift results back, so we can prepend prefixes */
- buf = (char *)memmove(list + len, list, list_size);
-
- for(i = 0; i < list_size; i += len + 1) {
- len = buf[i];
- strncpy(list, extattr[t].name, extattr[t].len + 1);
- list += extattr[t].len;
- strncpy(list, buf + i + 1, len);
- list[len] = '\0';
- list += len + 1;
- }
- size -= total_size;
- }
- return total_size;
-}
-
-#endif
-
-#if defined(HAVE_ATTR_LIST) && defined(HAVE_SYS_ATTRIBUTES_H)
-static char attr_buffer[ATTR_MAX_VALUELEN];
-
-static ssize_t irix_attr_list(const char *path, int filedes, char *list, size_t size, int flags)
-{
- int retval = 0, index;
- attrlist_cursor_t *cursor = 0;
- int total_size = 0;
- attrlist_t * al = (attrlist_t *)attr_buffer;
- attrlist_ent_t *ae;
- size_t ent_size, left = size;
- char *bp = list;
-
- while (True) {
- if (filedes)
- retval = attr_listf(filedes, attr_buffer, ATTR_MAX_VALUELEN, flags, cursor);
- else
- retval = attr_list(path, attr_buffer, ATTR_MAX_VALUELEN, flags, cursor);
- if (retval) break;
- for (index = 0; index < al->al_count; index++) {
- ae = ATTR_ENTRY(attr_buffer, index);
- ent_size = strlen(ae->a_name) + sizeof("user.");
- if (left >= ent_size) {
- strncpy(bp, "user.", sizeof("user."));
- strncat(bp, ae->a_name, ent_size - sizeof("user."));
- bp += ent_size;
- left -= ent_size;
- } else if (size) {
- errno = ERANGE;
- retval = -1;
- break;
- }
- total_size += ent_size;
- }
- if (al->al_more == 0) break;
- }
- if (retval == 0) {
- flags |= ATTR_ROOT;
- cursor = 0;
- while (True) {
- if (filedes)
- retval = attr_listf(filedes, attr_buffer, ATTR_MAX_VALUELEN, flags, cursor);
- else
- retval = attr_list(path, attr_buffer, ATTR_MAX_VALUELEN, flags, cursor);
- if (retval) break;
- for (index = 0; index < al->al_count; index++) {
- ae = ATTR_ENTRY(attr_buffer, index);
- ent_size = strlen(ae->a_name) + sizeof("system.");
- if (left >= ent_size) {
- strncpy(bp, "system.", sizeof("system."));
- strncat(bp, ae->a_name, ent_size - sizeof("system."));
- bp += ent_size;
- left -= ent_size;
- } else if (size) {
- errno = ERANGE;
- retval = -1;
- break;
- }
- total_size += ent_size;
- }
- if (al->al_more == 0) break;
- }
- }
- return (ssize_t)(retval ? retval : total_size);
-}
-
-#endif
-
-ssize_t sys_listxattr (const char *path, char *list, size_t size)
-{
-#if defined(HAVE_LISTXATTR)
-#ifndef XATTR_ADD_OPT
- return listxattr(path, list, size);
-#else
- int options = 0;
- return listxattr(path, list, size, options);
-#endif
-#elif defined(HAVE_LISTEA)
- return listea(path, list, size);
-#elif defined(HAVE_EXTATTR_LIST_FILE)
- extattr_arg arg;
- arg.path = path;
- return bsd_attr_list(0, arg, list, size);
-#elif defined(HAVE_ATTR_LIST) && defined(HAVE_SYS_ATTRIBUTES_H)
- return irix_attr_list(path, 0, list, size, 0);
-#elif defined(HAVE_ATTROPEN)
- ssize_t ret = -1;
- int attrdirfd = solaris_attropen(path, ".", O_RDONLY, 0);
- if (attrdirfd >= 0) {
- ret = solaris_list_xattr(attrdirfd, list, size);
- close(attrdirfd);
- }
- return ret;
-#else
- errno = ENOSYS;
- return -1;
-#endif
-}
-
-ssize_t sys_flistxattr (int filedes, char *list, size_t size)
-{
-#if defined(HAVE_FLISTXATTR)
-#ifndef XATTR_ADD_OPT
- return flistxattr(filedes, list, size);
-#else
- int options = 0;
- return flistxattr(filedes, list, size, options);
-#endif
-#elif defined(HAVE_FLISTEA)
- return flistea(filedes, list, size);
-#elif defined(HAVE_EXTATTR_LIST_FD)
- extattr_arg arg;
- arg.filedes = filedes;
- return bsd_attr_list(2, arg, list, size);
-#elif defined(HAVE_ATTR_LISTF)
- return irix_attr_list(NULL, filedes, list, size, 0);
-#elif defined(HAVE_ATTROPEN)
- ssize_t ret = -1;
- int attrdirfd = solaris_openat(filedes, ".", O_RDONLY|O_XATTR, 0);
- if (attrdirfd >= 0) {
- ret = solaris_list_xattr(attrdirfd, list, size);
- close(attrdirfd);
- }
- return ret;
-#else
- errno = ENOSYS;
- return -1;
-#endif
-}
-
-int sys_removexattr (const char *path, const char *name)
-{
-#if defined(HAVE_REMOVEXATTR)
-#ifndef XATTR_ADD_OPT
- return removexattr(path, name);
-#else
- int options = 0;
- return removexattr(path, name, options);
-#endif
-#elif defined(HAVE_REMOVEEA)
- return removeea(path, name);
-#elif defined(HAVE_EXTATTR_DELETE_FILE)
- char *s;
- int attrnamespace = (strncmp(name, "system", 6) == 0) ?
- EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
- const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
-
- return extattr_delete_file(path, attrnamespace, attrname);
-#elif defined(HAVE_ATTR_REMOVE)
- int flags = 0;
- char *attrname = strchr(name,'.') + 1;
-
- if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT;
-
- return attr_remove(path, attrname, flags);
-#elif defined(HAVE_ATTROPEN)
- int ret = -1;
- int attrdirfd = solaris_attropen(path, ".", O_RDONLY, 0);
- if (attrdirfd >= 0) {
- ret = solaris_unlinkat(attrdirfd, name);
- close(attrdirfd);
- }
- return ret;
-#else
- errno = ENOSYS;
- return -1;
-#endif
-}
-
-int sys_fremovexattr (int filedes, const char *name)
-{
-#if defined(HAVE_FREMOVEXATTR)
-#ifndef XATTR_ADD_OPT
- return fremovexattr(filedes, name);
-#else
- int options = 0;
- return fremovexattr(filedes, name, options);
-#endif
-#elif defined(HAVE_FREMOVEEA)
- return fremoveea(filedes, name);
-#elif defined(HAVE_EXTATTR_DELETE_FD)
- char *s;
- int attrnamespace = (strncmp(name, "system", 6) == 0) ?
- EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
- const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
-
- return extattr_delete_fd(filedes, attrnamespace, attrname);
-#elif defined(HAVE_ATTR_REMOVEF)
- int flags = 0;
- char *attrname = strchr(name,'.') + 1;
-
- if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT;
-
- return attr_removef(filedes, attrname, flags);
-#elif defined(HAVE_ATTROPEN)
- int ret = -1;
- int attrdirfd = solaris_openat(filedes, ".", O_RDONLY|O_XATTR, 0);
- if (attrdirfd >= 0) {
- ret = solaris_unlinkat(attrdirfd, name);
- close(attrdirfd);
- }
- return ret;
-#else
- errno = ENOSYS;
- return -1;
-#endif
-}
-
-int sys_setxattr (const char *path, const char *name, const void *value, size_t size, int flags)
-{
-#if defined(HAVE_SETXATTR)
-#ifndef XATTR_ADD_OPT
- return setxattr(path, name, value, size, flags);
-#else
- int options = 0;
- return setxattr(path, name, value, size, 0, options);
-#endif
-#elif defined(HAVE_SETEA)
- return setea(path, name, value, size, flags);
-#elif defined(HAVE_EXTATTR_SET_FILE)
- 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_file(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_file(path, attrnamespace, attrname, value, size);
- return (retval < 0) ? -1 : 0;
-#elif defined(HAVE_ATTR_SET)
- int myflags = 0;
- 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;
- 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)
-#ifndef XATTR_ADD_OPT
- return fsetxattr(filedes, name, value, size, flags);
-#else
- int options = 0;
- return fsetxattr(filedes, name, value, size, 0, options);
-#endif
-#elif defined(HAVE_FSETEA)
- return fsetea(filedes, name, value, size, flags);
-#elif defined(HAVE_EXTATTR_SET_FD)
- 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_fd(filedes, 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_fd(filedes, attrnamespace, attrname, value, size);
- return (retval < 0) ? -1 : 0;
-#elif defined(HAVE_ATTR_SETF)
- int myflags = 0;
- 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_setf(filedes, attrname, (const char *)value, size, myflags);
-#elif defined(HAVE_ATTROPEN)
- int ret = -1;
- int myflags = O_RDWR | O_XATTR;
- int attrfd;
- if (flags & XATTR_CREATE) myflags |= O_EXCL;
- if (!(flags & XATTR_REPLACE)) myflags |= O_CREAT;
- attrfd = solaris_openat(filedes, 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
-}
-
-/**************************************************************************
- helper functions for Solaris' EA support
-****************************************************************************/
-#ifdef HAVE_ATTROPEN
-static ssize_t solaris_read_xattr(int attrfd, void *value, size_t size)
-{
- struct stat sbuf;
-
- if (fstat(attrfd, &sbuf) == -1) {
- errno = ENOATTR;
- return -1;
- }
-
- /* This is to return the current size of the named extended attribute */
- if (size == 0) {
- return sbuf.st_size;
- }
-
- /* check size and read xattr */
- if (sbuf.st_size > size) {
- errno = ERANGE;
- return -1;
- }
-
- return read(attrfd, value, sbuf.st_size);
-}
-
-static ssize_t solaris_list_xattr(int attrdirfd, char *list, size_t size)
-{
- ssize_t len = 0;
- DIR *dirp;
- struct dirent *de;
- int newfd = dup(attrdirfd);
- /* CAUTION: The originating file descriptor should not be
- used again following the call to fdopendir().
- For that reason we dup() the file descriptor
- here to make things more clear. */
- dirp = fdopendir(newfd);
-
- while ((de = readdir(dirp))) {
- size_t listlen = strlen(de->d_name) + 1;
- if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..")) {
- /* we don't want "." and ".." here: */
- DEBUG(10,("skipped EA %s\n",de->d_name));
- continue;
- }
-
- if (size == 0) {
- /* return the current size of the list of extended attribute names*/
- len += listlen;
- } else {
- /* check size and copy entrieѕ + nul into list. */
- if ((len + listlen) > size) {
- errno = ERANGE;
- len = -1;
- break;
- } else {
- strlcpy(list + len, de->d_name, listlen);
- len += listlen;
- }
- }
- }
-
- if (closedir(dirp) == -1) {
- DEBUG(0,("closedir dirp failed: %s\n",strerror(errno)));
- return -1;
- }
- return len;
-}
-
-static int solaris_unlinkat(int attrdirfd, const char *name)
-{
- if (unlinkat(attrdirfd, name, 0) == -1) {
- if (errno == ENOENT) {
- errno = ENOATTR;
- }
- return -1;
- }
- return 0;
-}
-
-static int solaris_attropen(const char *path, const char *attrpath, int oflag, mode_t mode)
-{
- int filedes = attropen(path, attrpath, oflag, mode);
- if (filedes == -1) {
- DEBUG(10,("attropen FAILED: path: %s, name: %s, errno: %s\n",path,attrpath,strerror(errno)));
- if (errno == EINVAL) {
- errno = ENOTSUP;
- } else {
- errno = ENOATTR;
- }
- }
- return filedes;
-}
-
-static int solaris_openat(int fildes, const char *path, int oflag, mode_t mode)
-{
- int filedes = openat(fildes, path, oflag, mode);
- if (filedes == -1) {
- DEBUG(10,("openat FAILED: fd: %d, path: %s, errno: %s\n",filedes,path,strerror(errno)));
- if (errno == EINVAL) {
- errno = ENOTSUP;
- } else {
- errno = ENOATTR;
- }
- }
- return filedes;
-}
-
-static int solaris_write_xattr(int attrfd, const char *value, size_t size)
-{
- if ((ftruncate(attrfd, 0) == 0) && (write(attrfd, value, size) == size)) {
- return 0;
- } else {
- DEBUG(10,("solaris_write_xattr FAILED!\n"));
- return -1;
- }
-}
-#endif /*HAVE_ATTROPEN*/
-
-
/****************************************************************************
Return the major devicenumber for UNIX extensions.
****************************************************************************/
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 8908508af4..9745a733be 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -2029,42 +2029,42 @@ static int vfswrap_sys_acl_free_qualifier(vfs_handle_struct *handle, void *qual
static ssize_t vfswrap_getxattr(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size)
{
- return sys_getxattr(path, name, value, size);
+ return getxattr(path, name, value, size);
}
static ssize_t vfswrap_fgetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size)
{
- return sys_fgetxattr(fsp->fh->fd, name, value, size);
+ return fgetxattr(fsp->fh->fd, name, value, size);
}
static ssize_t vfswrap_listxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size)
{
- return sys_listxattr(path, list, size);
+ return listxattr(path, list, size);
}
static ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size)
{
- return sys_flistxattr(fsp->fh->fd, list, size);
+ return flistxattr(fsp->fh->fd, list, size);
}
static int vfswrap_removexattr(struct vfs_handle_struct *handle, const char *path, const char *name)
{
- return sys_removexattr(path, name);
+ return removexattr(path, name);
}
static int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name)
{
- return sys_fremovexattr(fsp->fh->fd, name);
+ return fremovexattr(fsp->fh->fd, name);
}
static int vfswrap_setxattr(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
{
- return sys_setxattr(path, name, value, size, flags);
+ return setxattr(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);
+ return fsetxattr(fsp->fh->fd, name, value, size, flags);
}
static int vfswrap_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
diff --git a/source3/wscript b/source3/wscript
index ad055d06ca..bc625a846a 100755
--- a/source3/wscript
+++ b/source3/wscript
@@ -235,24 +235,19 @@ if (0) {
msg="Checking for LL suffix on long long integers")
conf.CHECK_FUNCS('''
-_acl __acl add_proplist_entry atexit attr_getf attr_list attr_listf
-attropen attr_remove attr_removef attr_set attr_setf
+_acl __acl atexit
bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
-__closedir crypt16 delproplist devnm dgettext dirfd
+__closedir crypt16 devnm dgettext dirfd
DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
-extattr_delete_fd extattr_get_fd extattr_get_file
-extattr_list_fd extattr_list_file
-extattr_set_fd extattr_set_file _facl __facl _fchdir
+_facl __facl _fchdir
__fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
-fdelproplist fgetea fgetproplist fgetxattr flistea flistxattr
-_fork __fork fremoveea fremovexattr fseeko fsetea
-fsetproplist fsetxattr _fstat __fstat fsync
+_fork __fork fseeko
+fsetxattr _fstat __fstat fsync
futimens futimes __fxstat getauthuid
getcwd _getcwd __getcwd getdents __getdents getdirentries
getgrent getgrnam getgrouplist getgrset getmntent getpagesize
-getproplist get_proplist_entry getpwanam getpwent_r getrlimit gettext
+getpwanam getpwent_r getrlimit gettext
glob grantpt hstrerror initgroups innetgr
-listea listxattr
llseek _llseek __llseek _lseek __lseek
_lstat __lstat lutimes
__lxstat memalign mknod mlock mlockall munlock munlockall
@@ -261,11 +256,11 @@ pathconf poll posix_fallocate
posix_memalign prctl pread _pread __pread
pwrite _pwrite __pwrite
rdchk _read __read _readdir __readdir
-removeea removexattr _seekdir __seekdir
-select setea setenv setgidx setgroups setlocale setluid
-setmntent setpgid setpriv setproplist setsid setuidx
-setxattr shmget shm_open sigaction sigblock sigprocmask sigset
-sizeof_proplist_entry _stat __stat statvfs
+_seekdir __seekdir
+select setenv setgidx setgroups setlocale setluid
+setmntent setpgid setpriv setsid setuidx
+shmget shm_open sigaction sigblock sigprocmask sigset
+_stat __stat statvfs
strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctl sysctlbyname
__sys_llseek syslog _telldir __telldir textdomain timegm
utimensat vsyslog _write __write __xstat
@@ -434,12 +429,6 @@ msg.msg_acctrightslen = sizeof(fd);
conf.find_program('awk', var='AWK')
conf.find_program('perl', var='PERL')
- # Darwin has extra options to xattr-family functions
- conf.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);',
- 'XATTR_ADD_OPT',
- msg="Checking whether xattr interface takes additional options",
- headers='sys/types.h attr/xattr.h sys/xattr.h')
-
conf.CHECK_HEADERS('asm/types.h')
conf.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",