|
|
|
@ -1,42 +1,39 @@ |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
my @net = (); |
|
|
|
|
|
|
|
|
|
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++; |
|
|
|
|
push @net, "($_)"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$reg .= join('|', @net); |
|
|
|
|
$reg .= '/'; |
|
|
|
|
$reg =~ s/\./\\\./g; |
|
|
|
|
|
|
|
|
|
$conf->{'macros'}->{'localAccess'} = '(' . $reg . ") ? '1':'0'"; |
|
|
|
|
|
|
|
|
|
$reg = '$ipAddr =~ /^'; |
|
|
|
|
$count = 0; |
|
|
|
|
@net = (); |
|
|
|
|
|
|
|
|
|
# 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++; |
|
|
|
|
push @net, "($_)"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$reg .= join('|', @net); |
|
|
|
|
$reg .= '/'; |
|
|
|
|
$reg =~ s/\./\\\./g; |
|
|
|
|
|
|
|
|
|