From d13557cd988c17b2eaddb6611b315244dd3865a3 Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Tue, 9 Sep 2014 13:59:07 -0400 Subject: Add validation to ensure Barnyard2 SENSOR_NAME contains no spaces. --- config/snort/snort_barnyard.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'config') diff --git a/config/snort/snort_barnyard.php b/config/snort/snort_barnyard.php index 902c1637..a0b2c5cf 100644 --- a/config/snort/snort_barnyard.php +++ b/config/snort/snort_barnyard.php @@ -106,6 +106,12 @@ if ($_POST['save']) { $input_errors[] = gettext("You must provide a DB user login name when logging to a MySQL database."); } + // Validate Sensor Name contains no spaces + if ($_POST['barnyard_enable'] == 'on') { + if (!empty($_POST['barnyard_sensor_name']) && strpos($_POST['barnyard_sensor_name'], " ") !== FALSE) + $input_errors[] = gettext("The value for 'Sensor Name' cannot contain spaces."); + } + // Validate inputs if syslog output enabled if ($_POST['barnyard_syslog_enable'] == 'on' && $_POST['barnyard_enable'] == "on") { if ($_POST['barnyard_log_vlan_events'] == 'on' || $_POST['barnyard_log_mpls_events'] == 'on') -- cgit v1.2.3