2 # Save access control options
4 require './frox-lib.pl';
6 &error_setup($text{'acl_err'});
9 &save_opt_textbox($conf, "Timeout", \&check_timeout);
10 &save_opt_textbox($conf, "MaxForks", \&check_forks);
11 &save_opt_textbox($conf, "MaxForksPerHost", \&check_forks);
12 &save_opt_textbox($conf, "MaxTransferRate", \&check_rate);
13 &save_yesno($conf, "DoNTP");
14 &save_opt_textbox($conf, "NTPAddress", \&check_ntp);
16 for($i=0; defined($in{"action_$i"}); $i++) {
17 next if (!$in{"action_$i"});
19 push(@val, $in{"action_$i"});
20 if ($in{"src_${i}_def"}) {
24 &valid_srcdest($in{"src_$i"}) ||
25 &error(&text('acl_esrc', $i+1));
26 push(@val, $in{"src_$i"});
29 if ($in{"dest_${i}_def"}) {
33 &valid_srcdest($in{"dest_$i"}) ||
34 &error(&text('acl_edest', $i+1));
35 push(@val, $in{"dest_$i"});
37 if (!$in{"ports_${i}_def"}) {
38 foreach $p (split(/,/, $in{"ports_$i"})) {
39 $p =~ /^\d+$/ || $p =~ /^\d+\-\d+$/ ||
40 &error(&text('acl_eports', $i+1));
42 push(@val, $in{"ports_$i"});
44 push(@acl, join(" ", @val));
46 @acl || &error($text{'acl_enone'});
47 &save_directive($conf, "ACL", \@acl);
49 &lock_file($config{'frox_conf'});
51 &unlock_file($config{'frox_conf'});
57 return $_[0] =~ /^\d+$/ ? undef : $text{'acl_etimeout'};
62 return $_[0] =~ /^\d+$/ ? undef : $text{'acl_eforks'};
67 return $_[0] =~ /^\d+$/ ? undef : $text{'acl_erate'};
72 return $_[0] =~ /^(\S+):(\d+)$/ && &to_ipaddress("$1") ? undef
79 return &to_ipaddress($_[0]) ||
80 ($_[0] =~ /^([0-9\.]+)\/(\d+)$/ &&
81 &check_ipaddress($1) && $2 > 0 && $2 <= 32) ||
82 ($_[0] =~ /^([0-9\.]+)\/([0-9\.]+)$/ &&
83 &check_ipaddress($1) && &check_ipaddress($2));