summaryrefslogtreecommitdiff
path: root/lib/VNDB/Util/Misc.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2014-08-29 11:50:41 +0200
committerYorhel <git@yorhel.nl>2014-08-29 11:50:41 +0200
commit1cf4252f2d313bc1e3f460a1d379a49b751d1170 (patch)
tree4385788e5553fe7376e4063961e8c7a9cbce7663 /lib/VNDB/Util/Misc.pm
parent9a1bd46a568094ff62cfc85bc488b116042718b8 (diff)
API: Make sure to honor the new login throttle
Diffstat (limited to 'lib/VNDB/Util/Misc.pm')
-rw-r--r--lib/VNDB/Util/Misc.pm23
1 files changed, 1 insertions, 22 deletions
diff --git a/lib/VNDB/Util/Misc.pm b/lib/VNDB/Util/Misc.pm
index 7ee0701b..b7503c24 100644
--- a/lib/VNDB/Util/Misc.pm
+++ b/lib/VNDB/Util/Misc.pm
@@ -6,9 +6,8 @@ use warnings;
use Exporter 'import';
use TUWF ':html';
use VNDB::Func;
-use Socket 'inet_pton', 'inet_ntop', 'AF_INET6';
-our @EXPORT = qw|filFetchDB ieCheck normIP|;
+our @EXPORT = qw|filFetchDB ieCheck|;
my %filfields = (
@@ -143,25 +142,5 @@ sub ieCheck {
return 0;
}
-
-# Normalized IP address to use for duplicate detection/throttling. For IPv4
-# this is just the normal address, but for IPv6 this is the /48 subnet, with
-# the rest of the address zero'd.
-sub normIP {
- my $s = shift;
- my $ip = $s->reqIP();
- return $ip if $ip !~ /:/;
-
- # There's a whole bunch of IPv6 manipulation modules on CPAN, but many seem
- # quite bloated and still don't offer the functionality to return an IP
- # with its mask applied (admittedly not a common operation). The libc
- # socket functions will do fine in parsing and formatting IPv6 addresses,
- # and the actual masking is quite trivial in binary form.
- $ip = inet_pton AF_INET6, $ip;
- return '::' if !$ip;
- $ip =~ s/^(.{6}).+$/$1 . "\0"x10/e;
- return inet_ntop AF_INET6, $ip;
-}
-
1;