The branch, master has been updated
       via  6500e07 Avoid reading ACL/xattr info on filetypes not being copied. 
Make OS X avoid xattr access on device/special files. Fixes bug 5458.
      from  aa3faf5 Separate the dirs from the files in xattrs.text.

;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 6500e0769a56919df1d47759828104a08df850bb
Author: Wayne Davison <way...@samba.org>
Date:   Mon Jan 3 10:26:02 2011 -0800

    Avoid reading ACL/xattr info on filetypes not being copied.
    Make OS X avoid xattr access on device/special files.
    Fixes bug 5458.

-----------------------------------------------------------------------

Summary of changes:
 acls.c       |   19 +++++++++++++++++++
 configure.ac |    2 ++
 xattrs.c     |   27 ++++++++++++++++++---------
 3 files changed, 39 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/acls.c b/acls.c
index 347356d..ef2751c 100644
--- a/acls.c
+++ b/acls.c
@@ -31,6 +31,8 @@ extern int list_only;
 extern int orig_umask;
 extern int numeric_ids;
 extern int inc_recurse;
+extern int preserve_devices;
+extern int preserve_specials;
 
 /* Flags used to indicate what items are being transmitted for an entry. */
 #define XMIT_USER_OBJ (1<<0)
@@ -537,6 +539,23 @@ static int get_rsync_acl(const char *fname, rsync_acl 
*racl,
 int get_acl(const char *fname, stat_x *sxp)
 {
        sxp->acc_acl = create_racl();
+
+       if (S_ISREG(sxp->st.st_mode) || S_ISDIR(sxp->st.st_mode)) {
+               /* Everyone supports this. */
+       } else if (S_ISLNK(sxp->st.st_mode)) {
+               return 0;
+       } else if (IS_SPECIAL(sxp->st.st_mode)) {
+#ifndef NO_SPECIAL_ACLS
+               if (!preserve_specials)
+#endif
+                       return 0;
+       } else if (IS_DEVICE(sxp->st.st_mode)) {
+#ifndef NO_DEVICE_ACLS
+               if (!preserve_devices)
+#endif
+                       return 0;
+       }
+
        if (get_rsync_acl(fname, sxp->acc_acl, SMB_ACL_TYPE_ACCESS,
                          sxp->st.st_mode) < 0) {
                free_acl(sxp);
diff --git a/configure.ac b/configure.ac
index f90109a..22672ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -987,6 +987,8 @@ else
        AC_MSG_RESULT(Using OS X xattrs)
        AC_DEFINE(HAVE_OSX_XATTRS, 1, [True if you have Mac OS X xattrs])
        AC_DEFINE(SUPPORT_XATTRS, 1)
+       AC_DEFINE(NO_DEVICE_XATTRS, 1, [True if device files do not support 
xattrs])
+       AC_DEFINE(NO_SPECIAL_XATTRS, 1, [True if special files do not support 
xattrs])
        ;;
     freebsd*)
        AC_MSG_RESULT(Using FreeBSD extattrs)
diff --git a/xattrs.c b/xattrs.c
index df1a2a1..3a7cb25 100644
--- a/xattrs.c
+++ b/xattrs.c
@@ -33,6 +33,9 @@ extern int am_generator;
 extern int read_only;
 extern int list_only;
 extern int preserve_xattrs;
+extern int preserve_links;
+extern int preserve_devices;
+extern int preserve_specials;
 extern int checksum_seed;
 
 #define RSYNC_XAL_INITIAL 5
@@ -285,18 +288,24 @@ int get_xattr(const char *fname, stat_x *sxp)
        sxp->xattr = new(item_list);
        *sxp->xattr = empty_xattr;
 
-#ifdef NO_SPECIAL_XATTRS
-       if (IS_SPECIAL(sxp->st.st_mode))
-               return 0;
+       if (S_ISREG(sxp->st.st_mode) || S_ISDIR(sxp->st.st_mode)) {
+               /* Everyone supports this. */
+       } else if (S_ISLNK(sxp->st.st_mode)) {
+#ifndef NO_SYMLINK_XATTRS
+               if (!preserve_links)
 #endif
-#ifdef NO_DEVICE_XATTRS
-       if (IS_DEVICE(sxp->st.st_mode))
-               return 0;
+                       return 0;
+       } else if (IS_SPECIAL(sxp->st.st_mode)) {
+#ifndef NO_SPECIAL_XATTRS
+               if (!preserve_specials)
 #endif
-#ifdef NO_SYMLINK_XATTRS
-       if (S_ISLNK(sxp->st.st_mode))
-               return 0;
+                       return 0;
+       } else if (IS_DEVICE(sxp->st.st_mode)) {
+#ifndef NO_DEVICE_XATTRS
+               if (!preserve_devices)
 #endif
+                       return 0;
+       }
 
        if (rsync_xal_get(fname, sxp->xattr) < 0) {
                free_xattr(sxp);


-- 
The rsync repository.
_______________________________________________
rsync-cvs mailing list
rsync-cvs@lists.samba.org
https://lists.samba.org/mailman/listinfo/rsync-cvs

Reply via email to