Handle hostnames with upper-case letters
[webmin.git] / itsecur-firewall / save_spoof.cgi
1 #!/usr/bin/perl
2 # save_spoof.cgi
3 # Save spoofing settings
4
5 require './itsecur-lib.pl';
6 &can_edit_error("spoof");
7 &lock_itsecur_files();
8 &ReadParse();
9
10 &error_setup($text{'spoof_err'});
11 if ($in{'spoof'}) {
12         $iface = $in{'iface'} || $in{'iface_other'};
13         $iface =~ /^[a-z0-9:\.]+$/ || &error($text{'nat_eiface'});
14         }
15 else {
16         }
17 @nets = split(/\s+/, $in{'nets'});
18 foreach $n (@nets) {
19         $n =~ /^([0-9\.]+)\/(\d+)$/ &&
20                 $2 >= 0 && $2 <= 32 &&
21                 &check_ipaddress("$1") ||
22                         &error(&text('spoof_enet', $n));
23         }
24 !$iface || @nets || &error($text{'spoof_enets'});
25 &automatic_backup();
26 &save_spoof($iface, @nets);
27 &unlock_itsecur_files();
28 &remote_webmin_log("update", "spoof");
29 &redirect("");
30