diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d450213 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/ntfs-3g_ntfsprogs-2015.3.14.tgz diff --git a/.libguestfs-winsupport.metadata b/.libguestfs-winsupport.metadata new file mode 100644 index 0000000..2f1bc36 --- /dev/null +++ b/.libguestfs-winsupport.metadata @@ -0,0 +1 @@ +0ebd9adffd5a6ddcfbacade6be8efe1eba4b1a08 SOURCES/ntfs-3g_ntfsprogs-2015.3.14.tgz diff --git a/README.md b/README.md deleted file mode 100644 index 98f42b4..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/CVE-2015-3202.patch b/SOURCES/CVE-2015-3202.patch new file mode 100644 index 0000000..6e5cf08 --- /dev/null +++ b/SOURCES/CVE-2015-3202.patch @@ -0,0 +1,80 @@ +--- ntfs-3g_ntfsprogs-2015.3.14/libfuse-lite/mount_util.c.ref 2015-03-14 15:10:12.000000000 +0100 ++++ ntfs-3g_ntfsprogs-2015.3.14/libfuse-lite/mount_util.c 2015-05-18 11:02:50.330654300 +0200 +@@ -66,6 +66,7 @@ + return -1; + } + if (res == 0) { ++ char *env = NULL; + char templ[] = "/tmp/fusermountXXXXXX"; + char *tmp; + +@@ -87,8 +88,8 @@ + exit(1); + } + rmdir(tmp); +- execl("/sbin/mount", "/sbin/mount", "-F", type, "-o", opts, +- fsname, mnt, NULL); ++ execle("/sbin/mount", "/sbin/mount", "-F", type, "-o", opts, ++ fsname, mnt, NULL, &env); + fprintf(stderr, "%s: failed to execute /sbin/mount: %s\n", progname, + strerror(errno)); + exit(1); +@@ -120,9 +121,16 @@ + return -1; + } + if (res == 0) { ++ char *env = NULL; ++ + setuid(geteuid()); +- execl("/sbin/umount", "/sbin/umount", !lazy ? "-f" : NULL, mnt, +- NULL); ++ if (lazy) { ++ execle("/sbin/umount", "/sbin/umount", mnt, ++ NULL, &env); ++ } else { ++ execle("/sbin/umount", "/sbin/umount", "-f", mnt, ++ NULL, &env); ++ } + fprintf(stderr, "%s: failed to execute /sbin/umount: %s\n", progname, + strerror(errno)); + exit(1); +@@ -302,6 +310,7 @@ + return 0; + } + if (res == 0) { ++ char *env = NULL; + char templ[] = "/tmp/fusermountXXXXXX"; + char *tmp; + +@@ -325,8 +334,8 @@ + exit(1); + } + rmdir(tmp); +- execl("/bin/mount", "/bin/mount", "-i", "-f", "-t", type, "-o", opts, +- fsname, mnt, NULL); ++ execle("/bin/mount", "/bin/mount", "-i", "-f", "-t", type, "-o", opts, ++ fsname, mnt, NULL, &env); + fprintf(stderr, "%s: failed to execute /bin/mount: %s\n", progname, + strerror(errno)); + exit(1); +@@ -353,11 +362,18 @@ + return -1; + } + if (res == 0) { ++ char *env = NULL; ++ + if (setuid(geteuid())) + fprintf(stderr, "%s: failed to setuid : %s\n", progname, + strerror(errno)); +- execl("/bin/umount", "/bin/umount", "-i", mnt, lazy ? "-l" : NULL, +- NULL); ++ if (lazy) { ++ execle("/bin/umount", "/bin/umount", "-i", mnt, "-l", ++ NULL, &env); ++ } else { ++ execle("/bin/umount", "/bin/umount", "-i", mnt, ++ NULL, &env); ++ } + fprintf(stderr, "%s: failed to execute /bin/umount: %s\n", progname, + strerror(errno)); + exit(1); diff --git a/SOURCES/ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch b/SOURCES/ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch new file mode 100644 index 0000000..8fd39c6 --- /dev/null +++ b/SOURCES/ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch @@ -0,0 +1,16 @@ +diff -up ntfs-3g_ntfsprogs-2011.10.9-RC/ntfsprogs/ntfsck.c.OLD ntfs-3g_ntfsprogs-2011.10.9-RC/ntfsprogs/ntfsck.c +--- ntfs-3g_ntfsprogs-2011.10.9-RC/ntfsprogs/ntfsck.c.OLD 2011-10-11 10:24:02.381335115 -0400 ++++ ntfs-3g_ntfsprogs-2011.10.9-RC/ntfsprogs/ntfsck.c 2011-10-11 10:26:41.513559206 -0400 +@@ -877,7 +877,11 @@ int main(int argc, char **argv) + if (errors) + return 2; + if (unsupported) +- return 1; ++ ntfs_log_info("ntfsck was unable to run properly.\n"); ++ // If we return 1 here, we fail for ntfs services fscking on boot just because ++ // ntfsck isn't smart enough to handle 99% of cases. So, we just return 0. ++ // return 1; ++ return 0; + return 0; + } + diff --git a/SPECS/libguestfs-winsupport.spec b/SPECS/libguestfs-winsupport.spec new file mode 100644 index 0000000..4f53382 --- /dev/null +++ b/SPECS/libguestfs-winsupport.spec @@ -0,0 +1,155 @@ +%global ntfs_version 2015.3.14 + +# debuginfo makes no sense for this package, so disable it +%global debug_package %{nil} + +Name: libguestfs-winsupport +Version: 7.2 +Release: 1%{?dist} +Summary: Add support for Windows guests to virt-v2v and virt-p2v + +URL: http://www.ntfs-3g.org/ +License: GPLv2+ +ExclusiveArch: aarch64 x86_64 + +# This package shouldn't be installed without installing the base +# libguestfs package. +Requires: libguestfs >= 1:1.28.1 + +# Source and patches for ntfs. Try to keep this in step with Fedora. +Source0: http://tuxera.com/opensource/ntfs-3g_ntfsprogs-%{ntfs_version}.tgz + +Patch0: ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch +Patch1: CVE-2015-3202.patch + +BuildRequires: libtool, libattr-devel +BuildRequires: libconfig-devel, libgcrypt-devel, gnutls-devel, libuuid-devel + + +%description +This optional package adds support for Windows guests (NTFS) to the +virt-v2v and virt-p2v programs. + + +%prep +%setup -q -n ntfs-3g_ntfsprogs-%{ntfs_version} +%patch0 -p1 -b .unsupported +%patch1 -p1 -b .cve + + +%build +CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64" +%configure \ + --disable-static \ + --disable-ldconfig \ + --exec-prefix=/ \ + --enable-crypto \ + --enable-extras \ + --enable-quarantined +make %{?_smp_mflags} LIBTOOL=%{_bindir}/libtool + + +%install +# Build it into a destdir which is not the final buildroot. +mkdir destdir +make LIBTOOL=%{_bindir}/libtool DESTDIR=$(pwd)/destdir install +rm -rf destdir/%{_libdir}/*.la +rm -rf destdir/%{_libdir}/*.a + +rm -rf destdir/%{_sbindir}/mount.ntfs-3g +cp -a destdir/%{_bindir}/ntfs-3g destdir/%{_sbindir}/mount.ntfs-3g + +# Actually make some symlinks for simplicity... +# ... since we're obsoleting ntfsprogs-fuse +pushd destdir/%{_bindir} +ln -s ntfs-3g ntfsmount +popd +pushd destdir/%{_sbindir} +ln -s mount.ntfs-3g mount.ntfs-fuse +# And since there is no other package in Fedora that provides an ntfs +# mount... +ln -s mount.ntfs-3g mount.ntfs +# Need this for fsck to find it +ln -s ../bin/ntfsck fsck.ntfs +popd +mv destdir/sbin/* destdir/%{_sbindir} +rmdir destdir/sbin + +# We get this on our own, thanks. +rm -r destdir/%{_defaultdocdir} + +# Remove development files. +rm -r destdir/%{_includedir} +rm -r destdir/%{_libdir}/pkgconfig + +# Take the destdir and put it into a tarball for the libguestfs appliance. +mkdir -p %{buildroot}%{_libdir}/guestfs/supermin.d +pushd destdir +tar zcf %{buildroot}%{_libdir}/guestfs/supermin.d/zz-winsupport.tar.gz . +popd + + +%files +%doc AUTHORS ChangeLog COPYING CREDITS NEWS README + +%{_libdir}/guestfs/supermin.d/zz-winsupport.tar.gz + + +%changelog +* Tue Jul 07 2015 Richard W.M. Jones - 7.2-1 +- Rebase and rebuild for RHEL 7.2 + resolves: rhbz#1240278 + +* Tue Jun 30 2015 Richard W.M. Jones - 7.1-6 +- Bump version and rebuild. + related: rhbz#1221583 + +* Fri May 15 2015 Richard W.M. Jones - 7.1-5 +- Enable aarch64 architecture. + resolves: rhbz#1221583 + +* Thu Aug 28 2014 Richard W.M. Jones - 7.1-4 +- Enable debuginfo support and stripping. + resolves: rhbz#1100319 + +* Thu Aug 28 2014 Richard W.M. Jones - 7.1-3 +- Add patches from Fedora package which add fstrim support. + resolves: rhbz#1100319 + +* Mon Jul 21 2014 Richard W.M. Jones - 7.1-2 +- New package for RHEL 7.1 +- Rebase to ntfs-3g 2014.2.15 + resolves: rhbz#1100319 +- Change the package so it works with supermin5. +- Remove dependency on external FUSE. + +* Wed Apr 3 2013 Richard W.M. Jones - 7.0-2 +- Resync against Rawhide package (ntfs-3g 2013.1.13). +- Drop HAL file since HAL is dead. + resolves: rhbz#819939 + +* Thu Dec 20 2012 Richard W.M. Jones - 7.0-1 +- New package for RHEL 7 + resolves: rhbz#819939 +- Resync against Rawhide package. + +* Mon Mar 28 2011 Richard W.M. Jones - 1.0-7 +- Disable debuginfo package. + resolves: RHBZ#691555. + +* Tue Mar 8 2011 Richard W.M. Jones - 1.0-6 +- Require libguestfs 1.7.17 (newer version in RHEL 6.1). +- Require febootstrap-supermin-helper instead of febootstrap + resolves: RHBZ#670299. + +* Thu Jul 1 2010 Richard W.M. Jones - 1.0-5 +- Make sure intermediate lib* directories are created in hostfiles (RHBZ#603429) + +* Thu Jun 3 2010 Richard W.M. Jones - 1.0-4 +- Requires fuse-libs (RHBZ#599300). + +* Fri May 21 2010 Richard W.M. Jones - 1.0-3 +- ExclusiveArch x86_64. + +* Tue May 18 2010 Richard W.M. Jones - 1.0-2 +- Package Windows support for libguestfs.