summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2008-07-23 23:12:39 -0700
committerWayne Davison <wayned@samba.org>2008-07-23 23:12:39 -0700
commit581c830c566776ac71f2d012f9960b08cfd0a98d (patch)
treec4d7add97e5c458dfc94181f30d3cc566669ec3f
parent9e58ef45f3e1f073904725240e698d167420462a (diff)
downloadrsync-581c830c566776ac71f2d012f9960b08cfd0a98d.tar.gz
rsync-581c830c566776ac71f2d012f9960b08cfd0a98d.tar.bz2
rsync-581c830c566776ac71f2d012f9960b08cfd0a98d.zip
A couple xattr fixes for --fake-super.
-rw-r--r--NEWS4
-rw-r--r--xattrs.c9
2 files changed, 10 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index da273e1d..d2e05e71 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,10 @@ Changes since 3.0.3:
- Fixed a potential alignment issue in the IRIX ACL code when allocating
the initial "struct acl" object. Also, cast mallocs to avoid warnings.
+ - Fixed a couple issues in the --fake-super handling of xattrs when the
+ destination files have root-level attributes (e.g. selinux values) that
+ a non-root copy can't affect.
+
ENHANCEMENTS:
- Rsync will avoid sending an -e option to the server if an older protocol
diff --git a/xattrs.c b/xattrs.c
index ee21c8d8..85341b37 100644
--- a/xattrs.c
+++ b/xattrs.c
@@ -294,7 +294,7 @@ int copy_xattrs(const char *source, const char *dest)
size_t datum_len;
char *name, *ptr;
#ifdef HAVE_LINUX_XATTRS
- int user_only = am_sender ? 0 : !am_root;
+ int user_only = am_sender ? 0 : am_root <= 0;
#endif
/* This puts the name list into the "namebuf" buffer. */
@@ -745,6 +745,9 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
ssize_t list_len;
size_t i, len;
char *name, *ptr, sum[MAX_DIGEST_LEN];
+#ifdef HAVE_LINUX_XATTRS
+ int user_only = am_root <= 0;
+#endif
size_t name_len;
int ret = 0;
@@ -820,8 +823,8 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
#ifdef HAVE_LINUX_XATTRS
/* We always ignore the system namespace, and non-root
* ignores everything but the user namespace. */
- if (am_root ? HAS_PREFIX(name, SYSTEM_PREFIX)
- : !HAS_PREFIX(name, USER_PREFIX))
+ if (user_only ? !HAS_PREFIX(name, USER_PREFIX)
+ : HAS_PREFIX(name, SYSTEM_PREFIX))
continue;
#endif
if (am_root < 0 && name_len > RPRE_LEN