From a985096b50666172425610a66cbfa0997a23db6e Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 9 Oct 2016 00:32:49 +0200 Subject: [PATCH] contrib: pam_mount: check if something is already mounted on DST pam_mount is supposed to check that as well, but it seems to get confused by the "command#path" syntax used for FUSE. Let's do it here. --- contrib/pam_mount/gocryptfs_pam_mount.bash | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/pam_mount/gocryptfs_pam_mount.bash b/contrib/pam_mount/gocryptfs_pam_mount.bash index 3c7e48d..e6f31ba 100755 --- a/contrib/pam_mount/gocryptfs_pam_mount.bash +++ b/contrib/pam_mount/gocryptfs_pam_mount.bash @@ -9,9 +9,9 @@ exec >&2 set -eu +MYNAME=$(basename $0) if [[ $# != 4 ]]; then - MYNAME=$(basename $0) echo "$MYNAME: expected 4 arguments, got $#" echo "Example: $MYNAME /home/user.crypt /home/user.plain -o allow_other" echo "Example: $MYNAME /home/user.crypt /home/user.plain -o defaults" @@ -20,6 +20,12 @@ fi SRC=$1 DST=$2 + +if mountpoint "$DST" > /dev/null; then + echo "$MYNAME: something is already mounted on $DST, refusing" + exit 2 +fi + GOPTS="" for OPT in nonempty allow_other quiet; do if [[ $4 == *$OPT* ]]; then