1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-14 03:25:37 +02:00

- use /48 and /64 subnets for IPv6 matching [Bug #9538]

git-svn-id: file:///svn/phpbb/trunk@7561 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Nils Adermann 2007-05-13 20:09:33 +00:00
parent f1b60939fd
commit 36cb62292f
2 changed files with 8 additions and 4 deletions

View File

@ -3411,9 +3411,10 @@ function get_preg_expression($mode)
} }
/** /**
* Returns the first 4 blocks of the specified IPv6 address and as many * Returns the first block of the specified IPv6 address and as many additional
* as specified in the length paramater additional ones. * ones as specified in the length paramater.
* If length is zero, then an empty string is returned. * If length is zero, then an empty string is returned.
* If length is greater than 3 the complete IP will be returned
*/ */
function short_ipv6($ip, $length) function short_ipv6($ip, $length)
{ {
@ -3432,7 +3433,10 @@ function short_ipv6($ip, $length)
{ {
$ip = '0000' . $ip; $ip = '0000' . $ip;
} }
$ip = implode(':', array_slice(explode(':', $ip), 0, 4 + $length)); if ($length < 4)
{
$ip = implode(':', array_slice(explode(':', $ip), 0, 1 + $length));
}
return $ip; return $ip;
} }

View File

@ -357,7 +357,7 @@ $lang = array_merge($lang, array(
'FORWARDED_FOR_VALID' => 'Validated <var>X_FORWARDED_FOR</var> header', 'FORWARDED_FOR_VALID' => 'Validated <var>X_FORWARDED_FOR</var> header',
'FORWARDED_FOR_VALID_EXPLAIN' => 'Sessions will only be continued if the sent <var>X_FORWARDED_FOR</var> header equals the one sent with the previous request. Bans will be checked against IPs in <var>X_FORWARDED_FOR</var> too.', 'FORWARDED_FOR_VALID_EXPLAIN' => 'Sessions will only be continued if the sent <var>X_FORWARDED_FOR</var> header equals the one sent with the previous request. Bans will be checked against IPs in <var>X_FORWARDED_FOR</var> too.',
'IP_VALID' => 'Session IP validation', 'IP_VALID' => 'Session IP validation',
'IP_VALID_EXPLAIN' => 'Determines how much of the users IP is used to validate a session; <samp>All</samp> compares the complete address, <samp>A.B.C</samp> the first x.x.x, <samp>A.B</samp> the first x.x, <samp>None</samp> disables checking. On IPv6 addresses <samp>A.B.C</samp> compares the first 7 blocks and <samp>A.B</samp> the first 6 blocks.', 'IP_VALID_EXPLAIN' => 'Determines how much of the users IP is used to validate a session; <samp>All</samp> compares the complete address, <samp>A.B.C</samp> the first x.x.x, <samp>A.B</samp> the first x.x, <samp>None</samp> disables checking. On IPv6 addresses <samp>A.B.C</samp> compares the first 4 blocks and <samp>A.B</samp> the first 3 blocks.',
'MAX_LOGIN_ATTEMPTS' => 'Maximum number of login attempts', 'MAX_LOGIN_ATTEMPTS' => 'Maximum number of login attempts',
'MAX_LOGIN_ATTEMPTS_EXPLAIN' => 'After this number of failed logins the user needs to additionally confirm his login visually (visual confirmation).', 'MAX_LOGIN_ATTEMPTS_EXPLAIN' => 'After this number of failed logins the user needs to additionally confirm his login visually (visual confirmation).',
'NO_IP_VALIDATION' => 'None', 'NO_IP_VALIDATION' => 'None',