Fix handling of port ranges in this validation test. Ticket #7421

This commit is contained in:
jim-p 2017-03-24 13:58:55 -04:00
parent 01dc83959c
commit 0034bbc15a

View File

@ -2734,12 +2734,16 @@ function filter_generate_user_rule($rule) {
file_notice("Filter_Reload", $error_text);
return "# {$error_text}";
}
if ($rule['source']['port'] && !alias_expand($rule['source']['port'])) {
if ($rule['source']['port']
&& !(is_portrange(str_replace("-", ":", $rule['source']['port']))
|| alias_expand($rule['source']['port']))) {
$error_text = sprintf(gettext("Unresolvable source port alias '%1\$s' for rule '%2\$s'"), $rule['source']['port'], $rule['descr']);
file_notice("Filter_Reload", $error_text);
return "# {$error_text}";
}
if ($rule['destination']['port'] && !alias_expand($rule['destination']['port'])) {
if ($rule['destination']['port']
&& !(is_portrange(str_replace("-", ":", $rule['destination']['port']))
|| alias_expand($rule['destination']['port']))) {
$error_text = sprintf(gettext("Unresolvable destination port alias '%1\$s' for rule '%2\$s'"), $rule['destination']['port'], $rule['descr']);
file_notice("Filter_Reload", $error_text);
return "# {$error_text}";