Fixed check against IP blacklist (both IPv4 and IPv6)
authorAlexander Ebert <ebert@woltlab.com>
Wed, 11 Feb 2015 15:19:41 +0000 (16:19 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 11 Feb 2015 15:19:41 +0000 (16:19 +0100)
wcfsetup/install/files/lib/system/WCF.class.php

index 4f6d0c68911525fec647643013e433e4a3b3f42b..032b57776b42fe34702ae476917f8e3cb44088ed 100644 (file)
@@ -27,6 +27,7 @@ use wcf\util\ArrayUtil;
 use wcf\util\ClassUtil;
 use wcf\util\FileUtil;
 use wcf\util\StringUtil;
+use wcf\util\UserUtil;
 
 // try to set a time-limit to infinite
 @set_time_limit(0);
@@ -37,7 +38,7 @@ if (!@ini_get('date.timezone')) {
 }
 
 // define current wcf version
-define('WCF_VERSION', '2.0.10 pl 2 (Maelstrom)');
+define('WCF_VERSION', '2.0.11 (Maelstrom)');
 
 // define current unix timestamp
 define('TIME_NOW', time());
@@ -385,7 +386,10 @@ class WCF {
         */
        protected function initBlacklist() {
                if (defined('BLACKLIST_IP_ADDRESSES') && BLACKLIST_IP_ADDRESSES != '') {
-                       if (!StringUtil::executeWordFilter(self::getSession()->ipAddress, BLACKLIST_IP_ADDRESSES)) {
+                       if (!StringUtil::executeWordFilter(UserUtil::convertIPv6To4(self::getSession()->ipAddress), BLACKLIST_IP_ADDRESSES)) {
+                               throw new PermissionDeniedException();
+                       }
+                       else if (!StringUtil::executeWordFilter(self::getSession()->ipAddress, BLACKLIST_IP_ADDRESSES)) {
                                throw new PermissionDeniedException();
                        }
                }