You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.0 KiB
49 lines
1.0 KiB
12 years ago
|
{
|
||
|
|
||
|
my $reg = '$ipAddr =~ /^';
|
||
|
my $count = 0;
|
||
|
|
||
|
# Build a regexp to check if the client IP
|
||
|
# is part of a local network
|
||
|
# Then, we can easily use this macro to restrict
|
||
|
# access to local networks on some applications
|
||
|
|
||
|
foreach my $net ($n->networks){
|
||
|
my $addr = $net->key;
|
||
|
my $mask = $net->prop('Mask') || '255.255.255.255';
|
||
|
$reg .= '|' if ($count > 0);
|
||
|
foreach (esmith::util::computeAllLocalNetworkPrefixes($addr,$mask)){
|
||
|
$reg .= "($_)";
|
||
|
$count++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$reg .= '/';
|
||
|
$reg =~ s/\./\\\./g;
|
||
|
|
||
|
$conf->{'macros'}->{'localAccess'} = '(' . $reg . ") ? '1':'0'";
|
||
|
|
||
|
$reg = '$ipAddr =~ /^';
|
||
|
$count = 0;
|
||
|
|
||
|
# Do the same for extenal SSL access
|
||
|
|
||
|
foreach my $net (split(/[;,]/,(${'httpd-admin'}{'ValidFrom'} || ''))){
|
||
|
my ($addr,$mask) = split(/\//,$net);
|
||
|
$reg .= '|' if ($count > 0);
|
||
|
foreach (esmith::util::computeAllLocalNetworkPrefixes($addr,$mask)){
|
||
|
$reg .= "($_)";
|
||
|
$count++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$reg .= '/';
|
||
|
$reg =~ s/\./\\\./g;
|
||
|
|
||
|
$conf->{'macros'}->{'externalSSLAccess'} = '(' . $reg . ") ? '1':'0'";
|
||
|
|
||
|
$OUT = '';
|
||
|
|
||
|
}
|
||
|
|