#! /bin/sh

 if read proto cookie && [ -n "$DISPLAY" ]; then
                     if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
                             # X11UseLocalhost=yes
                             echo add unix:`echo $DISPLAY |
                                 cut -c11-` $proto $cookie
                     else
                             # X11UseLocalhost=no
                             echo add $DISPLAY $proto $cookie
                     fi | /usr/openwin/bin/xauth -q -
             fi

PPID=`/bin/ps -oppid -p $$ | tail -1` # the sh -c that started this shell script 
PPPID=`/bin/ps -oppid -p $PPID | tail -1` # the sshd that started this sh and will exec real shell

PPPID=`/bin/ps -oppid -p $PPPID | tail -1` # the sshd that started the prior sshd

/usr/bin/logger -i -p auth.info "SSHD child process $PPPID spawned by `/bin/ps -oppid -p $PPPID | tail -1`"

