contrib/solaris/opensshd.in patch

Rob Mallory rmallory at ensemblecom.com
Sat Jan 19 07:02:06 EST 2002


This patch adds the seatbelts which  _only_ kill parent sshd procs... -RMallory
(eg: when you ssh into a machine and pkgadd the new openssh, it will not
     kill your current (or anyone else's sshd session)

onanother_note: the buildpkg.sh could use some exec_prefix functionality...
to deal with ./configure --prefix= --exec_prefix=/usr

*** bak/opensshd.in     Fri Oct 19 13:36:24 2001
--- opensshd.in Fri Jan 18 11:47:10 2002
***************
*** 8,16 ****
  KILL=/usr/bin/kill
  PS=/usr/bin/ps
  XARGS=/usr/bin/xargs
  
  prefix=%%openSSHDir%%
--- 8,19 ----
  KILL=/usr/bin/kill
  PS=/usr/bin/ps
  XARGS=/usr/bin/xargs
+ FGREP=/usr/bin/fgrep
+ EGREP=/usr/bin/egrep
+ ME=`/usr/bin/basename $0`
  
  prefix=%%openSSHDir%%
***************
*** 22,29 ****
  
  killproc() {
     _procname=$1
!    _signal=$2
!    ${PS} -u root | ${AWK} '/'"$_procname"'$/ {print $1}' | ${XARGS} ${KILL}
  }
  
  
--- 25,42 ----
  
  killproc() {
     _procname=$1
! 
! #The next line finds only the parent of $_procname if it exists
!    PID=`${PS} -le -u root| ${FGREP} $_procname | ${EGREP} -v ${ME} \
!                 | ${AWK}  '{print $5}' | ${EGREP} -v "^1$" | uniq `
! 
!    if [ -z "$PID" ] ;  then
!             echo "No parent sshd process found..."
!             PID=`${PS} -u root | ${AWK} '/'"$_procname"'$/ {print $1}'`
!             test -z "$PID" && /usr/bin/echo "No sshd children found..."
!             test -z "$PID" || /usr/bin/echo "Not killing these sshd children: \n$PID"
!    else     echo "Killing $PID" ; ${KILL} ${PID}
!    fi
  }





More information about the openssh-unix-dev mailing list