pam_mount/pam_mount-0.18-umount-home-dir.dif

28 lines
852 B
Plaintext

--- scripts/umount.crypt 2006-07-11 17:01:46.000000000 -0400
+++ scripts/umount.crypt 2007-01-23 10:35:30.000000000 -0500
@@ -57,6 +57,15 @@
exit 1;
fi;
+# kill remaining user processes if we're unmounting a user's home dir
+USER=`stat --format=%U $1 2>/dev/null` && getent passwd "$USER" | grep -e ":$1:" &> /dev/null
+if test $? -eq 0; then
+ lsof -t $1 | xargs kill -TERM &> /dev/null
+ sleep 1
+ lsof -t $1 | xargs kill -9 &> /dev/null
+ sleep 1
+fi
+
# ask cryptsetup about the underlying device
#
REALDEVICE=` "$CRYPTSETUP" status "$DMDEVICE" | sed -n '/device/s/[ ]*device:[ ]*//p'`;
@@ -69,7 +78,7 @@
# Check for LUKS
#
-if "$CRYPTSETUP" isLuks "$DEVICE" 2>/dev/null; then
+if "$CRYPTSETUP" isLuks "$REALDEVICE" 2>/dev/null; then
"$CRYPTSETUP" luksClose "$DMDEVICE";
else
"$CRYPTSETUP" remove "$DMDEVICE";