From 1a18e5fc2c3678e9a4a3049b9289e417ce174c7e Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sat, 3 Jun 2006 19:23:12 +0000 Subject: Bug 340104: Move Bugzilla::Auth::get_netaddr() in Util.pm - Patch by Frédéric Buclin r/a=justdave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/Auth.pm | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'Bugzilla/Auth.pm') diff --git a/Bugzilla/Auth.pm b/Bugzilla/Auth.pm index 0e57371a2..daacc677a 100644 --- a/Bugzilla/Auth.pm +++ b/Bugzilla/Auth.pm @@ -199,28 +199,6 @@ sub _handle_login_result { return $user; } -# Returns the network address for a given IP -sub get_netaddr { - my $ipaddr = shift; - - # Check for a valid IPv4 addr which we know how to parse - if (!$ipaddr || $ipaddr !~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { - return undef; - } - - my $addr = unpack("N", pack("CCCC", split(/\./, $ipaddr))); - - my $maskbits = Param('loginnetmask'); - - # Make Bugzilla ignore the IP address if loginnetmask is set to 0 - return "0.0.0.0" if ($maskbits == 0); - - $addr >>= (32-$maskbits); - - $addr <<= (32-$maskbits); - return join(".", unpack("CCCC", pack("N", $addr))); -} - 1; __END__ @@ -383,22 +361,6 @@ Returns: C if users can change their own email address, =back -=head1 CLASS FUNCTIONS - -C contains several helper methods to be used by -authentication or login modules. - -=over 4 - -=item C - -Given an ip address, this returns the associated network address, using -C as the netmask. This can be used to obtain data -in order to restrict weak authentication methods (such as cookies) to -only some addresses. - -=back - =head1 STRUCTURE This section is mostly interesting to developers who want to implement -- cgit v1.2.3-24-g4f1b