2 shess@winternet
.com (Scott Hess
)
3 andrew_abernathy@wire
.seanet
.com (Andrew Abernathy
)
4 michal@ellpspace
.math
.ualberta
.ca (Michal Jaegermann
)
6 for contributing programs that can take the place
7 of the pppdown script
. I have included Scott Hess
's
8 (now modified) here. If you would like to see the other program, please
11 ======================================================================
13 From shess@winternet.com Mon Jan 9 02:45 EST 1995
14 Date: Mon, 9 Jan 95 01:45 CST
15 From: shess@winternet.com (Scott Hess)
16 Reply-To: shess@winternet.com (Scott Hess)
17 To: Steve Perkins <perkins@cps.msu.edu>
18 Subject: Bringing down ppp.
22 In any case, having to run pppdown as root has been annoying,
23 because I don't like to run things as root more than necessary
.
24 In other words
, more than about once a week is too often
:-). So
,
25 I wrote the following quick
&dirty hack
. Basic operation is to read
26 the pppd pid from a file where it
's stored and send a SIGINT to
27 that process. Since there's
not a shell script in sight
, this
28 should be a reasonably safe program to make setuid root
. [I
'll
29 have to think on what someone can do if they crack it or /etc/ppp
30 and can send SIGINT to just anyone. Perhaps it should check to
31 see if the process is really a pppd? Oh, well.]
33 howard:/tmp> ls -l /usr/local/ppp/bin/killppp
35 -rwsr-sr-x 1 root 1464 Jan 7 12:41 /usr/local/ppp/bin/killppp*
36 howard:/tmp> cat /usr/local/ppp/src/killppp.c
39 * Originally written by Scott Hess <shess@winternet.com>
40 * and later modified by Michal Jaegermann <michal@ellpspace.math.ualberta.ca>
50 #define PIDF "/etc/ppp/ppp0.pid"
59 if( NULL == (ff = fopen( PIDF, "r"))) {
60 perror( "opening " PIDF
61 "\nppp0 link does not seem to be active" );
66 if( fscanf( ff, "%d", &pid)<1) {
67 fprintf( stderr, "Cannot read pid from" PIDF "\n");
73 if( kill( pid, SIGINT)==-1) {
74 perror( "killing pppd");
75 fprintf( stderr, "removing stale" PIDF "file\n");
76 if (0 != unlink( PIDF)) {
77 perror("cannot remove" PIDF);
86 scott hess <shess@winternet.com> (WWW to "http://www.winternet.com/~shess/")
87 Home: 12901 Upton Avenue South, #326 Burnsville, MN 55337 (612) 895-1208
88 Office: 101 W. Burnsville Pkwy, Suite 108E, Burnsville, MN 55337 890-1332
89 <?If you haven't the time to design
, where will you find the time to debug
?>