]> git.madduck.net Git - code/molly-guard.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Also require $SSH_CONNECTION to be unset or warn
authormartin f. krafft <madduck@madduck.net>
Wed, 12 Mar 2008 18:54:14 +0000 (19:54 +0100)
committermartin f. krafft <madduck@madduck.net>
Wed, 12 Mar 2008 18:54:14 +0000 (19:54 +0100)
This takes care of some more cases, such as #469951, in which screen was
used, which creates a new pty which is thus no longer owned by sshd.

Signed-off-by: martin f. krafft <madduck@madduck.net>
shutdown

index 24898273d6fc6ab41691583bbe716e8c84048118..29bd8fe607102b41839c1ba30f78fc3d7e1c6d7e 100755 (executable)
--- a/shutdown
+++ b/shutdown
@@ -90,12 +90,13 @@ test -t 0                    || do_real_cmd
 # only run if we are being called over SSH, that is if the current terminal
 # was created by sshd.
 PTS=$(readlink /proc/$$/fd/0)
-if ! pgrep -f "^sshd.+${PTS#/dev/}[[:space:]]*$" >/dev/null; then
-  if [ $PRETEND_SSH -eq 1 ]; then
-    echo "I: this is not an SSH session, but --pretend-ssh was given..."
-  else
-    do_real_cmd
-  fi
+if ! pgrep -f "^sshd.+${PTS#/dev/}[[:space:]]*$" >/dev/null \
+  && [ -z "$SSH_CONNECTION" ]; then
+    if [ $PRETEND_SSH -eq 1 ]; then
+      echo "I: this is not an SSH session, but --pretend-ssh was given..."
+    else
+      do_real_cmd
+    fi
 else
   echo "W: $ME: SSH session detected!"
 fi