sap-vpn.pl
changeset 5 9e64828e7d70
parent 3 01314d620fe0
child 6 9ff263c701ef
equal deleted inserted replaced
4:74ef29e9ab00 5:9e64828e7d70
    11 use Pod::Usage;
    11 use Pod::Usage;
    12 use File::Basename;
    12 use File::Basename;
    13 use English qw(-no_match_vars);
    13 use English qw(-no_match_vars);
    14 
    14 
    15 ($EUID, $UID) = ($UID, $EUID);    # release ROOT, doesn't harm, if not suid
    15 ($EUID, $UID) = ($UID, $EUID);    # release ROOT, doesn't harm, if not suid
    16 ($0) = ($0 =~ /([\w-]+)/);        # untaint $0
    16 ($0) = ($0 =~ /([\/\w-]+)/);      # untaint $0
    17 
    17 
    18 use constant ME => basename $0;
    18 use constant ME => basename $0;
    19 
    19 
    20 delete @ENV{ grep /PATH/, keys %ENV };
    20 delete @ENV{ grep /PATH/, keys %ENV };
    21 $ENV{PATH} = "/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/sbin:/bin";
    21 $ENV{PATH} = "/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/sbin:/bin";
   218                 qw(noauth crtscts passive noproxyarp local)
   218                 qw(noauth crtscts passive noproxyarp local)
   219             ) or die ME . ": Can't exec: $!\n";
   219             ) or die ME . ": Can't exec: $!\n";
   220 
   220 
   221         }
   221         }
   222         wait;
   222         wait;
   223 	die ME . ": pppd didn't return sucessfully (rc: @{[$? >> 8]})\n" if $?;
   223         die ME . ": pppd didn't return sucessfully (rc: @{[$? >> 8]})\n" if $?;
   224     }
   224     }
   225 
   225 
   226     # now executing the script
   226     # now executing the script
   227     # if there is some script name supplied
   227     # if there is some script name supplied
   228 
   228 
   239 
   239 
   240                 $UID = $EUID = $owner;
   240                 $UID = $EUID = $owner;
   241                 $GID = $EGID = $group;
   241                 $GID = $EGID = $group;
   242             }
   242             }
   243 
   243 
   244             verbose "% executing script $opt_script with uid $UID and gid $GID\n";
   244             verbose
       
   245               "% executing script $opt_script with uid $UID and gid $GID\n";
   245 
   246 
   246             exec $opt_script
   247             exec $opt_script
   247               or die ME . ": Can't exec $opt_script: $!\n";
   248               or die ME . ": Can't exec $opt_script: $!\n";
   248         }
   249         }
   249         $pid = wait;
   250         $pid = wait;
   353 
   354 
   354 Your D|C|I user, not really optional. (no default)
   355 Your D|C|I user, not really optional. (no default)
   355 
   356 
   356 =back
   357 =back
   357 
   358 
       
   359 =head1 VERSION and SOURCE
       
   360 
       
   361     Id:	    $Id$
       
   362     URL:    $URL$
       
   363 
   358 =cut
   364 =cut
   359 
   365 
   360 ###
   366 ###
   361 ### End of file.
   367 ### End of file.
   362 ###
   368 ###