<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>RE: contrib/solaris/opensshd.in patch</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>Here's a bit simpler change that accomplishes the same task:</FONT>
</P>
<P><FONT SIZE=2>--- ./opensshd.in.old Fri Jan 18 15:47:21 2002</FONT>
<BR><FONT SIZE=2>+++ ./opensshd.in Fri Jan 18 15:47:00 2002</FONT>
<BR><FONT SIZE=2>@@ -23,7 +23,9 @@</FONT>
<BR><FONT SIZE=2> killproc() {</FONT>
<BR><FONT SIZE=2> _procname=$1</FONT>
<BR><FONT SIZE=2> _signal=$2</FONT>
<BR><FONT SIZE=2>- ${PS} -u root | ${AWK} '/'"$_procname"'$/ {print $1}' | ${XARGS} ${KILL}</FONT>
<BR><FONT SIZE=2>+ ${PS} -opid,ppid,fname -u root |\</FONT>
<BR><FONT SIZE=2>+ ${AWK} '/'"$_procname"'$/ {if ($2 == "1") {print $1}}' |\</FONT>
<BR><FONT SIZE=2>+ ${XARGS} ${KILL} -s $_signal</FONT>
<BR><FONT SIZE=2> }</FONT>
</P>
<P><FONT SIZE=2>Zoran</FONT>
<BR><FONT SIZE=2>-- </FONT>
<BR><FONT SIZE=2>Zoran Milojevic</FONT>
<BR><FONT SIZE=2>SS8 Networks Inc. <A HREF="http://www.ss8.com" TARGET="_blank">http://www.ss8.com</A></FONT>
<BR><FONT SIZE=2>"One Better" </FONT>
<BR><FONT SIZE=2>Tel: +1-613-592-2100/x3231 Fax: +1-613-592-9634</FONT>
</P>
<BR>
<P><FONT SIZE=2>> -----Original Message-----</FONT>
<BR><FONT SIZE=2>> From: Rob Mallory [<A HREF="mailto:rmallory@ensemblecom.com">mailto:rmallory@ensemblecom.com</A>]</FONT>
<BR><FONT SIZE=2>> Sent: January 18, 2002 15:02</FONT>
<BR><FONT SIZE=2>> To: openssh-unix-dev@mindrot.org</FONT>
<BR><FONT SIZE=2>> Subject: contrib/solaris/opensshd.in patch</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> This patch adds the seatbelts which _only_ kill parent sshd </FONT>
<BR><FONT SIZE=2>> procs... -RMallory</FONT>
<BR><FONT SIZE=2>> (eg: when you ssh into a machine and pkgadd the new openssh, </FONT>
<BR><FONT SIZE=2>> it will not</FONT>
<BR><FONT SIZE=2>> kill your current (or anyone else's sshd session)</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> onanother_note: the buildpkg.sh could use some exec_prefix </FONT>
<BR><FONT SIZE=2>> functionality...</FONT>
<BR><FONT SIZE=2>> to deal with ./configure --prefix= --exec_prefix=/usr</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> *** bak/opensshd.in Fri Oct 19 13:36:24 2001</FONT>
<BR><FONT SIZE=2>> --- opensshd.in Fri Jan 18 11:47:10 2002</FONT>
<BR><FONT SIZE=2>> ***************</FONT>
<BR><FONT SIZE=2>> *** 8,16 ****</FONT>
<BR><FONT SIZE=2>> KILL=/usr/bin/kill</FONT>
<BR><FONT SIZE=2>> PS=/usr/bin/ps</FONT>
<BR><FONT SIZE=2>> XARGS=/usr/bin/xargs</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> prefix=%%openSSHDir%%</FONT>
<BR><FONT SIZE=2>> --- 8,19 ----</FONT>
<BR><FONT SIZE=2>> KILL=/usr/bin/kill</FONT>
<BR><FONT SIZE=2>> PS=/usr/bin/ps</FONT>
<BR><FONT SIZE=2>> XARGS=/usr/bin/xargs</FONT>
<BR><FONT SIZE=2>> + FGREP=/usr/bin/fgrep</FONT>
<BR><FONT SIZE=2>> + EGREP=/usr/bin/egrep</FONT>
<BR><FONT SIZE=2>> + ME=`/usr/bin/basename $0`</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> prefix=%%openSSHDir%%</FONT>
<BR><FONT SIZE=2>> ***************</FONT>
<BR><FONT SIZE=2>> *** 22,29 ****</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> killproc() {</FONT>
<BR><FONT SIZE=2>> _procname=$1</FONT>
<BR><FONT SIZE=2>> ! _signal=$2</FONT>
<BR><FONT SIZE=2>> ! ${PS} -u root | ${AWK} '/'"$_procname"'$/ {print $1}' | </FONT>
<BR><FONT SIZE=2>> ${XARGS} ${KILL}</FONT>
<BR><FONT SIZE=2>> }</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> --- 25,42 ----</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> killproc() {</FONT>
<BR><FONT SIZE=2>> _procname=$1</FONT>
<BR><FONT SIZE=2>> ! </FONT>
<BR><FONT SIZE=2>> ! #The next line finds only the parent of $_procname if it exists</FONT>
<BR><FONT SIZE=2>> ! PID=`${PS} -le -u root| ${FGREP} $_procname | ${EGREP} -v ${ME} \</FONT>
<BR><FONT SIZE=2>> ! | ${AWK} '{print $5}' | ${EGREP} -v "^1$" | uniq `</FONT>
<BR><FONT SIZE=2>> ! </FONT>
<BR><FONT SIZE=2>> ! if [ -z "$PID" ] ; then</FONT>
<BR><FONT SIZE=2>> ! echo "No parent sshd process found..."</FONT>
<BR><FONT SIZE=2>> ! PID=`${PS} -u root | ${AWK} '/'"$_procname"'$/ </FONT>
<BR><FONT SIZE=2>> {print $1}'`</FONT>
<BR><FONT SIZE=2>> ! test -z "$PID" && /usr/bin/echo "No sshd </FONT>
<BR><FONT SIZE=2>> children found..."</FONT>
<BR><FONT SIZE=2>> ! test -z "$PID" || /usr/bin/echo "Not killing </FONT>
<BR><FONT SIZE=2>> these sshd children: \n$PID"</FONT>
<BR><FONT SIZE=2>> ! else echo "Killing $PID" ; ${KILL} ${PID}</FONT>
<BR><FONT SIZE=2>> ! fi</FONT>
<BR><FONT SIZE=2>> }</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> _______________________________________________</FONT>
<BR><FONT SIZE=2>> openssh-unix-dev@mindrot.org mailing list</FONT>
<BR><FONT SIZE=2>> <A HREF="http://www.mindrot.org/mailman/listinfo/openssh-unix-dev" TARGET="_blank">http://www.mindrot.org/mailman/listinfo/openssh-unix-dev</A></FONT>
<BR><FONT SIZE=2>> </FONT>
</P>
</BODY>
</HTML>