Patch Submission: Enable 'poff' to properly end a 'pppd' process when arguments were passed to 'pppd'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch (with context) is attached to this email, and it will allow
/usr/bin/poff to properly end a /usr/sbin/pppd process that was
started with additional arguments.

The patch (without context) is found below (see line 93 of /usr/bin/poff):
-PID=`ps axw | grep "[ /]pppd call $1 *\$" | awk '{print $1}'`
+PID=`ps axw | grep "[ /]pppd call $1" | awk '{print $1}'`

The problem with the current poff script is on line 93 where the
output of `ps axw` is piped into grep. The current regular expression
that grep searches for prevents the PID of the specified pppd process
from being found, which results in the script failing to terminate the
pppd process. The output of poff in that case would be the following:

/usr/bin/poff: I could not find a pppd process for provider 'cit-vpn'.
None stopped.

The reason for this is that the " *\$" at the end of the regular
expression does not match the output of the following example from `ps
axw`:

11846 ?        Ss     0:00 /usr/sbin/pppd call cit-vpn updetach persist

To resolve this issue, I removed the troublesome part of the regular
expression (" *\$") and now grep can properly match the example output
provided above.

I have tested this using ppp 2.4.5-2 in conjunction with
pptpclient-1.7.2-3 on Arch Linux x86_64.
______________________________________________
Jason St. John
Graduate Research Assistant,
Department of Computer and Information Technology,
Purdue University
--- poff	2011-10-01 19:49:52.262318864 -0400
+++ poff_patched	2011-10-01 19:51:29.179125908 -0400
@@ -83,21 +83,21 @@
 # pppd's.
 if test "$#" -eq 0 -o "$MODE" = "all" ; then
     $KILL -$SIG $PIDS || {
         echo "$0: $KILL failed.  None ${DONE}."
         exit 1
     }
     exit 0
 fi
 
 # There is an argument, so kill the pppd started on that provider.
-PID=`ps axw | grep "[ /]pppd call $1 *\$" | awk '{print $1}'`
+PID=`ps axw | grep "[ /]pppd call $1" | awk '{print $1}'`
 if test -n "$PID" ; then
     $KILL -$SIG $PID || {
         echo "$0: $KILL failed.  None ${DONE}."
         exit 1
     }
 else
    echo "$0: I could not find a pppd process for provider '$1'. None ${DONE}."
    exit 1
 fi
 exit 0

[Index of Archives]     [Linux Audio Users]     [Linux for Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux