<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>RE: contrib/solaris/opensshd.in patch</TITLE>
<DEFANGED_META
CONTENT="text/html; charset=iso-8859-1" HTTP-EQUIV="Content-Type"><DEFANGED_META
CONTENT="MS Exchange Server version 5.5.2653.12" NAME="Generator">
<META content="MSHTML 6.00.2712.300" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=224421521-18012002><FONT face=Arial color=#0000ff size=2>Did
you try it? it seems to kill all sshd's here.</FONT></SPAN></DIV>
<DIV><SPAN class=224421521-18012002><FONT face=Arial color=#0000ff
size=2>specificaly, you (or at least I)_don't_ want to kill anything where
$2=="1"</FONT></SPAN></DIV>
<DIV><SPAN class=224421521-18012002><FONT face=Arial color=#0000ff size=2>from
the ps -opid,ppid,fname line to be killed.</FONT></SPAN></DIV>
<DIV><SPAN class=224421521-18012002><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=224421521-18012002><FONT face=Arial color=#0000ff size=2>also I
don't want to kill parents of any procs called "opensshd"</FONT></SPAN></DIV>
<DIV><SPAN class=224421521-18012002><FONT face=Arial color=#0000ff size=2>which
is the name of the script.</FONT></SPAN></DIV>
<DIV><SPAN class=224421521-18012002><FONT face=Arial color=#0000ff
size=2>-Rob</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Zoran Milojevic
[mailto:Zoran.Milojevic@SS8.com]<BR><B>Sent:</B> Friday, January 18, 2002 1:04
PM<BR><B>To:</B> openssh-unix-dev@shitei.mindrot.org<BR><B>Cc:</B> 'Rob
Mallory'<BR><B>Subject:</B> RE: contrib/solaris/opensshd.in
patch<BR><BR></FONT></DIV>
<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></BLOCKQUOTE></BODY></HTML>