diff --git a/src/config.c b/src/config.c index 876d1864f..0ec46ee19 100644 --- a/src/config.c +++ b/src/config.c @@ -333,19 +333,6 @@ void read_FTLconf(void) else logg(" PARSE_ARP_CACHE: Inactive"); - // REGEX_IGNORECASE - // defaults to: false - config.regex_ignorecase = false; - buffer = parse_FTLconf(fp, "REGEX_IGNORECASE"); - - if(buffer != NULL && strcasecmp(buffer, "true") == 0) - config.regex_ignorecase = true; - - if(config.regex_ignorecase) - logg(" REGEX_IGNORECASE: Enabled. Regex is case insensitive"); - else - logg(" REGEX_IGNORECASE: Disabled. Regex is case sensitive"); - // CNAME_DEEP_INSPECT // defaults to: true config.cname_inspection = true; diff --git a/src/config.h b/src/config.h index 01448cd7e..a10c9de7e 100644 --- a/src/config.h +++ b/src/config.h @@ -37,7 +37,6 @@ typedef struct { bool analyze_only_A_AAAA; bool DBimport; bool parse_arp_cache; - bool regex_ignorecase; bool cname_inspection; } ConfigStruct; diff --git a/src/regex.c b/src/regex.c index 2b5a7d0a1..da94f2ac0 100644 --- a/src/regex.c +++ b/src/regex.c @@ -30,9 +30,9 @@ static char **regexbuffer[2] = { NULL }; const char *regextype[] = { "blacklist", "whitelist" }; +// Log Regex failure (most likely a regex syntax error, we include a hint to the error) static void log_regex_error(const int errcode, const int index, const unsigned char regexid, const char *regexin) { - // Regex failed for some reason (probably user syntax error) // Get error string and log it const size_t length = regerror(errcode, ®ex[regexid][index], NULL, 0); char *buffer = calloc(length,sizeof(char)); @@ -41,14 +41,13 @@ static void log_regex_error(const int errcode, const int index, const unsigned c free(buffer); } +/* Compile regular expressions into data structures that can be used with + regexec() to match against a string */ static bool compile_regex(const char *regexin, const int index, const unsigned char regexid) { - // compile regular expressions into data structures that - // can be used with regexec to match against a string - int regflags = REG_EXTENDED; - if(config.regex_ignorecase) - regflags |= REG_ICASE; - const int errcode = regcomp(®ex[regexid][index], regexin, regflags); + // We use the extended RegEx flavor (ERE) and specify that matching should + // always be case INsensitive + const int errcode = regcomp(®ex[regexid][index], regexin, REG_EXTENDED | REG_ICASE); if(errcode != 0) { log_regex_error(errcode, index, regexid, regexin);