diff options
author | Nathan Scott <nathans@sgi.com> | 2003-02-26 06:27:13 +0000 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2003-02-26 06:27:13 +0000 |
commit | 79989b25c65ea0b8352fcd0bfc15461af09251b3 (patch) | |
tree | d993baa3d0be95f4978ffe1ab2d765d993b743c5 | |
parent | 7b33ebd60e68795347c2c844d81d90e38fd9091e (diff) | |
download | attr-79989b25c65ea0b8352fcd0bfc15461af09251b3.tar.gz |
Another extended attributes userspace patch from AndreasG - several small
incremental fixes from last set, and addition of symbol versioning.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | debian/changelog | 4 | ||||
-rw-r--r-- | doc/CHANGES | 14 | ||||
-rw-r--r-- | exports | 33 | ||||
-rw-r--r-- | include/error_context.h | 2 | ||||
-rw-r--r-- | include/libattr.h | 5 | ||||
-rw-r--r-- | libattr/Makefile | 10 | ||||
-rw-r--r-- | libattr/attr_copy_check.c | 51 | ||||
-rw-r--r-- | libattr/attr_copy_fd.c | 13 | ||||
-rw-r--r-- | libattr/attr_copy_file.c | 13 | ||||
-rw-r--r-- | libattr/libattr.h | 1 |
12 files changed, 123 insertions, 27 deletions
@@ -38,7 +38,7 @@ include $(TOPDIR)/include/builddefs endif CONFIGURE = configure include/builddefs include/config.h -LSRCFILES = configure configure.in Makepkgs install-sh README VERSION +LSRCFILES = configure configure.in Makepkgs install-sh README VERSION exports LDIRT = config.log .dep config.status config.cache confdefs.h conftest* \ Logs/* built .census install.* install-dev.* install-lib.* *.gz @@ -2,6 +2,6 @@ # This file is used by configure to get version information # PKG_MAJOR=2 -PKG_MINOR=3 +PKG_MINOR=4 PKG_REVISION=0 PKG_BUILD=0 diff --git a/debian/changelog b/debian/changelog index 5040d5b..a07d860 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -attr (2.3.0-1) unstable; urgency=low +attr (2.4.0-1) unstable; urgency=low * New upstream release * Note: xfsdump and xfsrestore are affected by a change in libattr @@ -6,7 +6,7 @@ attr (2.3.0-1) unstable; urgency=low it with the generic "trusted" name. The environment variable COMPAT_XFSROOT can be used to obtain the old behavior. - -- Nathan Scott <nathans@debian.org> Fri, 21 Feb 2003 16:28:13 +1100 + -- Nathan Scott <nathans@debian.org> Wed, 26 Feb 2003 16:07:57 +1100 attr (2.2.0-1) unstable; urgency=low diff --git a/doc/CHANGES b/doc/CHANGES index 3adf1d1..b347f82 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,4 +1,16 @@ -attr-2.3.0 (21 February 2002) +attr-2.4.0 (26 February 2003) + - Add symbol level versioning to libattr. This improves link + time consistency checks. The library versions are also + honored by RPM, so an RPM package built against say, + libattr.so.1(ATTR_1.1) won't link against + libattr.so.1(ATTR_1.0), which was not checked before. + - Make the default check function used by attr_copy_{fd,file}() + accessible as attr_copy_check_permissions(). + - Increment the library version number, so that the attr_copy + functions can be checked for. + - Fix some minor typos. + +attr-2.3.0 (21 February 2003) - By default, we use the "trusted" attribute name prefix for XFS ROOT attribute names, instead of the "xfsroot" prefix. If the COMPAT_XFSROOT environment variable is set, however, @@ -0,0 +1,33 @@ +ATTR_1.0 { + global: + # System calls (to be moved to glibc) + fgetxattr; + flistxattr; + fremovexattr; + fsetxattr; + getxattr; + lgetxattr; + listxattr; + llistxattr; + lremovexattr; + lsetxattr; + removexattr; + setxattr; + + # SGI Irix compatibility extensions + attr_get; + attr_getf; + attr_multi; + attr_multif; + attr_remove; + attr_removef; + attr_set; + attr_setf; +}; + +ATTR_1.1 { + global: + attr_copy_fd; + attr_copy_file; + attr_copy_check_permissions; +} ATTR_1.0; diff --git a/include/error_context.h b/include/error_context.h index c838ebc..f3c54e9 100644 --- a/include/error_context.h +++ b/include/error_context.h @@ -24,7 +24,7 @@ struct error_context { # define quote(ctx, name) \ ( ((ctx) && (ctx)->quote) ? (ctx)->quote((ctx), (name)) : (name) ) # define quote_free(ctx, name) do { \ - if ((ctx) && (ctx)->quote) \ + if ((ctx) && (ctx)->quote_free) \ (ctx)->quote_free((ctx), (name)); \ } while(0) #endif diff --git a/include/libattr.h b/include/libattr.h index bb8ce6f..2fe477c 100644 --- a/include/libattr.h +++ b/include/libattr.h @@ -8,12 +8,15 @@ extern "C" { struct error_context; extern int attr_copy_file (const char *, const char *, - int (*) (const char *name, struct error_context *), + int (*) (const char *, struct error_context *), struct error_context *); extern int attr_copy_fd (const char *, int, const char *, int, int (*) (const char *, struct error_context *), struct error_context *); +/* The default check function used by attr_copy_{fd,file}. */ +extern int attr_copy_check_permissions(const char *, struct error_context *); + #ifdef __cplusplus } #endif diff --git a/libattr/Makefile b/libattr/Makefile index f9f9e14..2d33d03 100644 --- a/libattr/Makefile +++ b/libattr/Makefile @@ -32,14 +32,16 @@ # TOPDIR = .. + +LTLDFLAGS = -Wl,--version-script,$(TOPDIR)/exports include $(TOPDIR)/include/builddefs LTLIBRARY = libattr.la -LT_CURRENT = 1 -LT_REVISION = 2 -LT_AGE = 0 +LT_CURRENT = 2 +LT_REVISION = 0 +LT_AGE = 1 -CFILES = libattr.c syscalls.c attr_copy_fd.c attr_copy_file.c +CFILES = libattr.c syscalls.c attr_copy_fd.c attr_copy_file.c attr_copy_check.c HFILES = libattr.h LCFLAGS = -include libattr.h diff --git a/libattr/attr_copy_check.c b/libattr/attr_copy_check.c new file mode 100644 index 0000000..049ae0b --- /dev/null +++ b/libattr/attr_copy_check.c @@ -0,0 +1,51 @@ +/* Copy extended attributes between files - default check callback */ + +/* Copyright (C) 2003 Andreas Gruenbacher <agruen@suse.de>, SuSE Linux AG. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ + +#include <string.h> + +struct error_context; + +int +attr_copy_check_permissions(const char *name, struct error_context *ctx) +{ + /* Skip POSIX ACLs. */ + if (strncmp(name, "system.posix_acl_", 17) == 0 && + (strcmp(name, "access") == 0 || + strcmp(name, "default") == 0)) + return 0; + + /* Skip permissions attributes which are used on IRIX, and + hence are part of the XFS ondisk format (incl. ACLs). */ + if (strncmp(name, "trusted.SGI_", 12) == 0 && + (strcmp(name, "ACL_DEFAULT") == 0 || + strcmp(name, "ACL_FILE") == 0 || + strcmp(name, "CAP_FILE") == 0 || + strcmp(name, "MAC_FILE") == 0)) + return 0; + + /* The xfsroot namespace mirrored attributes, some of which + are also also available via the system.* and trusted.* + namespaces. To avoid the problems this would cause, + we skip xfsroot altogether. + Note: xfsroot namespace has now been removed from XFS. */ + if (strncmp(name, "xfsroot.", 8) == 0) + return 0; + + return 1; +} + diff --git a/libattr/attr_copy_fd.c b/libattr/attr_copy_fd.c index 78e6383..4898121 100644 --- a/libattr/attr_copy_fd.c +++ b/libattr/attr_copy_fd.c @@ -33,6 +33,10 @@ # include <attr/xattr.h> #endif +#if defined(HAVE_ATTR_LIBATTR_H) +# include "attr/libattr.h" +#endif + #define ERROR_CONTEXT_MACROS #include "error_context.h" @@ -48,13 +52,6 @@ # define my_free(ptr) free (ptr) #endif -static int -check_no_acl(const char *name, struct error_context *ctx) -{ - return strcmp(name, "system.posix_acl_access") && - strcmp(name, "system.posix_acl_default"); -} - /* Copy extended attributes from src_path to dst_path. If the file has an extended Access ACL (system.posix_acl_access) and that is copied successfully, the file mode permission bits are copied as @@ -74,7 +71,7 @@ attr_copy_fd(const char *src_path, int src_fd, /* ignore acls by default */ if (check == NULL) - check = check_no_acl; + check = attr_copy_check_permissions; size = flistxattr (src_fd, NULL, 0); if (size < 0) { diff --git a/libattr/attr_copy_file.c b/libattr/attr_copy_file.c index 98296ed..ad0045d 100644 --- a/libattr/attr_copy_file.c +++ b/libattr/attr_copy_file.c @@ -33,6 +33,10 @@ # include <attr/xattr.h> #endif +#if defined(HAVE_ATTR_LIBATTR_H) +# include "attr/libattr.h" +#endif + #define ERROR_CONTEXT_MACROS #include "error_context.h" @@ -48,13 +52,6 @@ # define my_free(ptr) free (ptr) #endif -static int -check_no_acl(const char *name, struct error_context *ctx) -{ - return strcmp(name, "system.posix_acl_access") && - strcmp(name, "system.posix_acl_default"); -} - /* Copy extended attributes from src_path to dst_path. If the file has an extended Access ACL (system.posix_acl_access) and that is copied successfully, the file mode permission bits are copied as @@ -72,7 +69,7 @@ attr_copy_file(const char *src_path, const char *dst_path, /* ignore acls by default */ if (check == NULL) - check = check_no_acl; + check = attr_copy_check_permissions; size = listxattr (src_path, NULL, 0); if (size < 0) { diff --git a/libattr/libattr.h b/libattr/libattr.h index 316c1db..8973b00 100644 --- a/libattr/libattr.h +++ b/libattr/libattr.h @@ -1,6 +1,7 @@ /* Features we provide ourself. */ #define HAVE_ATTR_XATTR_H 1 +#define HAVE_ATTR_LIBATTR_H 1 #define HAVE_CONFIG_H 1 #define HAVE_FGETXATTR 1 |