Commit 67bd8daa authored by jocuri%softhome.net's avatar jocuri%softhome.net

Patch for bug 323627: Setting "loginnetmask" to 0 should disable IP checking;…

Patch for bug 323627: Setting "loginnetmask" to 0 should disable IP checking; patch by Jesse Erlbaum <jesse@erlbaum.net>, r=vladd, a=justdave.
parent 2283885c
...@@ -55,7 +55,7 @@ sub has_db { ...@@ -55,7 +55,7 @@ sub has_db {
return 0; return 0;
} }
# Returns the network address for a given ip # Returns the network address for a given IP
sub get_netaddr { sub get_netaddr {
my $ipaddr = shift; my $ipaddr = shift;
...@@ -68,6 +68,9 @@ sub get_netaddr { ...@@ -68,6 +68,9 @@ sub get_netaddr {
my $maskbits = Param('loginnetmask'); 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);
$addr <<= (32-$maskbits); $addr <<= (32-$maskbits);
return join(".", unpack("CCCC", pack("N", $addr))); return join(".", unpack("CCCC", pack("N", $addr)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment