From 0fc8894da8c5cc072636cf8514b79c173f6d7b52 Mon Sep 17 00:00:00 2001 From: Ermal Date: Wed, 23 Jan 2013 23:33:27 +0100 Subject: More checking for existence of file --- config/snort/snort.inc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'config/snort') diff --git a/config/snort/snort.inc b/config/snort/snort.inc index cd76db6f..afc9c861 100755 --- a/config/snort/snort.inc +++ b/config/snort/snort.inc @@ -756,6 +756,8 @@ function snort_build_sid_msg_map($rules_path, $sid_file) { continue; /* Read the file into an array, skipping empty lines. */ + if (!file_exists($file)) + continue; $rules_array = file($file, FILE_SKIP_EMPTY_LINES); $record = ""; $b_Multiline = false; @@ -824,6 +826,8 @@ function snort_merge_reference_configs($cfg_in, $cfg_out) { $outMap = array(); foreach ($cfg_in as $file) { + if (!file_exists($file)) + continue; $in = file($file, FILE_SKIP_EMPTY_LINES); foreach ($in as $line) { /* Skip comment lines */ @@ -859,6 +863,8 @@ function snort_merge_classification_configs($cfg_in, $cfg_out) { $outMap = array(); foreach ($cfg_in as $file) { + if (!file_exists($file)) + continue; $in = file($file, FILE_SKIP_EMPTY_LINES); foreach ($in as $line) { if (preg_match('/(.*:)(\s*.*),(.*),(.*)/', $line, $matches)) { @@ -947,6 +953,8 @@ function snort_load_rules_map($rules_path) { if (!file_exists($file)) continue; + if (!file_exists($file)) + continue; $rules_array = file($file, FILE_SKIP_EMPTY_LINES); $record = ""; $b_Multiline = false; -- cgit v1.2.3