| Index: trunk/phase3/includes/User.php |
| — | — | @@ -1100,7 +1100,7 @@ |
| 1101 | 1101 | * done against master. |
| 1102 | 1102 | */ |
| 1103 | 1103 | function getBlockedStatus( $bFromSlave = true ) { |
| 1104 | | - global $wgEnableSorbs, $wgProxyWhitelist, $wgUser; |
| | 1104 | + global $wgProxyWhitelist, $wgUser; |
| 1105 | 1105 | |
| 1106 | 1106 | if ( -1 != $this->mBlockedby ) { |
| 1107 | 1107 | wfDebug( "User::getBlockedStatus: already loaded.\n" ); |
| — | — | @@ -1168,8 +1168,8 @@ |
| 1169 | 1169 | } |
| 1170 | 1170 | |
| 1171 | 1171 | # DNSBL |
| 1172 | | - if ( !$this->mBlockedby && $wgEnableSorbs && !$this->getID() ) { |
| 1173 | | - if ( $this->inSorbsBlacklist( $ip ) ) { |
| | 1172 | + if ( !$this->mBlockedby && !$this->getID() ) { |
| | 1173 | + if ( $this->isDnsBlacklisted( $ip ) ) { |
| 1174 | 1174 | $this->mBlockedby = wfMsg( 'sorbs' ); |
| 1175 | 1175 | $this->mBlockreason = wfMsg( 'sorbsreason' ); |
| 1176 | 1176 | } |
| — | — | @@ -1183,16 +1183,24 @@ |
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | /** |
| 1187 | | - * Whether the given IP is in the SORBS blacklist. |
| | 1187 | + * Whether the given IP is in a DNS blacklist. |
| 1188 | 1188 | * |
| 1189 | 1189 | * @param $ip \string IP to check |
| | 1190 | + * @param $checkWhitelist Boolean: whether to check the whitelist first |
| 1190 | 1191 | * @return \bool True if blacklisted. |
| 1191 | 1192 | */ |
| 1192 | | - function inSorbsBlacklist( $ip ) { |
| 1193 | | - global $wgEnableSorbs, $wgSorbsUrl; |
| | 1193 | + function isDnsBlacklisted( $ip, $checkWhitelist = false ) { |
| | 1194 | + global $wgEnableSorbs, $wgEnableDnsBlacklist, |
| | 1195 | + $wgSorbsUrl, $wgDnsBlacklistUrls, $wgProxyWhitelist; |
| 1194 | 1196 | |
| 1195 | | - return $wgEnableSorbs && |
| 1196 | | - $this->inDnsBlacklist( $ip, $wgSorbsUrl ); |
| | 1197 | + if ( !$wgEnableDnsBlacklist && !$wgEnableSorbs ) |
| | 1198 | + return false; |
| | 1199 | + |
| | 1200 | + if ( $checkWhitelist && in_array( $ip, $wgProxyWhitelist ) ) |
| | 1201 | + return false; |
| | 1202 | + |
| | 1203 | + $urls = array_merge( $wgDnsBlacklistUrls, (array)$wgSorbsUrl ); |
| | 1204 | + return $this->inDnsBlacklist( $ip, $urls ); |
| 1197 | 1205 | } |
| 1198 | 1206 | |
| 1199 | 1207 | /** |
| Index: trunk/phase3/includes/DefaultSettings.php |
| — | — | @@ -3494,16 +3494,30 @@ |
| 3495 | 3495 | $wgEnableTooltipsAndAccesskeys = true; |
| 3496 | 3496 | |
| 3497 | 3497 | /** |
| 3498 | | - * Whether to use DNS blacklists in $wgSorbsUrl to check for open proxies |
| | 3498 | + * Whether to use DNS blacklists in $wgDnsBlacklistUrls to check for open proxies |
| | 3499 | + * @since 1.16 |
| 3499 | 3500 | */ |
| | 3501 | +$wgEnableDnsBlacklist = false; |
| | 3502 | + |
| | 3503 | +/** |
| | 3504 | + * @deprecated Use $wgEnableDnsBlacklist instead, only kept for backward |
| | 3505 | + * compatibility |
| | 3506 | + */ |
| 3500 | 3507 | $wgEnableSorbs = false; |
| 3501 | 3508 | |
| 3502 | 3509 | /** |
| 3503 | | - * List of DNS blacklists to use, if $wgEnableSorbs is true |
| | 3510 | + * List of DNS blacklists to use, if $wgEnableDnsBlacklist is true |
| | 3511 | + * @since 1.16 |
| 3504 | 3512 | */ |
| 3505 | | -$wgSorbsUrl = array( 'http.dnsbl.sorbs.net.' ); |
| | 3513 | +$wgDnsBlacklistUrls = array( 'http.dnsbl.sorbs.net.' ); |
| 3506 | 3514 | |
| 3507 | 3515 | /** |
| | 3516 | + * @deprecated Use $wgDnsBlacklistUrls instead, only kept for backward |
| | 3517 | + * compatibility |
| | 3518 | + */ |
| | 3519 | +$wgSorbsUrl = array(); |
| | 3520 | + |
| | 3521 | +/** |
| 3508 | 3522 | * Proxy whitelist, list of addresses that are assumed to be non-proxy despite |
| 3509 | 3523 | * what the other methods might say. |
| 3510 | 3524 | */ |
| Index: trunk/phase3/includes/specials/SpecialUserlogin.php |
| — | — | @@ -219,7 +219,6 @@ |
| 220 | 220 | */ |
| 221 | 221 | function addNewAccountInternal() { |
| 222 | 222 | global $wgUser, $wgOut; |
| 223 | | - global $wgEnableSorbs, $wgProxyWhitelist; |
| 224 | 223 | global $wgMemc, $wgAccountCreationThrottle; |
| 225 | 224 | global $wgAuth, $wgMinimalPasswordLength; |
| 226 | 225 | global $wgEmailConfirmToEdit; |
| — | — | @@ -257,9 +256,7 @@ |
| 258 | 257 | } |
| 259 | 258 | |
| 260 | 259 | $ip = wfGetIP(); |
| 261 | | - if ( $wgEnableSorbs && !in_array( $ip, $wgProxyWhitelist ) && |
| 262 | | - $wgUser->inSorbsBlacklist( $ip ) ) |
| 263 | | - { |
| | 260 | + if ( $wgUser->isDnsBlacklisted( $ip, true /* check $wgProxyWhitelist */ ) ) { |
| 264 | 261 | $this->mainLoginForm( wfMsg( 'sorbs_create_account_reason' ) . ' (' . htmlspecialchars( $ip ) . ')' ); |
| 265 | 262 | return; |
| 266 | 263 | } |
| Index: trunk/phase3/RELEASE-NOTES |
| — | — | @@ -68,7 +68,8 @@ |
| 69 | 69 | * $wgUploadMaintenance added to disable file deletions and restorations during |
| 70 | 70 | maintenance |
| 71 | 71 | * $wgCapitalLinkOverrides added to configure per-namespace capitalization |
| 72 | | -* (bug 21172) $wgSorbsUrl can now be an array with multiple DNSBL |
| | 72 | +* (bug 21172) $wgSorbsUrl can now be an array with multiple DNSBL and renamed |
| | 73 | + to $wgDnsBlacklistUrls (backward compatibility kept) |
| 73 | 74 | * $wgEnableHtmlDiff has been removed |
| 74 | 75 | * (bug 3340) $wgBlockCIDRLimit added (default: 16) to configure the low end of |
| 75 | 76 | CIDR ranges for blocking |
| — | — | @@ -78,6 +79,8 @@ |
| 79 | 80 | * $wgDBAhandler added to choose a DBA handler when using CACHE_DBA |
| 80 | 81 | * $wgPreviewOnOpenNamespaces for extensions that create namespaces that behave |
| 81 | 82 | similarly to the category namespace. |
| | 83 | +* $wgEnableSorbs renamed to $wgDnsBlacklistUrls ($wgEnableSorbs kept for |
| | 84 | + backward compatibility) |
| 82 | 85 | |
| 83 | 86 | === New features in 1.16 === |
| 84 | 87 | |