contrib/solaris/opensshd.in patch

mouring at etoh.eviladmin.org mouring at etoh.eviladmin.org
Sat Jan 19 08:50:47 EST 2002


If we are in agreed.  Then I'll be happy to commit this change.

- Ben

On Fri, 18 Jan 2002, Rob Mallory wrote:

> Hmmm.. you are right. Dunno what I omitted when
> cut n pasted your (nice and unbloated) version.
> ...and yes, I do want to kill the one who $ppid=1,
> {was stuck in thinking ass-backwards like my example}
> yeppers.....
>    anyways, I hope people agree this'd be nice to have
> in the tree..... it saved my butt a few times in the past...
>
>
> -----Original Message-----
> From: Rob Mallory [mailto:rmallory at ensemble.com]
> Sent: Friday, January 18, 2002 1:23 PM
> To: 'Zoran Milojevic'; openssh-unix-dev at shitei.mindrot.org
> Cc: 'Rob Mallory'
> Subject: RE: contrib/solaris/opensshd.in patch
>
>
> Did you try it?  it seems to kill all sshd's here.
> specificaly, you (or at least I)_don't_ want to kill anything where $2=="1"
> from the ps -opid,ppid,fname line to be killed.
>
> also I don't want to kill parents of any procs called "opensshd"
> which is the name of the script.
> -Rob
>
> -----Original Message-----
> From: Zoran Milojevic [mailto:Zoran.Milojevic at SS8.com]
> Sent: Friday, January 18, 2002 1:04 PM
> To: openssh-unix-dev at shitei.mindrot.org
> Cc: 'Rob Mallory'
> Subject: RE: contrib/solaris/opensshd.in patch
>
>
>
> Here's a bit simpler change that accomplishes the same task:
>
> --- ./opensshd.in.old   Fri Jan 18 15:47:21 2002
> +++ ./opensshd.in       Fri Jan 18 15:47:00 2002
> @@ -23,7 +23,9 @@
>  killproc() {
>     _procname=$1
>     _signal=$2
> -   ${PS} -u root | ${AWK} '/'"$_procname"'$/ {print $1}' | ${XARGS} ${KILL}
>
> +   ${PS} -opid,ppid,fname -u root |\
> +      ${AWK} '/'"$_procname"'$/ {if ($2 == "1") {print $1}}' |\
> +      ${XARGS} ${KILL} -s $_signal
>  }
>
> Zoran
> --
> Zoran Milojevic
> SS8 Networks Inc.   http://www.ss8.com <http://www.ss8.com>
> "One Better"
> Tel: +1-613-592-2100/x3231  Fax: +1-613-592-9634
>
>
> > -----Original Message-----
> > From: Rob Mallory [ mailto:rmallory at ensemblecom.com
> <mailto:rmallory at ensemblecom.com> ]
> > Sent: January 18, 2002 15:02
> > To: openssh-unix-dev at mindrot.org
> > Subject: contrib/solaris/opensshd.in patch
> >
> >
> > 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
> >   }
> >
> >
> > _______________________________________________
> > openssh-unix-dev at mindrot.org mailing list
> > http://www.mindrot.org/mailman/listinfo/openssh-unix-dev
> <http://www.mindrot.org/mailman/listinfo/openssh-unix-dev>
> >
>
>




More information about the openssh-unix-dev mailing list