aboutsummaryrefslogtreecommitdiffstats
path: root/config/suricata/suricata_barnyard.php
diff options
context:
space:
mode:
authorbmeeks8 <bmeeks8@bellsouth.net>2014-09-05 14:56:25 -0400
committerbmeeks8 <bmeeks8@bellsouth.net>2014-09-05 14:56:25 -0400
commitcd694599d995f30a0759259fbb9400f030161383 (patch)
treeb05f0988a767c2a1dde691fe21a173c4581b972d /config/suricata/suricata_barnyard.php
parent115e93c9e6fcb1269f470aca1cb0b72636845d6a (diff)
downloadpfsense-packages-cd694599d995f30a0759259fbb9400f030161383.tar.gz
pfsense-packages-cd694599d995f30a0759259fbb9400f030161383.tar.bz2
pfsense-packages-cd694599d995f30a0759259fbb9400f030161383.zip
Check if spaces in BY2 Sensor Name and show validation error.
Diffstat (limited to 'config/suricata/suricata_barnyard.php')
-rw-r--r--config/suricata/suricata_barnyard.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/config/suricata/suricata_barnyard.php b/config/suricata/suricata_barnyard.php
index 1463ed0b..cd233b5e 100644
--- a/config/suricata/suricata_barnyard.php
+++ b/config/suricata/suricata_barnyard.php
@@ -94,6 +94,12 @@ if ($_POST['save']) {
$_POST['barnyard_bro_ids_enable'] != 'on' && $_POST['barnyard_enable'] == "on")
$input_errors[] = gettext("You must enable at least one output option when using Barnyard2.");
+ // Validate Sensor Name contains no spaces
+ if ($_POST['barnyard_enable'] == 'on') {
+ if (!empty(trim($_POST['barnyard_sensor_name'])) && strpos(trim($_POST['barnyard_sensor_name']), " ") !== FALSE)
+ $input_errors[] = gettext("The value for 'Sensor Name' cannot contain spaces.");
+ }
+
// Validate Sensor ID is a valid integer
if ($_POST['barnyard_enable'] == 'on') {
if (!is_numericint($_POST['barnyard_sensor_id']) || $_POST['barnyard_sensor_id'] < 0)
@@ -147,7 +153,7 @@ if ($_POST['save']) {
$natent['barnyard_syslog_proto'] = $_POST['barnyard_syslog_proto'];
if ($_POST['barnyard_sensor_id']) $natent['barnyard_sensor_id'] = $_POST['barnyard_sensor_id']; else $natent['barnyard_sensor_id'] = '0';
- if ($_POST['barnyard_sensor_name']) $natent['barnyard_sensor_name'] = $_POST['barnyard_sensor_name']; else unset($natent['barnyard_sensor_name']);
+ if ($_POST['barnyard_sensor_name']) $natent['barnyard_sensor_name'] = trim($_POST['barnyard_sensor_name']); else unset($natent['barnyard_sensor_name']);
if ($_POST['barnyard_dbhost']) $natent['barnyard_dbhost'] = $_POST['barnyard_dbhost']; else unset($natent['barnyard_dbhost']);
if ($_POST['barnyard_dbname']) $natent['barnyard_dbname'] = $_POST['barnyard_dbname']; else unset($natent['barnyard_dbname']);
if ($_POST['barnyard_dbuser']) $natent['barnyard_dbuser'] = $_POST['barnyard_dbuser']; else unset($natent['barnyard_dbuser']);