[tar] Force extended attributes to be stored after fchown(2) (#771927)

Pavel Raiskup praiskup at fedoraproject.org
Thu Jul 12 09:11:02 UTC 2012


commit 58fd5d562d21cfd20295183e202deebc7cf05783
Author: Pavel Raiskup <praiskup at redhat.com>
Date:   Thu Jul 12 11:08:48 2012 +0200

    Force extended attributes to be stored after fchown(2) (#771927)

 tar-1.24-xattrs.patch |   18 ++++++++++--------
 tar.spec              |    4 +++-
 2 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/tar-1.24-xattrs.patch b/tar-1.24-xattrs.patch
index 7140556..cb147b6 100644
--- a/tar-1.24-xattrs.patch
+++ b/tar-1.24-xattrs.patch
@@ -368,17 +368,19 @@ diff -urNp tar-1.24-orig/src/extract.c tar-1.24/src/extract.c
      /* The desired target of the desired link.  */
      char target[1];
    };
-@@ -335,6 +355,10 @@ set_stat (char const *file_name,
- 	utime_error (file_name);
-     }
- 
+@@ -360,6 +380,12 @@ set_stat (char const *file_name,
+ 	    st->stat.st_mode & ~ current_umask,
+ 	    0 < same_permissions_option && ! interdir ? MODE_ALL : MODE_RWX,
+ 	    fd, current_mode, current_mode_mask, typeflag, atflag);
++
++  /* these three calls must be done *after* fd_chown() call because fd_chown
++     causes that linux capabilities becomes cleared */
 +  xattrs_acls_set(st, file_name, typeflag);
 +  xattrs_selinux_set(st, file_name, typeflag);
 +  xattrs_xattrs_set(st, file_name, typeflag);
-+
-   if (0 < same_owner_option && ! interdir)
-     {
-       /* Some systems allow non-root users to give files away.  Once this
+ }
+ 
+ /* For each entry H in the leading prefix of entries in HEAD that do
 @@ -431,6 +455,36 @@ delay_set_stat (char const *file_name, s
    data->atflag = atflag;
    data->after_links = 0;
diff --git a/tar.spec b/tar.spec
index 06cb0ce..84e45f3 100644
--- a/tar.spec
+++ b/tar.spec
@@ -5,7 +5,7 @@ Summary: A GNU file archiving program
 Name: tar
 Epoch: 2
 Version: 1.26
-Release: 7%{?dist}
+Release: 8%{?dist}
 License: GPLv3+
 Group: Applications/Archiving
 URL: http://www.gnu.org/software/tar/
@@ -130,6 +130,8 @@ fi
 %{_infodir}/tar.info*
 
 %changelog
+* Thu Jul 12 2012 Pavel Raiskup <praiskup at redhat.com 2:1.26-8
+- force the fchown() be called before xattrs_set() (#771927)
 * Sat Jun 16 2012 Ondrej Vasik <ovasik at redhat.com> 2:1.26-7
 - store&restore security.capability extended attributes category
   (#771927)


More information about the scm-commits mailing list