mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 16:14:40 +00:00
Firewall/Alias, phalcon's Callback() validator sends all received data and expects the callback to filter them, which forces us to include the fieldname in the validator to prevent feeding the wrong results. for https://github.com/opnsense/core/issues/1858
This commit is contained in:
parent
51bd00cf82
commit
19bbaeaa29
@ -80,8 +80,10 @@ class AliasContentField extends BaseField
|
||||
private function getItems($data)
|
||||
{
|
||||
foreach ($data as $key => $value) {
|
||||
foreach (explode($this->separatorchar, $value) as $value) {
|
||||
yield $value;
|
||||
if (substr( $key, strlen( $key ) - strlen( ".content" ) ) == ".content") {
|
||||
foreach (explode($this->separatorchar, $value) as $value) {
|
||||
yield $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,9 +77,11 @@ class AliasNameField extends BaseField
|
||||
"message" => gettext('Reserved protocol or service names may not be used'),
|
||||
"callback" => function ($data) {
|
||||
foreach ($data as $key => $value) {
|
||||
if (getservbyname($value, 'tcp') ||
|
||||
if (substr( $key, strlen( $key ) - strlen( ".name" ) ) == ".name") {
|
||||
if (getservbyname($value, 'tcp') ||
|
||||
getservbyname($value, 'udp') || getprotobyname($value)) {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user