contrib/solaris/opensshd.in patch

Zoran Milojevic Zoran.Milojevic at SS8.com
Sat Jan 19 08:04:27 EST 2002


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
"One Better" 
Tel: +1-613-592-2100/x3231  Fax: +1-613-592-9634


> -----Original Message-----
> From: Rob Mallory [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
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20020118/d35d96f4/attachment.html 


More information about the openssh-unix-dev mailing list