>From 94dd14e7d2b08d1cdaf1f65e8b63c8a6f7669209 Mon Sep 17 00:00:00 2001 From: Markus Steinborn Date: Tue, 17 Dec 2013 15:26:17 +0100 Subject: [PATCH 3/3] Do not store filesystem dependent xattrs (i.e. ACLs etc) --- src/tar.c | 4 +++- src/xattrs.c | 9 +++++++++ src/xheader.c | 11 ++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/tar.c b/src/tar.c index ba24c43..c667ccd 100644 --- a/src/tar.c +++ b/src/tar.c @@ -1985,7 +1985,9 @@ parse_opt (int key, char *arg, struct argp_state *state) break; case XATTR_OPTION: - set_xattr_option (1); + set_archive_format ("posix"); + xattrs_option = xattrs_option >= 0 && xattrs_option < 3 ? xattrs_option+1 : + xattrs_option < 0 ? 1 : xattrs_option; break; case NO_XATTR_OPTION: diff --git a/src/xattrs.c b/src/xattrs.c index 9c2901a..5cd1e3a 100644 --- a/src/xattrs.c +++ b/src/xattrs.c @@ -929,6 +929,14 @@ xattrs_xattrs_get (int parentfd, char const *file_name, size_t len = strlen (attr); ssize_t aret = 0; + if (strncmp (attr, "user.", strlen("user.")) && + strncmp (attr, "trusted.", strlen("trusted.")) && + strncmp (attr, "lustre.", strlen("lustre.")) && + (xattrs_option != 2 || strncmp (attr, "security.", strlen("security."))) && + xattrs_option != 3 + ) + goto next_attr; /* only store normal xattrs */ + /* Archive all xattrs during creation, decide at extraction time * which ones are of interest/use for the target filesystem. */ while (((fd == 0) @@ -946,6 +954,7 @@ xattrs_xattrs_get (int parentfd, char const *file_name, call_arg_warn ((fd == 0) ? "lgetxattrat" : "fgetxattr", file_name); +next_attr: attr += len + 1; xret -= len + 1; } diff --git a/src/xheader.c b/src/xheader.c index 8dda580..a5d026a 100644 --- a/src/xheader.c +++ b/src/xheader.c @@ -1792,7 +1792,16 @@ struct xhdr_tab const xhdr_tab[] = { /* We are storing all extended attributes using this rule even if some of them were stored by some previous rule (duplicates) -- we just have to make sure they are restored *only once* during extraction later on. */ - { "SCHILY.xattr", xattr_coder, xattr_decoder, 0, true }, + + /* xattrs use the star format. note we only save some variants... */ + { "SCHILY.xattr.user", xattr_coder, xattr_decoder, 0, true }, + { "SCHILY.xattr.security", xattr_coder, xattr_decoder, 0, true }, + { "SCHILY.xattr.trusted", xattr_coder, xattr_decoder, 0, true }, + { "SCHILY.xattr.lustre", xattr_coder, xattr_decoder, 0, true }, +// { "SCHILY.xattr.security.NTACL", xattr_coder, xattr_decoder, 0, true }, + + /* ignore everything else in the xattr namespaces... */ + { "SCHILY.xattr", dummy_coder, dummy_decoder, 0, true }, { NULL, NULL, NULL, 0, false } }; -- 2.7.4