MDL-78215 core: support checking if 0.0.0.0 is in subnet
This commit is contained in:
@@ -223,7 +223,7 @@ class curl_security_helper extends curl_security_helper_base {
|
||||
protected function address_explicitly_blocked($addr) {
|
||||
$blockedhosts = $this->get_blocked_hosts_by_category();
|
||||
$iphostsblocked = array_merge($blockedhosts['ipv4'], $blockedhosts['ipv6']);
|
||||
return address_in_subnet($addr, implode(',', $iphostsblocked));
|
||||
return address_in_subnet($addr, implode(',', $iphostsblocked), true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-2
@@ -9067,11 +9067,12 @@ function make_unique_id_code($extra = '') {
|
||||
*
|
||||
* @param string $addr The address you are checking
|
||||
* @param string $subnetstr The string of subnet addresses
|
||||
* @param bool $checkallzeros The state to whether check for 0.0.0.0
|
||||
* @return bool
|
||||
*/
|
||||
function address_in_subnet($addr, $subnetstr) {
|
||||
function address_in_subnet($addr, $subnetstr, $checkallzeros = false) {
|
||||
|
||||
if ($addr == '0.0.0.0') {
|
||||
if ($addr == '0.0.0.0' && !$checkallzeros) {
|
||||
return false;
|
||||
}
|
||||
$subnets = explode(',', $subnetstr);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
This files describes API changes in core libraries and APIs,
|
||||
information provided here is intended especially for developers.
|
||||
|
||||
=== 4.2.1 ===
|
||||
* Added a new parameter in address_in_subnet to give us the ability to check for 0.0.0.0 or not.
|
||||
|
||||
=== 4.2 ===
|
||||
|
||||
* All context classes were moved to \core\context namespace while keeping full backwards compatibility.
|
||||
|
||||
Reference in New Issue
Block a user