static FILE *rule_engine_analysis_FD = NULL;
static pcre *percent_re = NULL;
static pcre_extra *percent_re_study = NULL;
+static char log_path[PATH_MAX];
/**
* \brief Sets up the rule analyzer according to the config
* \retval 1 if rule analyzer successfully enabled
* \retval 0 if not enabled
*/
-int SetupRuleAnalyzer(char *log_path)
+int SetupRuleAnalyzer(void)
{
ConfNode *conf = ConfGetNode("engine-analysis");
int enabled = 0;
char *log_dir;
if (ConfGet("default-log-dir", &log_dir) != 1)
log_dir = DEFAULT_LOG_DIR;
- snprintf(log_path, 256, "%s/%s", log_dir, "rules_analysis.txt");
+ snprintf(log_path, sizeof(log_path), "%s/%s", log_dir, "rules_analysis.txt");
rule_engine_analysis_FD = fopen(log_path, "w");
if (rule_engine_analysis_FD == NULL) {
- SCLogError(SC_ERR_FOPEN, "ERROR: failed to open %s: %s", log_path, strerror(errno));
+ SCLogError(SC_ERR_FOPEN, "failed to open %s: %s", log_path, strerror(errno));
return 0;
}
return 1;
}
-void CleanupRuleAnalyzer(char *log_path) {
+void CleanupRuleAnalyzer(void) {
if (rule_engine_analysis_FD != NULL) {
SCLogInfo("Engine-Analyis for rules printed to file - %s", log_path);
fclose(rule_engine_analysis_FD);
#include <stdint.h>
-int SetupRuleAnalyzer(char *log_path);
-void CleanupRuleAnalyzer (char *log_path);
+int SetupRuleAnalyzer(void);
+void CleanupRuleAnalyzer (void);
int PerCentEncodingSetup ();
int PerCentEncodingMatch (uint8_t *content, uint8_t content_len);
void EngineAnalysisRules(Signature *s, char *line);
char *sfile = NULL;
/* needed by engine_analysis */
- char log_path[256];
+ char log_path[PATH_MAX];
if (engine_analysis) {
if ((ConfGetBool("engine-analysis.rules-fast-pattern",
char *log_dir;
if (ConfGet("default-log-dir", &log_dir) != 1)
log_dir = DEFAULT_LOG_DIR;
- snprintf(log_path, 256, "%s/%s", log_dir, "rules_fast_pattern.txt");
+ snprintf(log_path, sizeof(log_path), "%s/%s", log_dir, "rules_fast_pattern.txt");
fp_engine_analysis_FD = fopen(log_path, "w");
if (fp_engine_analysis_FD == NULL) {
- SCLogError(SC_ERR_FOPEN, "ERROR: failed to open %s: %s", log_path,
+ SCLogError(SC_ERR_FOPEN, "failed to open %s: %s", log_path,
strerror(errno));
return -1;
}
else {
SCLogInfo("Engine-Analysis for fast_pattern disabled in conf file.");
}
- rule_engine_analysis_set = SetupRuleAnalyzer(log_path);
+ rule_engine_analysis_set = SetupRuleAnalyzer();
}
/* ok, let's load signature files from the general config */
}
}
if (rule_engine_analysis_set) {
- CleanupRuleAnalyzer(log_path);
+ CleanupRuleAnalyzer();
}
}