mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-27 11:13:24 +02:00
Hinzugefuegt:
* Interface fuer den Benutzer dial. Geandert: * Standardland fuer OpenSSL-Zertifikate ist statt GB jetzt DE. * makegraphs gefixt. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@214 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
70
html/cgi-bin/dial/dial.cgi
Normal file
70
html/cgi-bin/dial/dial.cgi
Normal file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# SmoothWall CGIs
|
||||
#
|
||||
# This code is distributed under the terms of the GPL
|
||||
#
|
||||
# (c) The SmoothWall Team
|
||||
#
|
||||
# $Id: dial.cgi,v 1.4.2.3 2005/02/22 22:21:55 gespinasse Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
# enable only the following on debugging purpose
|
||||
#use warnings;
|
||||
#use CGI::Carp 'fatalsToBrowser';
|
||||
|
||||
require '/var/ipfire/general-functions.pl';
|
||||
require "${General::swroot}/lang.pl";
|
||||
require "${General::swroot}/header.pl";
|
||||
|
||||
my %cgiparams=();
|
||||
|
||||
$cgiparams{'ACTION'} = '';
|
||||
&Header::getcgihash(\%cgiparams);
|
||||
|
||||
if ($cgiparams{'ACTION'} eq $Lang::tr{'dial profile'})
|
||||
{
|
||||
my $profile = $cgiparams{'PROFILE'};
|
||||
my %tempcgiparams = ();
|
||||
$tempcgiparams{'PROFILE'} = '';
|
||||
&General::readhash("${General::swroot}/ppp/settings-$cgiparams{'PROFILE'}",
|
||||
\%tempcgiparams);
|
||||
|
||||
# make a link from the selected profile to the "default" one.
|
||||
unlink("${General::swroot}/ppp/settings");
|
||||
link("${General::swroot}/ppp/settings-$cgiparams{'PROFILE'}",
|
||||
"${General::swroot}/ppp/settings");
|
||||
system ("/bin/touch", "${General::swroot}/ppp/updatesettings");
|
||||
|
||||
# read in the new params "early" so we can write secrets.
|
||||
%cgiparams = ();
|
||||
&General::readhash("${General::swroot}/ppp/settings", \%cgiparams);
|
||||
$cgiparams{'PROFILE'} = $profile;
|
||||
$cgiparams{'BACKUPPROFILE'} = $profile;
|
||||
&General::writehash("${General::swroot}/ppp/settings-$cgiparams{'PROFILE'}",
|
||||
\%cgiparams);
|
||||
|
||||
# write secrets file.
|
||||
open(FILE, ">/${General::swroot}/ppp/secrets") or die "Unable to write secrets file.";
|
||||
flock(FILE, 2);
|
||||
my $username = $cgiparams{'USERNAME'};
|
||||
my $password = $cgiparams{'PASSWORD'};
|
||||
print FILE "'$username' * '$password'\n";
|
||||
chmod 0600, "${General::swroot}/ppp/secrets";
|
||||
close FILE;
|
||||
|
||||
&General::log("$Lang::tr{'profile made current'} $tempcgiparams{'PROFILENAME'}");
|
||||
$cgiparams{'ACTION'} = "$Lang::tr{'dial'}";
|
||||
}
|
||||
|
||||
if ($cgiparams{'ACTION'} eq $Lang::tr{'dial'}) {
|
||||
system('/etc/rc.d/rc.red','start') == 0
|
||||
or &General::log("Dial failed: $?"); }
|
||||
elsif ($cgiparams{'ACTION'} eq $Lang::tr{'hangup'}) {
|
||||
system('/etc/rc.d/rc.red','stop') == 0
|
||||
or &General::log("Hangup failed: $?"); }
|
||||
sleep 1;
|
||||
|
||||
print "Status: 302 Moved\nLocation: /cgi-bin/dial/index.cgi\n\n";
|
||||
Reference in New Issue
Block a user