|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /usr/libexec/webmin/jabber/ |
Upload File : |
#!/usr/bin/perl
# save_ips.cgi
# Save allowed and denied IP addresses
require './jabber-lib.pl';
&ReadParse();
&error_setup($text{'ips_err'});
$conf = &get_jabber_config();
$io = &find("io", $conf);
@oldallow = &find("allow", $io);
@olddeny = &find("deny", $io);
# Validate and store inputs
if (!$in{'allow_def'}) {
foreach $a (split(/\s+/, $in{'allow'})) {
push(@allow, &check_addr($a, "allow"));
}
}
if (!$in{'deny_def'}) {
foreach $a (split(/\s+/, $in{'deny'})) {
push(@deny, &check_addr($a, "deny"));
}
}
&save_directive($io, "allow", \@allow);
&save_directive($io, "deny", \@deny);
&save_jabber_config($conf);
&redirect("");
sub check_addr
{
if (&check_ipaddress($_[0])) {
return [ $_[1], [ {}, "ip", [ { }, "0", $_[0] ] ] ];
}
elsif ($_[0] =~ /^(\S+)\/(\S+)$/ &&
&check_ipaddress($1) && &check_ipaddress($2)) {
return [ $_[1], [ {}, "ip", [ { }, "0", $1 ],
"mask", [ { }, "0", $2 ] ] ];
}
else {
&error(&text('ips_eaddr', $_[0]));
}
}