summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--VERSION2
-rw-r--r--configure.in5
-rw-r--r--debian/changelog10
-rw-r--r--doc/CHANGES12
-rw-r--r--examples/Makefile41
-rw-r--r--examples/Makefile.examples9
-rw-r--r--examples/copyattr.c122
-rw-r--r--include/Makefile2
-rw-r--r--include/config.h.in7
-rw-r--r--include/error_context.h36
-rw-r--r--include/libattr.h21
-rw-r--r--libattr/Makefile7
-rw-r--r--libattr/attr_copy_fd.c168
-rw-r--r--libattr/attr_copy_file.c166
-rw-r--r--libattr/libattr.c23
-rw-r--r--libattr/libattr.h11
-rw-r--r--man/man2/getxattr.220
-rw-r--r--man/man2/listxattr.220
-rw-r--r--man/man2/removexattr.220
-rw-r--r--man/man2/setxattr.220
-rw-r--r--po/Makefile4
-rw-r--r--po/attr.pot44
-rw-r--r--po/de.po49
24 files changed, 806 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index d43cb0b..a66013a 100644
--- a/Makefile
+++ b/Makefile
@@ -43,7 +43,8 @@ LSRCFILES = configure configure.in Makepkgs install-sh README VERSION
LDIRT = config.log .dep config.status config.cache confdefs.h conftest* \
Logs/* built .census install.* install-dev.* install-lib.* *.gz
-SUBDIRS = include libattr attr getfattr setfattr test man doc po debian build
+SUBDIRS = include libattr attr getfattr setfattr \
+ examples test man doc po debian build
default: $(CONFIGURE)
ifeq ($(HAVE_BUILDDEFS), no)
diff --git a/VERSION b/VERSION
index 5cafc9f..5acbc38 100644
--- a/VERSION
+++ b/VERSION
@@ -2,6 +2,6 @@
# This file is used by configure to get version information
#
PKG_MAJOR=2
-PKG_MINOR=2
+PKG_MINOR=3
PKG_REVISION=0
PKG_BUILD=0
diff --git a/configure.in b/configure.in
index f426da5..8bd802d 100644
--- a/configure.in
+++ b/configure.in
@@ -176,5 +176,10 @@ for d in ${prefix}/share/man ${prefix}/man ; do
done
AC_SUBST(have_zipped_manpages)
+dnl Some more stuff for the ACL copying functions
+AC_C_CONST
+AC_TYPE_MODE_T
+AC_FUNC_ALLOCA
+
dnl build definitions for use in Makefiles
AC_OUTPUT(include/builddefs)
diff --git a/debian/changelog b/debian/changelog
index 30f2b3e..5040d5b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+attr (2.3.0-1) unstable; urgency=low
+
+ * New upstream release
+ * Note: xfsdump and xfsrestore are affected by a change in libattr
+ which deprecates the attribute name prefix "xfsroot", replacing
+ 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
+
attr (2.2.0-1) unstable; urgency=low
* New upstream release
diff --git a/doc/CHANGES b/doc/CHANGES
index 8f5d2a3..3adf1d1 100644
--- a/doc/CHANGES
+++ b/doc/CHANGES
@@ -1,3 +1,15 @@
+attr-2.3.0 (21 February 2002)
+ - 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,
+ the old (now deprecated) names are used. This is useful for
+ XFS kernel code older than, well, today. Newer kernels will
+ work correctly with the new tools (but not the old tools).
+ - Added routines to libattr for copying extended attributes -
+ attr_copy_file and attr_copy_fd.
+ - libattr.so version updated to reflect these changes.
+ - Update licensing notice in system call man pages for aeb.
+
attr-2.2.0 (30 November 2002)
- Complete the internationalisation support, and added initial
German translation from Andreas.
diff --git a/examples/Makefile b/examples/Makefile
new file mode 100644
index 0000000..c2e7156
--- /dev/null
+++ b/examples/Makefile
@@ -0,0 +1,41 @@
+#
+# Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# Further, this software is distributed without any warranty that it is
+# free of the rightful claim of any third person regarding infringement
+# or the like. Any license provided herein, whether implied or
+# otherwise, applies only to this software file. Patent licenses, if
+# any, provided herein do not apply to combinations of this program with
+# other software, or any other product whatsoever.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write the Free Software Foundation, Inc., 59
+# Temple Place - Suite 330, Boston MA 02111-1307, USA.
+#
+# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+# Mountain View, CA 94043, or:
+#
+# http://www.sgi.com
+#
+# For further information regarding this notice, see:
+#
+# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+#
+
+TOPDIR = ..
+include $(TOPDIR)/include/builddefs
+
+LSRCFILES = copyattr.c
+LDIRT = copyattr
+
+include $(BUILDRULES)
+
+default install install-dev install-lib:
diff --git a/examples/Makefile.examples b/examples/Makefile.examples
new file mode 100644
index 0000000..05c7831
--- /dev/null
+++ b/examples/Makefile.examples
@@ -0,0 +1,9 @@
+CFLAGS = -g -Wall
+LDFLAGS = -lattr
+
+PROGS = copyattr
+
+all : $(PROGS)
+
+clean:
+ rm -f $(PROGS)
diff --git a/examples/copyattr.c b/examples/copyattr.c
new file mode 100644
index 0000000..1013206
--- /dev/null
+++ b/examples/copyattr.c
@@ -0,0 +1,122 @@
+/*
+ * Example how to preserve Extended Attributes in file manager style
+ * applications. This does NOT also copy Access Control Lists!
+ *
+ * Andreas Gruenbacher, SuSE Labs, SuSE Linux AG
+ * 23 January 2003
+ */
+
+#include "config.h"
+
+#include <sys/stat.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <locale.h>
+/* #include <libintl.h> */
+#ifdef HAVE_ATTR_ERROR_CONTEXT_H
+# include <attr/error_context.h>
+#endif
+#ifdef HAVE_ATTR_LIBATTR_H
+# include <attr/libattr.h>
+#endif
+
+/*
+ * We don't fully internationalize this example!
+ */
+#define _(msg) (msg)
+
+/*
+ * Optional error handler for attr_copy_file(). CTX is the error
+ * context passed to attr_copy_file(), ERR is the errno value
+ * that occurred. FMT and the rest are printf style arguments.
+ */
+static void
+error(struct error_context *ctx, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ if (vfprintf(stderr, fmt, ap))
+ fprintf(stderr, ": ");
+ fprintf(stderr, "%s\n", strerror(errno));
+ va_end(ap);
+}
+
+/*
+ * Optional handler for quoting path names in error messages.
+ * (This is a very stupid example!)
+ */
+static const char *
+quote(struct error_context *ctx, const char *pathname)
+{
+ char *pn = strdup(pathname), *p;
+ pathname = strdup(pathname);
+ for (p = pn; *p != '\0'; p++)
+ if (*p & 0x80)
+ *p='?';
+ return pn;
+}
+
+static void
+quote_free(struct error_context *ctx, const char *name)
+{
+ free((void *)name);
+}
+
+/*
+ * The error context we pass to attr_copy_file().
+ */
+struct error_context ctx = { error, quote, quote_free };
+
+/*
+ * Optional attribute filter for attr_copy_file(). This example
+ * excludes all attributes other than extended user attributes.
+ */
+static int is_user_attr(const char *name, struct error_context *ctx)
+{
+ return strcmp(name, "user.") == 0;
+}
+
+int
+main(int argc, char *argv[])
+{
+ int ret;
+
+ /*
+ * Set the locale to enable message translation
+ */
+ setlocale(LC_MESSAGES, "");
+ setlocale(LC_CTYPE, "");
+
+ if (argc != 3) {
+ fprintf(stderr, _("Usage: %s from to\n"), argv[0]);
+ exit(1);
+ }
+
+#if defined(HAVE_ATTR_COPY_FILE)
+ /*
+ * If the third parameter is NULL, all extended attributes
+ * except those that define Access Control Lists are copied.
+ * ACLs are excluded by default because copying them between
+ * file systems with and without ACL support needs some
+ * additional logic so that no unexpected permissions result.
+ *
+ * For copying ACLs, please use perm_copy_file() from libacl.
+ *
+ * The CTX parameter could also be NULL, in which case attr_copy_file
+ * would print no error messages.
+ */
+ ret = attr_copy_file(argv[1], argv[2], is_user_attr, &ctx);
+#else
+ fprintf(stderr, _("No support for copying extended attributes\n"));
+ ret = -1;
+#endif
+
+ if (ret != 0)
+ return EXIT_FAILURE;
+ return EXIT_SUCCESS;
+}
+
diff --git a/include/Makefile b/include/Makefile
index b5a94a2..305d948 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -34,7 +34,7 @@ TOPDIR = ..
include $(TOPDIR)/include/builddefs
INCDIR = attr
-HFILES = attributes.h xattr.h
+HFILES = attributes.h xattr.h error_context.h libattr.h
LSRCFILES = builddefs.in buildmacros buildrules config.h.in
LDIRT = $(INCDIR)
diff --git a/include/config.h.in b/include/config.h.in
index 9ef7c63..b6a1872 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -37,6 +37,13 @@
/* Define if you want gettext (I18N) support */
#undef ENABLE_GETTEXT
+/* Define to 1 if you have `alloca', as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+ */
+#undef HAVE_ALLOCA_H
+
#ifdef ENABLE_GETTEXT
# include <libintl.h>
# define _(x) gettext(x)
diff --git a/include/error_context.h b/include/error_context.h
new file mode 100644
index 0000000..c838ebc
--- /dev/null
+++ b/include/error_context.h
@@ -0,0 +1,36 @@
+#ifndef __ERROR_CONTEXT_T
+#define __ERROR_CONTEXT_T
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct error_context {
+ /* Process an error message */
+ void (*error) (struct error_context *, const char *, ...);
+
+ /* Quote a file name for including in an error message */
+ const char *(*quote) (struct error_context *, const char *);
+
+ /* Free a quoted name */
+ void (*quote_free) (struct error_context *, const char *);
+};
+
+#ifdef ERROR_CONTEXT_MACROS
+# define error(ctx, args...) do { \
+ if ((ctx) && (ctx)->error) \
+ (ctx)->error((ctx), args); \
+ } while(0)
+# define quote(ctx, name) \
+ ( ((ctx) && (ctx)->quote) ? (ctx)->quote((ctx), (name)) : (name) )
+# define quote_free(ctx, name) do { \
+ if ((ctx) && (ctx)->quote) \
+ (ctx)->quote_free((ctx), (name)); \
+ } while(0)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ERROR_CONTEXT_T */
diff --git a/include/libattr.h b/include/libattr.h
new file mode 100644
index 0000000..bb8ce6f
--- /dev/null
+++ b/include/libattr.h
@@ -0,0 +1,21 @@
+#ifndef __LIBATTR_H
+#define __LIBATTR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct error_context;
+
+extern int attr_copy_file (const char *, const char *,
+ int (*) (const char *name, 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 *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libattr/Makefile b/libattr/Makefile
index 854db51..f9f9e14 100644
--- a/libattr/Makefile
+++ b/libattr/Makefile
@@ -36,10 +36,13 @@ include $(TOPDIR)/include/builddefs
LTLIBRARY = libattr.la
LT_CURRENT = 1
-LT_REVISION = 1
+LT_REVISION = 2
LT_AGE = 0
-CFILES = libattr.c syscalls.c
+CFILES = libattr.c syscalls.c attr_copy_fd.c attr_copy_file.c
+HFILES = libattr.h
+
+LCFLAGS = -include libattr.h
default: $(LTLIBRARY)
diff --git a/libattr/attr_copy_fd.c b/libattr/attr_copy_fd.c
new file mode 100644
index 0000000..78e6383
--- /dev/null
+++ b/libattr/attr_copy_fd.c
@@ -0,0 +1,168 @@
+/* Copy extended attributes between files. */
+
+/* Copyright (C) 2002 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. */
+
+#if defined (HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <sys/types.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#if defined(HAVE_ALLOCA_H)
+# include <alloca.h>
+#endif
+
+#if defined(HAVE_ATTR_XATTR_H)
+# include <attr/xattr.h>
+#endif
+
+#define ERROR_CONTEXT_MACROS
+#include "error_context.h"
+
+#if !defined(ENOTSUP)
+# define ENOTSUP (-1)
+#endif
+
+#if defined(HAVE_ALLOCA)
+# define my_alloc(size) alloca (size)
+# define my_free(ptr) do { } while(0)
+#else
+# define my_alloc(size) malloc (size)
+# 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
+ a side effect. This may not always the case, so the file mode
+ and/or ownership must be copied separately. */
+int
+attr_copy_fd(const char *src_path, int src_fd,
+ const char *dst_path, int dst_fd,
+ int (*check) (const char *, struct error_context *),
+ struct error_context *ctx)
+{
+#if defined(HAVE_FLISTXATTR) && defined(HAVE_FGETXATTR) && \
+ defined(HAVE_FSETXATTR)
+ int ret = 0;
+ ssize_t size;
+ char *names = NULL, *end_names, *name, *value = NULL;
+
+ /* ignore acls by default */
+ if (check == NULL)
+ check = check_no_acl;
+
+ size = flistxattr (src_fd, NULL, 0);
+ if (size < 0) {
+ if (errno != ENOSYS && errno != ENOTSUP) {
+ const char *qpath = quote (ctx, src_path);
+ error (ctx, _("listing attributes of %s"), qpath);
+ quote_free (ctx, qpath);
+ ret = -1;
+ }
+ goto getout;
+ }
+ names = (char *) my_alloc (size+1);
+ if (names == NULL) {
+ error (ctx, "");
+ ret = -1;
+ goto getout;
+ }
+ size = flistxattr (src_fd, names, size);
+ if (size < 0) {
+ const char *qpath = quote (ctx, src_path);
+ error (ctx, _("listing attributes of %s"), qpath);
+ quote_free (ctx, qpath);
+ my_free (names);
+ ret = -1;
+ goto getout;
+ } else {
+ names[size] = '\0';
+ end_names = names + size;
+ }
+
+ for (name = names; name != end_names; name = strchr(name, '\0') + 1) {
+ void *old_value;
+
+ /* check if this attribute shall be preserved */
+ if (!*name || !check(name, ctx))
+ continue;
+
+ size = fgetxattr (src_fd, name, NULL, 0);
+ if (size < 0) {
+ const char *qpath = quote (ctx, src_path);
+ const char *qname = quote (ctx, name);
+ error (ctx, _("getting attribute %s of %s"),
+ qpath, qname);
+ quote_free (ctx, qname);
+ quote_free (ctx, qpath);
+ ret = -1;
+ continue; /* may not have permission to access */
+ }
+ value = (char *) realloc (old_value = value, size);
+ if (size != 0 && value == NULL) {
+ free(old_value);
+ error (ctx, "");
+ ret = -1;
+ }
+ size = fgetxattr (src_fd, name, value, size);
+ if (size < 0) {
+ const char *qpath = quote (ctx, src_path);
+ const char *qname = quote (ctx, name);
+ error (ctx, _("getting attribute %s of %s"),
+ qname, qpath);
+ quote_free (ctx, qname);
+ quote_free (ctx, qpath);
+ ret = -1;
+ }
+ if (fsetxattr (dst_fd, name, value, size, 0) != 0)
+ {
+ const char *qpath = quote (ctx, dst_path);
+ if (errno == ENOSYS) {
+ error (ctx, _("setting attributes for %s"),
+ qpath);
+ ret = -1;
+ break; /* no hope of getting any further */
+ } else {
+ const char *qname = quote (ctx, name);
+ error (ctx, _("setting attribute %s for %s"),
+ qname, qpath);
+ quote_free (ctx, qname);
+ ret = -1;
+ }
+ quote_free (ctx, qpath);
+ }
+ }
+getout:
+ free (value);
+ my_free (names);
+ return ret;
+#else
+ return 0;
+#endif
+}
+
diff --git a/libattr/attr_copy_file.c b/libattr/attr_copy_file.c
new file mode 100644
index 0000000..98296ed
--- /dev/null
+++ b/libattr/attr_copy_file.c
@@ -0,0 +1,166 @@
+/* Copy extended attributes between files. */
+
+/* Copyright (C) 2002 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. */
+
+#if defined (HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <sys/types.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#if defined(HAVE_ALLOCA_H)
+# include <alloca.h>
+#endif
+
+#if defined(HAVE_ATTR_XATTR_H)
+# include <attr/xattr.h>
+#endif
+
+#define ERROR_CONTEXT_MACROS
+#include "error_context.h"
+
+#if !defined(ENOTSUP)
+# define ENOTSUP (-1)
+#endif
+
+#if defined(HAVE_ALLOCA)
+# define my_alloc(size) alloca (size)
+# define my_free(ptr) do { } while(0)
+#else
+# define my_alloc(size) malloc (size)
+# 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
+ a side effect. This may not always the case, so the file mode
+ and/or ownership must be copied separately. */
+int
+attr_copy_file(const char *src_path, const char *dst_path,
+ int (*check) (const char *, struct error_context *),
+ struct error_context *ctx)
+{
+#if defined(HAVE_LISTXATTR) && defined(HAVE_GETXATTR) && defined(HAVE_SETXATTR)
+ int ret = 0;
+ ssize_t size;
+ char *names = NULL, *end_names, *name, *value = NULL;
+
+ /* ignore acls by default */
+ if (check == NULL)
+ check = check_no_acl;
+
+ size = listxattr (src_path, NULL, 0);
+ if (size < 0) {
+ if (errno != ENOSYS && errno != ENOTSUP) {
+ const char *qpath = quote (ctx, src_path);
+ error (ctx, _("listing attributes of %s"), qpath);
+ quote_free (ctx, qpath);
+ ret = -1;
+ }
+ goto getout;
+ }
+ names = (char *) my_alloc (size+1);
+ if (names == NULL) {
+ error (ctx, "");
+ ret = -1;
+ goto getout;
+ }
+ size = listxattr (src_path, names, size);
+ if (size < 0) {
+ const char *qpath = quote (ctx, src_path);
+ error (ctx, _("listing attributes of %s"), qpath);
+ quote_free (ctx, qpath);
+ my_free (names);
+ ret = -1;
+ goto getout;
+ } else {
+ names[size] = '\0';
+ end_names = names + size;
+ }
+
+ for (name = names; name != end_names; name = strchr(name, '\0') + 1) {
+ void *old_value;
+
+ /* check if this attribute shall be preserved */
+ if (!*name || !check(name, ctx))
+ continue;
+
+ size = getxattr (src_path, name, NULL, 0);
+ if (size < 0) {
+ const char *qpath = quote (ctx, src_path);
+ const char *qname = quote (ctx, name);
+ error (ctx, _("getting attribute %s of %s"),
+ qname, qpath);
+ quote_free (ctx, qname);
+ quote_free (ctx, qpath);
+ ret = -1;
+ continue; /* may not have permission to access */
+ }
+ value = (char *) realloc (old_value = value, size);
+ if (size != 0 && value == NULL) {
+ free(old_value);
+ error (ctx, "");
+ ret = -1;
+ }
+ size = getxattr (src_path, name, value, size);
+ if (size < 0) {
+ const char *qpath = quote (ctx, src_path);
+ const char *qname = quote (ctx, name);
+ error (ctx, _("getting attribute %s of %s"),
+ qname, qpath);
+ quote_free (ctx, qname);
+ quote_free (ctx, qpath);
+ ret = -1;
+ }
+ if (setxattr (dst_path, name, value, size, 0) != 0)
+ {
+ const char *qpath = quote (ctx, dst_path);
+ if (errno == ENOSYS) {
+ error (ctx, _("setting attributes for %s"),
+ qpath);
+ ret = -1;
+ break; /* no hope of getting any further */
+ } else {
+ const char *qname = quote (ctx, name);
+ error (ctx, _("setting attribute %s for %s"),
+ qname, qpath);
+ quote_free (ctx, qname);
+ ret = -1;
+ }
+ quote_free (ctx, qpath);
+ }
+ }
+getout:
+ free (value);
+ my_free (names);
+ return ret;
+#else
+ return 0;
+#endif
+}
+
diff --git a/libattr/libattr.c b/libattr/libattr.c
index 110f07c..1c37abc 100644
--- a/libattr/libattr.c
+++ b/libattr/libattr.c
@@ -44,25 +44,32 @@
#undef MAXNAMELEN
#define MAXNAMELEN 256
-static const char *user_name = "user.";
-static const char *root_name = "xfsroot.";
-
/*
* Convert IRIX API components into Linux/XFS API components
*/
static int
api_convert(char *name, const char *irixname, int irixflags)
{
- int len = strlen(irixname);
+ static const char *user_name = "user.";
+ static const char *trusted_name = "trusted.";
+ static const char *xfsroot_name = "xfsroot.";
+ static int compat = -1;
+
+ if (compat == -1)
+ compat = (getenv("COMPAT_XFSROOT") != NULL);
- if (len >= MAXNAMELEN) {
+ if (strlen(irixname) >= MAXNAMELEN) {
errno = EINVAL;
return -1;
}
- if (irixflags & ATTR_ROOT)
- strcpy(name, root_name);
- else
+ if (irixflags & ATTR_ROOT) {
+ if (compat)
+ strcpy(name, xfsroot_name);
+ else
+ strcpy(name, trusted_name);
+ } else {
strcpy(name, user_name);
+ }
strcat(name, irixname);
return 0;
}
diff --git a/libattr/libattr.h b/libattr/libattr.h
new file mode 100644
index 0000000..316c1db
--- /dev/null
+++ b/libattr/libattr.h
@@ -0,0 +1,11 @@
+/* Features we provide ourself. */
+
+#define HAVE_ATTR_XATTR_H 1
+#define HAVE_CONFIG_H 1
+
+#define HAVE_FGETXATTR 1
+#define HAVE_FLISTXATTR 1
+#define HAVE_FSETXATTR 1
+#define HAVE_GETXATTR 1
+#define HAVE_LISTXATTR 1
+#define HAVE_SETXATTR 1
diff --git a/man/man2/getxattr.2 b/man/man2/getxattr.2
index 187f820..116c796 100644
--- a/man/man2/getxattr.2
+++ b/man/man2/getxattr.2
@@ -4,6 +4,26 @@
.\" (C) Andreas Gruenbacher, February 2001
.\" (C) Silicon Graphics Inc, September 2001
.\"
+.\" This is free documentation; 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 of
+.\" the License, or (at your option) any later version.
+.\"
+.\" The GNU General Public License's references to "object code"
+.\" and "executables" are to be interpreted as the output of any
+.\" document formatting or typesetting system, including
+.\" intermediate and printed output.
+.\"
+.\" This manual 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 manual; if not, write to the Free
+.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
+.\" USA.
+.\"
.TH GETXATTR 2 "Extended Attributes" "Dec 2001" "System calls"
.SH NAME
getxattr, lgetxattr, fgetxattr \- retrieve an extended attribute value
diff --git a/man/man2/listxattr.2 b/man/man2/listxattr.2
index 7a7c97b..13bcab1 100644
--- a/man/man2/listxattr.2
+++ b/man/man2/listxattr.2
@@ -4,6 +4,26 @@
.\" (C) Andreas Gruenbacher, February 2001
.\" (C) Silicon Graphics Inc, September 2001
.\"
+.\" This is free documentation; 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 of
+.\" the License, or (at your option) any later version.
+.\"
+.\" The GNU General Public License's references to "object code"
+.\" and "executables" are to be interpreted as the output of any
+.\" document formatting or typesetting system, including
+.\" intermediate and printed output.
+.\"
+.\" This manual 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 manual; if not, write to the Free
+.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
+.\" USA.
+.\"
.TH LISTXATTR 2 "Extended Attributes" "Dec 2001" "System calls"
.SH NAME
listxattr, llistxattr, flistxattr \- list extended attribute names
diff --git a/man/man2/removexattr.2 b/man/man2/removexattr.2
index c0a1be7..691ab80 100644
--- a/man/man2/removexattr.2
+++ b/man/man2/removexattr.2
@@ -4,6 +4,26 @@
.\" (C) Andreas Gruenbacher, February 2001
.\" (C) Silicon Graphics Inc, September 2001
.\"
+.\" This is free documentation; 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 of
+.\" the License, or (at your option) any later version.
+.\"
+.\" The GNU General Public License's references to "object code"
+.\" and "executables" are to be interpreted as the output of any
+.\" document formatting or typesetting system, including
+.\" intermediate and printed output.
+.\"
+.\" This manual 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 manual; if not, write to the Free
+.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
+.\" USA.
+.\"
.TH REMOVEXATTR 2 "Extended Attributes" "Dec 2001" "System calls"
.SH NAME
removexattr, lremovexattr, fremovexattr \- remove an extended attribute
diff --git a/man/man2/setxattr.2 b/man/man2/setxattr.2
index df82192..a564904 100644
--- a/man/man2/setxattr.2
+++ b/man/man2/setxattr.2
@@ -4,6 +4,26 @@
.\" (C) Andreas Gruenbacher, February 2001
.\" (C) Silicon Graphics Inc, September 2001
.\"
+.\" This is free documentation; 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 of
+.\" the License, or (at your option) any later version.
+.\"
+.\" The GNU General Public License's references to "object code"
+.\" and "executables" are to be interpreted as the output of any
+.\" document formatting or typesetting system, including
+.\" intermediate and printed output.
+.\"
+.\" This manual 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 manual; if not, write to the Free
+.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
+.\" USA.
+.\"
.TH SETXATTR 2 "Extended Attributes" "Dec 2001" "System calls"
.SH NAME
setxattr, lsetxattr, fsetxattr \- set an extended attribute value
diff --git a/po/Makefile b/po/Makefile
index d676843..2a8fd04 100644
--- a/po/Makefile
+++ b/po/Makefile
@@ -38,7 +38,9 @@ LSRCFILES = $(LINGUAS:%=%.po) $(PKG_NAME).pot
XGETTEXTFILES = $(TOPDIR)/attr/attr.c \
$(TOPDIR)/getfattr/getfattr.c \
- $(TOPDIR)/setfattr/setfattr.c
+ $(TOPDIR)/setfattr/setfattr.c \
+ $(TOPDIR)/libattr/attr_copy_fd.c \
+ $(TOPDIR)/libattr/attr_copy_file.c
default: $(LINGUAS:%=%.mo)
diff --git a/po/attr.pot b/po/attr.pot
index 1e3822f..1fc4698 100644
--- a/po/attr.pot
+++ b/po/attr.pot
@@ -1,3 +1,4 @@
+#: ../attr/attr.c:57
#, c-format
msgid ""
"Usage: %s [-LRq] -s attrname [-V attrvalue] pathname # set value\n"
@@ -6,57 +7,72 @@ msgid ""
" -s reads a value from stdin and -g writes a value to stdout\n"
msgstr ""
+#: ../attr/attr.c:90 ../attr/attr.c:108 ../attr/attr.c:117
msgid "Only one of -s, -g, or -r allowed\n"
msgstr ""
+#: ../attr/attr.c:99
msgid "-V only allowed with -s\n"
msgstr ""
+#: ../attr/attr.c:134
#, c-format
msgid "Unrecognized option: %c\n"
msgstr ""
+#: ../attr/attr.c:140
msgid "A filename to operate on is required\n"
msgstr ""
+#: ../attr/attr.c:167
#, c-format
msgid "Could not set \"%s\" for %s\n"
msgstr ""
+#: ../attr/attr.c:172
#, c-format
msgid "Attribute \"%s\" set to a %d byte value for %s:\n"
msgstr ""
+#: ../attr/attr.c:192
#, c-format
msgid "Could not get \"%s\" for %s\n"
msgstr ""
+#: ../attr/attr.c:197
#, c-format
msgid "Attribute \"%s\" had a %d byte value for %s:\n"
msgstr ""
+#: ../attr/attr.c:212
#, c-format
msgid "Could not remove \"%s\" for %s\n"
msgstr ""
+#: ../attr/attr.c:220
msgid "At least one of -s, -g, or -r is required\n"
msgstr ""
+#: ../getfattr/getfattr.c:111 ../setfattr/setfattr.c:68
msgid "No such attribute"
msgstr ""
+#: ../getfattr/getfattr.c:263
#, c-format
msgid "%s: Removing leading '/' from absolute path names\n"
msgstr ""
+#: ../getfattr/getfattr.c:387
#, c-format
msgid "%s %s -- get extended attributes\n"
msgstr ""
+#: ../getfattr/getfattr.c:389 ../setfattr/setfattr.c:155
#, c-format
msgid "Usage: %s %s\n"
msgstr ""
+#: ../getfattr/getfattr.c:392
msgid ""
" -n, --name=name get the named extended attribute value\n"
" -d, --dump get all extended attribute values\n"
@@ -72,28 +88,34 @@ msgid ""
" --help this help text\n"
msgstr ""
+#: ../getfattr/getfattr.c:489
#, c-format
msgid "%s: invalid regular expression \"%s\"\n"
msgstr ""
+#: ../getfattr/getfattr.c:507 ../setfattr/setfattr.c:247
#, c-format
msgid ""
"Usage: %s %s\n"
"Try `%s --help' for more information.\n"
msgstr ""
+#: ../setfattr/setfattr.c:109
#, c-format
msgid "%s: %s: No filename found in line %d, aborting\n"
msgstr ""
+#: ../setfattr/setfattr.c:113
#, c-format
msgid "%s: No filename found inline %d of standard input, aborting\n"
msgstr ""
+#: ../setfattr/setfattr.c:154
#, c-format
msgid "%s %s -- set extended attributes\n"
msgstr ""
+#: ../setfattr/setfattr.c:157
msgid ""
" -n, --name=name set the value of the named extended attribute\n"
" -x, --remove=name remove the named extended attribute\n"
@@ -103,3 +125,25 @@ msgid ""
" --version print version and exit\n"
" --help this help text\n"
msgstr ""
+
+#: ../libattr/attr_copy_fd.c:82 ../libattr/attr_copy_fd.c:96
+#: ../libattr/attr_copy_file.c:79 ../libattr/attr_copy_file.c:93
+#, c-format
+msgid "listing attributes of %s"
+msgstr ""
+
+#: ../libattr/attr_copy_fd.c:115 ../libattr/attr_copy_fd.c:128
+#: ../libattr/attr_copy_file.c:112 ../libattr/attr_copy_file.c:125
+#, c-format
+msgid "getting attribute %s of %s"
+msgstr ""
+
+#: ../libattr/attr_copy_fd.c:136 ../libattr/attr_copy_file.c:133
+#, c-format
+msgid "setting attributes for %s"
+msgstr ""
+
+#: ../libattr/attr_copy_fd.c:142 ../libattr/attr_copy_file.c:139
+#, c-format
+msgid "setting attribute %s for %s"
+msgstr ""
diff --git a/po/de.po b/po/de.po
index bc075ea..822d34b 100644
--- a/po/de.po
+++ b/po/de.po
@@ -6,13 +6,14 @@ msgid ""
msgstr ""
"Project-Id-Version: attr-2.2.0\n"
"POT-Creation-Date: 2002-12-02 00:45+0100\n"
-"PO-Revision-Date: 2002-12-02 00:45+0100\n"
+"PO-Revision-Date: 2003-01-23 01:31+0100\n"
"Last-Translator: Andreas Grünbacher <a.gruenbacher@computer.org>\n"
"Language-Team: <de@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+#: ../attr/attr.c:57
#, c-format
msgid ""
"Usage: %s [-LRq] -s attrname [-V attrvalue] pathname # set value\n"
@@ -23,59 +24,75 @@ msgstr ""
"Verwendung: %s [-LRq] -s attrname [-V attrvalue] pfadname # Wert setzen\n"
" %s [-LRq] -g attrname pfadname # Wert lesen\n"
" %s [-LRq] -r attrname pfadname # Wert entfernen\n"
-" -s liest einen Wert von stdin, -g schreibt einen Wert auf stdout\n"
+" -s liest einen Wert von stdin, -g schreibt einen Wert auf "
+"stdout\n"
+#: ../attr/attr.c:90 ../attr/attr.c:108 ../attr/attr.c:117
msgid "Only one of -s, -g, or -r allowed\n"
msgstr "Nur eine der Optionen -s, -g, oder -r erlaubt\n"
+#: ../attr/attr.c:99
msgid "-V only allowed with -s\n"
msgstr "-V nur mit -s erlaubt\n"
+#: ../attr/attr.c:134
#, c-format
msgid "Unrecognized option: %c\n"
msgstr "Unbekannte Option: %c\n"
+#: ../attr/attr.c:140
msgid "A filename to operate on is required\n"
msgstr "Der Name der zu verwendenden Datei ist erforderlich\n"
+#: ../attr/attr.c:167
#, c-format
msgid "Could not set \"%s\" for %s\n"
msgstr "Konnte \"%s\" für %s nicht setzen\n"
+#: ../attr/attr.c:172
#, c-format
msgid "Attribute \"%s\" set to a %d byte value for %s:\n"
msgstr "Attribut \"%1$s\" von %3$s auf einen %2$d-Byte-Wert gesetzt:\n"
+#: ../attr/attr.c:192
#, c-format
msgid "Could not get \"%s\" for %s\n"
msgstr "Konnte \"%s\" von %s nicht lesen\n"
+#: ../attr/attr.c:197
#, c-format
msgid "Attribute \"%s\" had a %d byte value for %s:\n"
msgstr "Attribut \"%1$s\" von %3$s hat einen %2$d-Byte-Wert:\n"
+#: ../attr/attr.c:212
#, c-format
msgid "Could not remove \"%s\" for %s\n"
msgstr "Konnte \"%s\" von %s nicht entfernen\n"
+#: ../attr/attr.c:220
msgid "At least one of -s, -g, or -r is required\n"
msgstr "Eine der Optionen -s, -g, oder -r ist erforderlich\n"
+#: ../getfattr/getfattr.c:111 ../setfattr/setfattr.c:68
msgid "No such attribute"
msgstr "Kein solches Attribut"
+#: ../getfattr/getfattr.c:263
#, c-format
msgid "%s: Removing leading '/' from absolute path names\n"
msgstr "%s: Entferne führenden '/' von absoluten Pfadnamen\n"
+#: ../getfattr/getfattr.c:387
#, c-format
msgid "%s %s -- get extended attributes\n"
msgstr "%s %s -- erweiterte Attribute lesen\n"
+#: ../getfattr/getfattr.c:389 ../setfattr/setfattr.c:155
#, c-format
msgid "Usage: %s %s\n"
msgstr "Verwendung: %s %s\n"
+#: ../getfattr/getfattr.c:392
msgid ""
" -n, --name=name get the named extended attribute value\n"
" -d, --dump get all extended attribute values\n"
@@ -103,28 +120,34 @@ msgstr ""
" --version Die Version ausgeben\n"
" --help Diese Hilfe\n"
+#: ../getfattr/getfattr.c:489
#, c-format
msgid "%s: invalid regular expression \"%s\"\n"
msgstr "%s: ungültiger regulärer Ausdruck \"%s\"\n"
+#: ../getfattr/getfattr.c:507 ../setfattr/setfattr.c:247
#, c-format
msgid ""
"Usage: %s %s\n"
"Try `%s --help' for more information.\n"
msgstr "Weiterführende Informationen mit `%s --help'.\n"
+#: ../setfattr/setfattr.c:109
#, c-format
msgid "%s: %s: No filename found in line %d, aborting\n"
msgstr "%s: %s: Kein Dateiname in Zeile %d gefunden, Abbruch\n"
+#: ../setfattr/setfattr.c:113
#, c-format
msgid "%s: No filename found inline %d of standard input, aborting\n"
msgstr "%s: Kein Dateiname in Zeile %d der Standardeingabe gefunden, Abbruch\n"
+#: ../setfattr/setfattr.c:154
#, c-format
msgid "%s %s -- set extended attributes\n"
msgstr "%s %s -- Erweiterte Attribute setzen\n"
+#: ../setfattr/setfattr.c:157
msgid ""
" -n, --name=name set the value of the named extended attribute\n"
" -x, --remove=name remove the named extended attribute\n"
@@ -141,3 +164,25 @@ msgstr ""
" --restore=datei Erweiterte Attribute wiederhestellen\n"
" --version Die Version ausgeben\n"
" --help Diese Hilfe\n"
+
+#: ../libattr/attr_copy_fd.c:82 ../libattr/attr_copy_fd.c:96
+#: ../libattr/attr_copy_file.c:79 ../libattr/attr_copy_file.c:93
+#, c-format
+msgid "listing attributes of %s"
+msgstr "Auslisten von Attributen von %s"
+
+#: ../libattr/attr_copy_fd.c:115 ../libattr/attr_copy_fd.c:128
+#: ../libattr/attr_copy_file.c:112 ../libattr/attr_copy_file.c:125
+#, c-format
+msgid "getting attribute %s of %s"
+msgstr "Lesen von Attribut %s von %s"
+
+#: ../libattr/attr_copy_fd.c:136 ../libattr/attr_copy_file.c:133
+#, c-format
+msgid "setting attributes for %s"
+msgstr "Setzen von Attributen für %s"
+
+#: ../libattr/attr_copy_fd.c:142 ../libattr/attr_copy_file.c:139
+#, c-format
+msgid "setting attribute %s for %s"
+msgstr "Setzen von Attribut %s für %s"