r40843 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40842‎ | r40843 | r40844 >
Date:05:10, 15 September 2008
Author:tstarling
Status:old
Tags:
Comment:
* Fix incorrect hexadecimal capitalisation in hashtable entries, which was causing IPs with hexadecimal digits in the A-F range to not be trusted.
* Remove some commented-out code
Modified paths:
  • /trunk/extensions/TrustedXFF/generate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TrustedXFF/generate.php
@@ -50,17 +50,6 @@
5151 if ( $start === false ) {
5252 // Try DNS
5353 $names[] = array( $lineNum, $line );
54 - /*
55 - // Is this a hostname?
56 - $ips = gethostbynamel( $line );
57 - if ( $ips === false ) {
58 - echo "Not a valid host or IP address on line $lineNum: $line\n";
59 - } else {
60 - foreach ( $ips as $ip ) {
61 - $hex = IP::toHex( $ip );
62 - dba_insert( $hex, '1', $outFile );
63 - }
64 - }*/
6554 continue;
6655 }
6756 $ranges[] = array( $lineNum, $start, $end );
@@ -121,7 +110,7 @@
122111 continue;
123112 }
124113 for ( $j = $startNum; $j <= $endNum; $j++ ) {
125 - $hex = base_convert( $j, 10, 16 );
 114+ $hex = strtoupper( base_convert( $j, 10, 16 ) );
126115 $hex = str_pad( $hex, $suffixLength, '0', STR_PAD_LEFT );
127116 dba_insert( $prefix . $hex, '1', $outFile );
128117 $numHosts++;