[SCM] Samba Shared Repository - branch master updated
Björn Jacke
bjacke at samba.org
Thu Aug 29 17:11:04 UTC 2019
The branch, master has been updated
via 3aea2c0f1f4 replace/setxattr: correctly use our flags on Darwin
via 56e0ffa1131 xattr/setxattr: fix flag support on AIX
via b8f4be98f5d replace/setxattr: set reasonable and unified errno value in case the EA value was too big
from 0be320393b8 s3/libsmb: clang: Fix 'Value stored during initialization is never read'
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 3aea2c0f1f498fdb515cbd1d04b1ba3ce7f4cc3b
Author: Björn Jacke <bj at sernet.de>
Date: Sat Mar 2 05:47:20 2019 +0100
replace/setxattr: correctly use our flags on Darwin
Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Autobuild-User(master): Björn Jacke <bjacke at samba.org>
Autobuild-Date(master): Thu Aug 29 17:10:32 UTC 2019 on sn-devel-184
commit 56e0ffa11319eebbe0d8b07502aa3ec8971435d0
Author: Björn Jacke <bj at sernet.de>
Date: Sat Mar 2 05:39:54 2019 +0100
xattr/setxattr: fix flag support on AIX
AIX requires the flags to be 0, we need to do those checks manually.
Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit b8f4be98f5d22eb034a953ebefab88752bf4a099
Author: Björn Jacke <bj at sernet.de>
Date: Sat Mar 2 05:01:28 2019 +0100
replace/setxattr: set reasonable and unified errno value in case the EA value was too big
FreeBSD and AIX already set errno to ENAMETOOLONG, this is what we should map
other platforms also to to finally map to the correct NT error code also.
Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/replace/xattr.c | 88 ++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 71 insertions(+), 17 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/replace/xattr.c b/lib/replace/xattr.c
index 2420ee1f808..d07dd2cc1e3 100644
--- a/lib/replace/xattr.c
+++ b/lib/replace/xattr.c
@@ -515,19 +515,44 @@ int rep_fremovexattr (int filedes, const char *name)
int rep_setxattr (const char *path, const char *name, const void *value, size_t size, int flags)
{
+ int retval = -1;
#if defined(HAVE_XATTR_XATTR)
#ifndef XATTR_ADDITIONAL_OPTIONS
- return setxattr(path, name, value, size, flags);
+ retval = setxattr(path, name, value, size, flags);
+ if (retval < 0) {
+ if (errno == ENOSPC || errno == E2BIG) {
+ errno = ENAMETOOLONG;
+ }
+ }
+ return retval;
#else
/* So that we do not recursivly call this function */
#undef setxattr
- int options = 0;
- return setxattr(path, name, value, size, 0, options);
+ retval = setxattr(path, name, value, size, 0, flags);
+ if (retval < 0) {
+ if (errno == E2BIG) {
+ errno = ENAMETOOLONG;
+ }
+ }
+ return retval;
#endif
#elif defined(HAVE_XATTR_EA)
- return setea(path, name, value, size, flags);
+ if (flags) {
+ retval = getea(path, name, NULL, 0);
+ if (retval < 0) {
+ if (flags & XATTR_REPLACE && errno == ENOATTR) {
+ return -1;
+ }
+ } else {
+ if (flags & XATTR_CREATE) {
+ errno = EEXIST;
+ return -1;
+ }
+ }
+ }
+ retval = setea(path, name, value, size, 0);
+ return retval;
#elif defined(HAVE_XATTR_EXTATTR)
- int retval = 0;
int attrnamespace;
const char *attrname;
@@ -571,19 +596,24 @@ int rep_setxattr (const char *path, const char *name, const void *value, size_t
if (flags & XATTR_CREATE) myflags |= ATTR_CREATE;
if (flags & XATTR_REPLACE) myflags |= ATTR_REPLACE;
- return attr_set(path, attrname, (const char *)value, size, myflags);
+ retval = attr_set(path, attrname, (const char *)value, size, myflags);
+ if (retval < 0) {
+ if (errno == E2BIG) {
+ errno = ENAMETOOLONG;
+ }
+ }
+ return retval;
#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);
+ retval = solaris_write_xattr(attrfd, value, size);
close(attrfd);
}
- return ret;
+ return retval;
#else
errno = ENOSYS;
return -1;
@@ -592,19 +622,44 @@ int rep_setxattr (const char *path, const char *name, const void *value, size_t
int rep_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags)
{
+ int retval = -1;
#if defined(HAVE_XATTR_XATTR)
#ifndef XATTR_ADDITIONAL_OPTIONS
- return fsetxattr(filedes, name, value, size, flags);
+ retval = fsetxattr(filedes, name, value, size, flags);
+ if (retval < 0) {
+ if (errno == ENOSPC) {
+ errno = ENAMETOOLONG;
+ }
+ }
+ return retval;
#else
/* So that we do not recursivly call this function */
#undef fsetxattr
- int options = 0;
- return fsetxattr(filedes, name, value, size, 0, options);
+ retval = fsetxattr(filedes, name, value, size, 0, flags);
+ if (retval < 0) {
+ if (errno == E2BIG) {
+ errno = ENAMETOOLONG;
+ }
+ }
+ return retval;
#endif
#elif defined(HAVE_XATTR_EA)
- return fsetea(filedes, name, value, size, flags);
+ if (flags) {
+ retval = fgetea(filedes, name, NULL, 0);
+ if (retval < 0) {
+ if (flags & XATTR_REPLACE && errno == ENOATTR) {
+ return -1;
+ }
+ } else {
+ if (flags & XATTR_CREATE) {
+ errno = EEXIST;
+ return -1;
+ }
+ }
+ }
+ retval = fsetea(filedes, name, value, size, 0);
+ return retval;
#elif defined(HAVE_XATTR_EXTATTR)
- int retval = 0;
int attrnamespace;
const char *attrname;
@@ -650,17 +705,16 @@ int rep_fsetxattr (int filedes, const char *name, const void *value, size_t size
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);
+ retval = solaris_write_xattr(attrfd, value, size);
close(attrfd);
}
- return ret;
+ return retval;
#else
errno = ENOSYS;
return -1;
--
Samba Shared Repository
More information about the samba-cvs
mailing list