3 # Save allowed and denied IP addresses
5 require './jabber-lib.pl';
7 &error_setup($text{'ips_err'});
9 $conf = &get_jabber_config();
10 $io = &find("io", $conf);
11 @oldallow = &find("allow", $io);
12 @olddeny = &find("deny", $io);
14 # Validate and store inputs
15 if (!$in{'allow_def'}) {
16 foreach $a (split(/\s+/, $in{'allow'})) {
17 push(@allow, &check_addr($a, "allow"));
20 if (!$in{'deny_def'}) {
21 foreach $a (split(/\s+/, $in{'deny'})) {
22 push(@deny, &check_addr($a, "deny"));
25 &save_directive($io, "allow", \@allow);
26 &save_directive($io, "deny", \@deny);
27 &save_jabber_config($conf);
32 if (&check_ipaddress($_[0])) {
33 return [ $_[1], [ {}, "ip", [ { }, "0", $_[0] ] ] ];
35 elsif ($_[0] =~ /^(\S+)\/(\S+)$/ &&
36 &check_ipaddress($1) && &check_ipaddress($2)) {
37 return [ $_[1], [ {}, "ip", [ { }, "0", $1 ],
38 "mask", [ { }, "0", $2 ] ] ];
41 &error(&text('ips_eaddr', $_[0]));