From 9b69d7da47080d079c49c098df76894510f29b3c Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Jul 11 2011 11:49:57 +0000 Subject: fix mtab handling everywhere --- diff --git a/ecryptfs-utils-87-mtab.patch b/ecryptfs-utils-87-mtab.patch index bebbec1..d918a33 100644 --- a/ecryptfs-utils-87-mtab.patch +++ b/ecryptfs-utils-87-mtab.patch @@ -1,19 +1,36 @@ -From eed8b4e5f7635f67ac68be426ade7964086e8fa0 Mon Sep 17 00:00:00 2001 -From: Christophe Dumez -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) { +diff -up ecryptfs-utils-87/src/libecryptfs/main.c.mtabfix ecryptfs-utils-87/src/libecryptfs/main.c +--- ecryptfs-utils-87/src/libecryptfs/main.c.mtabfix 2011-07-11 13:46:12.809240356 +0200 ++++ ecryptfs-utils-87/src/libecryptfs/main.c 2011-07-11 13:46:12.825240472 +0200 +@@ -427,9 +427,13 @@ int ecryptfs_mount(char *source, char *t + } + mtab_fd = setmntent("/etc/mtab", "a"); + if (!mtab_fd) { +- rc = -EACCES; +- syslog(LOG_ERR, "Failed to update the mount table\n"); +- goto out; ++ /* it's possible that /etc/mtab is just a symlink to /proc/mounts */ ++ char dummy; ++ if (readlink("/etc/mtab", &dummy, 1) < 0) { ++ rc = -EACCES; ++ syslog(LOG_ERR, "Failed to update the mount table\n"); ++ goto out; ++ } + } + mountent.mnt_fsname = fullpath_source; + mountent.mnt_dir = fullpath_target; +@@ -464,7 +468,7 @@ int ecryptfs_mount(char *source, char *t + } + mountent.mnt_freq = 0; + mountent.mnt_passno = 0; +- if (addmntent(mtab_fd, &mountent)) { ++ if (mtab_fd && addmntent(mtab_fd, &mountent)) { + rc = -EIO; + syslog(LOG_ERR, "Failed to write to the mount " + "table\n"); +diff -up ecryptfs-utils-87/src/utils/mount.ecryptfs_private.c.mtabfix ecryptfs-utils-87/src/utils/mount.ecryptfs_private.c +--- ecryptfs-utils-87/src/utils/mount.ecryptfs_private.c.mtabfix 2011-07-11 13:45:54.927111621 +0200 ++++ ecryptfs-utils-87/src/utils/mount.ecryptfs_private.c 2011-07-11 13:45:54.946111757 +0200 +@@ -219,9 +219,18 @@ int check_ownerships(int uid, char *path int update_mtab(char *dev, char *mnt, char *opt) { @@ -33,7 +50,3 @@ index c19fa84..0fa02e6 100644 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 6dc189f..8351d72 100644 --- a/ecryptfs-utils.spec +++ b/ecryptfs-utils.spec @@ -5,7 +5,7 @@ Name: ecryptfs-utils Version: 87 -Release: 4%{?dist} +Release: 5%{?dist} Summary: The eCryptfs mount helper and support libraries Group: System Environment/Base License: GPLv2+ @@ -35,7 +35,7 @@ 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 +# upstream patch is incomplete, rhbz#706911 Patch10: ecryptfs-utils-87-mtab.patch # fedora/rhel specific, check for pam ecryptfs module before home migration @@ -93,7 +93,7 @@ the interface supplied by the ecryptfs-utils library. %patch999 -p1 -b .werror %build -export CFLAGS="$RPM_OPT_FLAGS -ggdb -O2 -Werror -Wtype-limits" +export CFLAGS="$RPM_OPT_FLAGS -Werror -Wtype-limits" #we're modifing Makefile.am autoreconf -fiv %configure --disable-rpath --enable-tspi --enable-nss --enable-pkcs11-helper @@ -218,6 +218,9 @@ rm -rf $RPM_BUILD_ROOT %{python_sitearch}/ecryptfs-utils/_libecryptfs.so %changelog +* Mon Jul 11 2011 Michal Hlavinka - 87-5 +- fix mtab handling everywhere + * Thu Jun 09 2011 Michal Hlavinka - 87-4 - check for ecryptfs pam module before home dir migration