[PATCH v2 1/2] xattrs: Skip security.evm extended attribute
Stefan Berger
stefanb at linux.vnet.ibm.com
Thu Dec 1 12:28:18 UTC 2016
The security.evm extended attribute is fully owned by the Linux kernel
and cannot be directly written from userspace. Therefore, we can always
skip it.
---
xattrs.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/xattrs.c b/xattrs.c
index b105392..3b72e61 100644
--- a/xattrs.c
+++ b/xattrs.c
@@ -255,6 +255,9 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
if (user_only ? !HAS_PREFIX(name, USER_PREFIX)
: HAS_PREFIX(name, SYSTEM_PREFIX))
continue;
+
+ if (!strcmp(name, "security.evm"))
+ continue;
#endif
/* No rsync.%FOO attributes are copied w/o 2 -X options. */
@@ -358,6 +361,9 @@ int copy_xattrs(const char *source, const char *dest)
if (user_only ? !HAS_PREFIX(name, USER_PREFIX)
: HAS_PREFIX(name, SYSTEM_PREFIX))
continue;
+
+ if (!strcmp(name, "security.evm"))
+ continue;
#endif
datum_len = 0;
@@ -828,7 +834,9 @@ void receive_xattr(int f, struct file_struct *file)
}
#ifdef HAVE_LINUX_XATTRS
/* Non-root can only save the user namespace. */
- if (am_root <= 0 && !HAS_PREFIX(name, USER_PREFIX)) {
+ if (am_root <= 0 &&
+ (!HAS_PREFIX(name, USER_PREFIX) ||
+ !strcmp(name, "security.evm"))) {
if (!am_root) {
free(ptr);
continue;
@@ -962,6 +970,11 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
for (i = 0; i < xalp->count; i++) {
name = rxas[i].name;
+#ifdef HAVE_LINUX_XATTRS
+ if (!strcmp(name, "security.evm"))
+ continue;
+#endif
+
if (XATTR_ABBREV(rxas[i])) {
/* See if the fnamecmp version is identical. */
len = name_len = rxas[i].name_len;
@@ -1030,6 +1043,9 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
if (user_only ? !HAS_PREFIX(name, USER_PREFIX)
: HAS_PREFIX(name, SYSTEM_PREFIX))
continue;
+
+ if (!strcmp(name, "security.evm"))
+ continue;
#endif
if (am_root < 0 && name_len > RPRE_LEN
&& name[RPRE_LEN] == '%' && strcmp(name, XSTAT_ATTR) == 0)
--
2.7.4
More information about the rsync
mailing list