summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgitaccess12
1 files changed, 11 insertions, 1 deletions
diff --git a/gitaccess b/gitaccess
index 6a0f461..7e24c4e 100755
--- a/gitaccess
+++ b/gitaccess
@@ -30,9 +30,19 @@
# command="~/bin/gitaccess <username>" ecdsa-sha2-nistp521 AAAAE2v....
#
+# Detect if someone tries to launch this script from this script, thus creating
+# an infinite recursive loop spawning subshells.
+if [ "${SSH_ORIGINAL_COMMAND:-}" == "$(basename ${0})" ]; then
+ printf "ERROR: Blocking infinite recursion\n"
+ exit 1
+fi
+
+
+# All checks passed...
+
# The first argument should be the username, as defailed in the script
# instructions
export GIT_USER="${1}"
# Environmental variables set up. Proceed as was originally planned.
-/usr/bin/bash -c "${SSH_ORIGINAL_COMMAND}"
+/usr/bin/env git shell -c "${SSH_ORIGINAL_COMMAND}"

Generated by cgit