Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fix encoding and validation on load_balancer_monitor*. Fixes #10940
  • Loading branch information
jim-p committed Sep 30, 2020
1 parent 8f07b87 commit a220a22
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/usr/local/www/load_balancer_monitor.php
Expand Up @@ -113,13 +113,13 @@
?>
<tr>
<td>
<?=$monitor['name']?>
<?=htmlspecialchars($monitor['name'])?>
</td>
<td>
<?=$monitor['type']?>
<?=htmlspecialchars($monitor['type'])?>
</td>
<td>
<?=$monitor['descr']?>
<?=htmlspecialchars($monitor['descr'])?>
</td>
<td>
<a class="fa fa-pencil" title="<?=gettext('Edit monitor')?>" href="load_balancer_monitor_edit.php?id=<?=$idx?>"></a>
Expand Down
12 changes: 11 additions & 1 deletion src/usr/local/www/load_balancer_monitor_edit.php
Expand Up @@ -29,6 +29,14 @@

require_once("guiconfig.inc");

$types = array(
"icmp" => gettext("ICMP"),
"tcp" => gettext("TCP"),
"http" => gettext("HTTP"),
"https" => gettext("HTTPS"),
"send" => gettext("Send/Expect")
);

$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_monitor.php');

init_config_arr(array('load_balancer', 'monitor_type'));
Expand Down Expand Up @@ -84,6 +92,9 @@
}
}

if (!array_key_exists($_POST['type'], $types)) {
$input_errors[] = gettext("Select a valid monitor type.");
}
if (preg_match('/[ \/]/', $_POST['name'])) {
$input_errors[] = gettext("Spaces or slashes cannot be used in the 'name' field.");
}
Expand Down Expand Up @@ -194,7 +205,6 @@
$shortcut_section = "relayd";

include("head.inc");
$types = array("icmp" => gettext("ICMP"), "tcp" => gettext("TCP"), "http" => gettext("HTTP"), "https" => gettext("HTTPS"), "send" => gettext("Send/Expect"));

?>

Expand Down

0 comments on commit a220a22

Please sign in to comment.