mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
wlanap.cgi: Fix copying configuration
This allows to uncheck checkboxes again. Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
@@ -34,6 +34,9 @@ my %selected=();
|
||||
my %checked=();
|
||||
my %wlanapsettings=();
|
||||
|
||||
# Read the configuration file
|
||||
&General::readhash("/var/ipfire/wlanap/settings", \%wlanapsettings);
|
||||
|
||||
# Set defaults
|
||||
&General::set_defaults(\%wlanapsettings, {
|
||||
"APMODE" => "on",
|
||||
@@ -52,11 +55,13 @@ my %wlanapsettings=();
|
||||
"IEEE80211W" => "off",
|
||||
});
|
||||
|
||||
&General::readhash("/var/ipfire/wlanap/settings", \%wlanapsettings);
|
||||
&Header::getcgihash(\%wlanapsettings);
|
||||
my %cgiparams = ();
|
||||
|
||||
# Fetch arguments from browser
|
||||
&Header::getcgihash(\%cgiparams);
|
||||
|
||||
# Find the selected interface
|
||||
my $INTF = &Network::get_intf_by_address($wlanapsettings{'INTERFACE'});
|
||||
my $INTF = &Network::get_intf_by_address($cgiparams{'INTERFACE'});
|
||||
|
||||
delete $wlanapsettings{'__CGI__'};
|
||||
delete $wlanapsettings{'x'};
|
||||
@@ -64,20 +69,36 @@ delete $wlanapsettings{'y'};
|
||||
|
||||
&Header::showhttpheaders();
|
||||
|
||||
if ($wlanapsettings{'ACTION'} eq "$Lang::tr{'save'}") {
|
||||
if ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") {
|
||||
# verify WPA Passphrase - only with enabled enc
|
||||
if ($wlanapsettings{'ENC'} ne "none") {
|
||||
if ($cgiparams{'ENC'} ne "none") {
|
||||
# must be 8 .. 63 characters
|
||||
if ((length($wlanapsettings{'PWD'}) < 8) || (length($wlanapsettings{'PWD'}) > 63)) {
|
||||
if ((length($cgiparams{'PWD'}) < 8) || (length($cgiparams{'PWD'}) > 63)) {
|
||||
$errormessage .= "$Lang::tr{'wlanap invalid wpa'}<br />";
|
||||
}
|
||||
|
||||
# only ASCII alowed
|
||||
if (!($wlanapsettings{'PWD'} !~ /[^\x00-\x7f]/)) {
|
||||
if (!($cgiparams{'PWD'} !~ /[^\x00-\x7f]/)) {
|
||||
$errormessage .= "$Lang::tr{'wlanap invalid wpa'}<br />";
|
||||
}
|
||||
}
|
||||
|
||||
# XXX This needs validation
|
||||
$wlanapsettings{'INTERFACE'} = $cgiparams{'INTERFACE'};
|
||||
$wlanapsettings{'SSID'} = $cgiparams{'SSID'};
|
||||
$wlanapsettings{'HIDESSID'} = ($cgiparams{'HIDESSID'} eq 'on') ? 'on' : 'off';
|
||||
$wlanapsettings{'CLIENTISOLATION'} = ($cgiparams{'CLIENTISOLATION'} eq 'on') ? 'on' : 'off';
|
||||
$wlanapsettings{'COUNTRY'} = $cgiparams{'COUNTRY'};
|
||||
$wlanapsettings{'HW_MODE'} = $cgiparams{'HW_MODE'};
|
||||
$wlanapsettings{'CHANNEL'} = $cgiparams{'CHANNEL'};
|
||||
$wlanapsettings{'NOSCAN'} = ($cgiparams{'NOSCAN'} eq 'on') ? 'on' : 'off';
|
||||
$wlanapsettings{'ENC'} = $cgiparams{'ENC'};
|
||||
$wlanapsettings{'PWD'} = $cgiparams{'PWD'};
|
||||
$wlanapsettings{'IEEE80211W'} = ($cgiparams{'IEEE80211W'} eq 'on') ? 'on' : 'off';
|
||||
$wlanapsettings{'HTCAPS'} = $cgiparams{'HTCAPS'};
|
||||
$wlanapsettings{'VHTCAPS'} = $cgiparams{'VHTCAPS'};
|
||||
$wlanapsettings{'TX_POWER'} = $cgiparams{'TX_POWER'};
|
||||
|
||||
if ($errormessage eq '') {
|
||||
&General::writehash("/var/ipfire/wlanap/settings", \%wlanapsettings);
|
||||
&WriteConfig_hostapd();
|
||||
|
||||
Reference in New Issue
Block a user