Hello,

I was checking this bug during the Paris BSP which is taking place right
now. What about throwing in another check like the following one in
addition to the tty and SSH_CONNECTION ones?

    is_child_of_sshd() {
      pid=$$
      ppid=$PPID
      # Walk up to init.
      while [ $pid -ne 1 ]; do
        grep -q sshd /proc/$ppid/cmdline && return 0
        pid=$ppid
        ppid=$(grep ^PPid: /proc/$pid/status | tr -dc 0-9)
      done
      return 1
    }
    [...]
    if ! pgrep -f "^sshd.+${PTS#/dev/}\>" >/dev/null \
          && [ -z "${SSH_CONNECTION:-}" ] \
          && ! is_child_of_sshd; then
    [...]

It seems reasonable to me to try to climb up the process tree until we
meet a process with "sshd" in the command line (or, maybe better (?),
with "sshd" in the proc/<pid>/exe symlink). Still not the cleanest of the
solutions, but should be quite portable.

Ludovico
-- 
<l...@dovi.co>                                        IRC: garden@freenode
OpenPGP: 1024D/63D2D5D907F89BB8         Jabber/gtalk: garde...@gmail.com



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to