[nfs-utils/f20] gssd: set $HOME to prevent recursion when home dirs are on kerberized NFS mount

Jeff Layton jlayton at fedoraproject.org
Wed Jan 22 12:24:12 UTC 2014


commit bbf031107bcf251acc5f1878173a0fc45120e97a
Author: Jeff Layton <jlayton at redhat.com>
Date:   Wed Jan 22 07:10:26 2014 -0500

    gssd: set $HOME to prevent recursion when home dirs are on kerberized NFS mount
    
    Signed-off-by: Jeff Layton <jlayton at redhat.com>

 gssd-set-HOME-to-prevent-recursion.patch |   51 ++++++++++++++++++++++++++++++
 nfs-utils.spec                           |    7 +++-
 2 files changed, 57 insertions(+), 1 deletions(-)
---
diff --git a/gssd-set-HOME-to-prevent-recursion.patch b/gssd-set-HOME-to-prevent-recursion.patch
new file mode 100644
index 0000000..b340287
--- /dev/null
+++ b/gssd-set-HOME-to-prevent-recursion.patch
@@ -0,0 +1,51 @@
+From a06291c8db92f6ef3614beb7bbadcfcf7c3054b7 Mon Sep 17 00:00:00 2001
+From: Jeff Layton <jlayton at redhat.com>
+Date: Tue, 21 Jan 2014 13:28:54 -0500
+Subject: [PATCH] gssd: set $HOME to prevent recursion when home dirs are on
+ kerberized NFS mount
+
+Some krb5 routines will attempt to access files in the user's home
+directory. This is problematic for gssd when the user's homedir is
+on a kerberized NFS mount as it will end up deadlocked.
+
+Fix this by setting $HOME unconditionally to "/".
+
+Signed-off-by: Jeff Layton <jlayton at redhat.com>
+---
+ utils/gssd/gssd.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
+index fdad153..611ef1a 100644
+--- a/utils/gssd/gssd.c
++++ b/utils/gssd/gssd.c
+@@ -46,6 +46,7 @@
+ 
+ #include <unistd.h>
+ #include <err.h>
++#include <errno.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -161,6 +162,18 @@ main(int argc, char *argv[])
+ 		}
+ 	}
+ 
++	/*
++	 * Some krb5 routines try to scrape info out of files in the user's
++	 * home directory. This can easily deadlock when that homedir is on a
++	 * kerberized NFS mount. By setting $HOME unconditionally to "/", we
++	 * prevent this behavior in routines that use $HOME in preference to
++	 * the results of getpw*.
++	 */
++	if (setenv("HOME", "/", 1)) {
++		printerr(1, "Unable to set $HOME: %s\n", strerror(errno));
++		exit(1);
++	}
++
+ 	i = 0;
+ 	ccachesearch[i++] = strtok(ccachedir, ":");
+ 	do {
+-- 
+1.8.4.2
+
diff --git a/nfs-utils.spec b/nfs-utils.spec
index bd8714c..0657b04 100644
--- a/nfs-utils.spec
+++ b/nfs-utils.spec
@@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser
 Name: nfs-utils
 URL: http://sourceforge.net/projects/nfs
 Version: 1.2.9
-Release: 2.1%{?dist}
+Release: 2.1.bz1052902%{?dist}
 Epoch: 1
 
 # group all 32bit related archs
@@ -42,6 +42,7 @@ Patch100: nfs-utils-1.2.1-statdpath-man.patch
 Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch
 Patch102: nfs-utils-1.2.3-sm-notify-res_init.patch
 Patch103: nfs-utils-1.2.5-idmap-errmsg.patch
+Patch104: gssd-set-HOME-to-prevent-recursion.patch
 
 Group: System Environment/Daemons
 Provides: exportfs    = %{epoch}:%{version}-%{release}
@@ -100,6 +101,7 @@ This package also contains the mount.nfs and umount.nfs program.
 %patch101 -p1
 %patch102 -p1
 %patch103 -p1
+%patch104 -p1
 
 # Remove .orig files
 find . -name "*.orig" | xargs rm -f
@@ -311,6 +313,9 @@ fi
 /sbin/umount.nfs4
 
 %changelog
+* Wed Jan 22 2014 Jeff Layton <jlayton at redhat.com> 1.2.9-2.1.bz1052902
+- gssd: set $HOME to prevent recursion when home dirs are on kerberized NFS mount (bz 1052902)
+
 * Fri Jan 10 2014 Steve Dickson <steved at redhat.com> 1.2.9-2.1
 - Fixed typo in nfs-service file. (bz 1047972)
 


More information about the scm-commits mailing list