I have written a setuid/setgid-root Perl script that does the
following:

#!/usr/bin/suidperl -T

use strict;
use warnings;

$ENV{'PATH'} = '/usr/sbin:/usr/bin:/sbin:/bin';

@ARGV == 1 and my ($isp) = $ARGV[0] =~ /^([-0-9A-Za-z_]+)$/
  or die "Usage: ppp-on <ISP>\n";

$< = $>;  # set real to effective uid

system '/sbin/ifconfig', 'eth0', 'down';

system '/usr/sbin/pppd', 'call', $isp and die;

[...]

But when I execute it without doing anything special before, I get the
following in /var/log/messages:

Jun  9 16:48:23 ay pppd[1210]: pppd 2.4.1 started by root, uid 0
Jun  9 16:48:23 ay pppd[1210]: Exit.

i.e. it doesn't work. However, if I type

  /usr/sbin/pppd call the_isp

as root, there's no problem:

Jun  9 16:48:40 ay pppd[1215]: pppd 2.4.1 started by root, uid 0
Jun  9 16:48:40 ay kernel: macserial: i2c-modem detected, id: 1
Jun  9 16:48:40 ay kernel: PowerMac Z8530 serial driver version 2.0
Jun  9 16:48:40 ay kernel: tty00 at 0xd18b0020 (irq = 22) is a Z8530 ESCC (internal 
modem)
Jun  9 16:48:40 ay kernel: tty01 at 0xd18b7000 (irq = 23) is a Z8530 ESCC (IrDA)
Jun  9 16:48:42 ay chat[1217]: abort on (BUSY)
Jun  9 16:48:42 ay chat[1217]: abort on (NO CARRIER)
[...]

and after disconnecting, I can reconnect using my Perl script ppp-on
(that previously failed): I get similar log messages except the
"ay kernel:" lines.

Why doesn't my Perl script work before I connect directly from the
root account?

TIA,

-- 
Vincent Lefèvre <[EMAIL PROTECTED]> - Web: <http://www.vinc17.org/> - 100%
validated (X)HTML - Acorn Risc PC, Yellow Pig 17, Championnat International
des Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to