[ecryptfs-utils/f15] update of mtab does not work if it's a symlink (#706911)

Michal Hlavinka mhlavink at fedoraproject.org
Tue Jun 7 07:56:07 UTC 2011


commit d1e28dda5a15432333327b3c643322b87e266289
Author: Michal Hlavinka <mhlavink at redhat.com>
Date:   Tue Jun 7 09:55:54 2011 +0200

    update of mtab does not work if it's a symlink (#706911)

 ecryptfs-utils-87-mtab.patch |   39 +++++++++++++++++++++++++++++++++++++++
 ecryptfs-utils.spec          |    9 ++++++++-
 2 files changed, 47 insertions(+), 1 deletions(-)
---
diff --git a/ecryptfs-utils-87-mtab.patch b/ecryptfs-utils-87-mtab.patch
new file mode 100644
index 0000000..bebbec1
--- /dev/null
+++ b/ecryptfs-utils-87-mtab.patch
@@ -0,0 +1,39 @@
+From eed8b4e5f7635f67ac68be426ade7964086e8fa0 Mon Sep 17 00:00:00 2001
+From: Christophe Dumez <christophe.dumez at intel.com>
+Date: Sun, 29 May 2011 17:23:53 +0300
+Subject: [PATCH] Do not update mtab if it is a symlink
+
+mount.ecryptfs_private: Do not attempt to update
+mtab if it is a symbolic link.
+---
+ src/utils/mount.ecryptfs_private.c |   11 ++++++++++-
+ 1 files changed, 10 insertions(+), 1 deletions(-)
+
+diff --git a/src/utils/mount.ecryptfs_private.c b/src/utils/mount.ecryptfs_private.c
+index c19fa84..0fa02e6 100644
+--- a/src/utils/mount.ecryptfs_private.c
++++ b/src/utils/mount.ecryptfs_private.c
+@@ -264,9 +264,18 @@ int is_mounted(char *dev, char *mnt, char *sig, int mounting) {
+ 
+ 
+ int update_mtab(char *dev, char *mnt, char *opt) {
+-/* Update /etc/mtab with new mount entry.
++/* Update /etc/mtab with new mount entry unless it is a symbolic link
+  * Return 0 on success, 1 on failure.
+  */
++	char dummy;
++	int useMtab;
++	/* Check if mtab is a symlink */
++	useMtab = (readlink("/etc/mtab", &dummy, 1) < 0);
++	if (!useMtab) {
++		/* No need updating mtab */
++		return 0;
++	}
++
+ 	FILE *fh;
+ 	struct mntent m;
+ 	fh = setmntent("/etc/mtab", "a");
+-- 
+1.7.5.2
+
+
diff --git a/ecryptfs-utils.spec b/ecryptfs-utils.spec
index 42a6376..ffca490 100644
--- a/ecryptfs-utils.spec
+++ b/ecryptfs-utils.spec
@@ -5,7 +5,7 @@
 
 Name: ecryptfs-utils
 Version: 87
-Release: 2%{?dist}
+Release: 3%{?dist}
 Summary: The eCryptfs mount helper and support libraries
 Group: System Environment/Base
 License: GPLv2+
@@ -35,6 +35,9 @@ Patch8: ecryptfs-utils-86-manpage.patch
 # autoload ecryptfs module in ecryptfs-setup-private when needed, rhbz#707608
 Patch9: ecryptfs-utils-87-autoload.patch
 
+# sent upstream, for e-u < 88, rhbz#706911
+Patch10: ecryptfs-utils-87-mtab.patch
+
 # allow building with -Werror
 Patch999: ecryptfs-utils-75-werror.patch
 
@@ -82,6 +85,7 @@ the interface supplied by the ecryptfs-utils library.
 %patch6 -p1 -b .fgetc
 %patch8 -p1 -b .manfix
 %patch9 -p1 -b .autoload
+%patch10 -p1 -b .mtabfix
 %patch999 -p1 -b .werror
 
 %build
@@ -210,6 +214,9 @@ rm -rf $RPM_BUILD_ROOT
 %{python_sitearch}/ecryptfs-utils/_libecryptfs.so
 
 %changelog
+* Tue Jun 07 2011 Michal Hlavinka <mhlavink at redhat.com> - 87-3
+- update of mtab does not work if it's a symlink (#706911)
+
 * Thu May 26 2011 Michal Hlavinka <mhlavink at redhat.com> - 87-2
 - auto-load ecryptfs module in ecryptfs-setup-private
 


More information about the scm-commits mailing list