diff options
author | lpsolit%gmail.com <> | 2006-06-03 21:23:12 +0200 |
---|---|---|
committer | lpsolit%gmail.com <> | 2006-06-03 21:23:12 +0200 |
commit | 1a18e5fc2c3678e9a4a3049b9289e417ce174c7e (patch) | |
tree | e63669d54a68eb921c69c9b78d79b1dd5f7563c3 /Bugzilla/Auth.pm | |
parent | f2df808db17259949894a6431f4bdee6448ef6b5 (diff) | |
download | bugzilla-1a18e5fc2c3678e9a4a3049b9289e417ce174c7e.tar.gz bugzilla-1a18e5fc2c3678e9a4a3049b9289e417ce174c7e.tar.xz |
Bug 340104: Move Bugzilla::Auth::get_netaddr() in Util.pm - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=justdave
Diffstat (limited to 'Bugzilla/Auth.pm')
-rw-r--r-- | Bugzilla/Auth.pm | 38 |
1 files changed, 0 insertions, 38 deletions
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<true> if users can change their own email address, =back -=head1 CLASS FUNCTIONS - -C<Bugzilla::Auth> contains several helper methods to be used by -authentication or login modules. - -=over 4 - -=item C<Bugzilla::Auth::get_netaddr($ipaddr)> - -Given an ip address, this returns the associated network address, using -C<Param('loginnetmask')> 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 |