diff options
| author | Igor Wiedler <igor@wiedler.ch> | 2010-09-16 23:38:50 +0200 |
|---|---|---|
| committer | Igor Wiedler <igor@wiedler.ch> | 2010-09-16 23:38:50 +0200 |
| commit | 41245f9f7ac1f588351ddaa8128b499503416f54 (patch) | |
| tree | 85469583e9b374dc26ced337f61c673e67b5be90 | |
| parent | ed783506c6775cb73813261d3c29ae8e0652c4e8 (diff) | |
| parent | e5d5d581727ce61e653fdfc9a30effb69799aac5 (diff) | |
| download | forums-41245f9f7ac1f588351ddaa8128b499503416f54.tar forums-41245f9f7ac1f588351ddaa8128b499503416f54.tar.gz forums-41245f9f7ac1f588351ddaa8128b499503416f54.tar.bz2 forums-41245f9f7ac1f588351ddaa8128b499503416f54.tar.xz forums-41245f9f7ac1f588351ddaa8128b499503416f54.zip | |
Merge branch 'ticket/bantu/9091' into develop-olympus
* ticket/bantu/9091:
[ticket/9091] Extract IPv4 address from addresses mapped into IPv6.
| -rw-r--r-- | phpBB/includes/session.php | 11 | ||||
| -rw-r--r-- | phpBB/install/database_update.php | 1 | ||||
| -rw-r--r-- | phpBB/install/install_install.php | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index aa2293c630..5f5b39fe27 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -285,6 +285,17 @@ class session break; } + // Quick check for IPv4-mapped address in IPv6 + if (stripos($ip, '::ffff:') === 0) + { + $ipv4 = substr($ip, 7); + + if (preg_match(get_preg_expression('ipv4'), $ipv4)) + { + $ip = $ipv4; + } + } + // Use the last in chain $this->ip = $ip; } diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 8fd96691d9..ca4ef817be 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -119,6 +119,7 @@ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false); unset($dbpasswd); $user->ip = (!empty($_SERVER['REMOTE_ADDR'])) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : ''; +$user->ip = (stripos($user->ip, '::ffff:') === 0) ? substr($user->ip, 7) : $user->ip; $sql = "SELECT config_value FROM " . CONFIG_TABLE . " diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 6c23460de9..2dd58584f4 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1236,6 +1236,7 @@ class install_install extends module $current_time = time(); $user_ip = (!empty($_SERVER['REMOTE_ADDR'])) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : ''; + $user_ip = (stripos($user_ip, '::ffff:') === 0) ? substr($user_ip, 7) : $user_ip; if ($data['script_path'] !== '/') { |
