Add new config flag REGEX_IGNORECASE that can be enabled to make FTL's regex case insensitive. It defaults to false (legacy behavior).

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2019-07-16 22:52:40 +02:00
parent 8d82b5de4d
commit efbdff9ee6
3 changed files with 18 additions and 1 deletions
+13
View File
@@ -332,6 +332,19 @@ void read_FTLconf(void)
else
logg(" PARSE_ARP_CACHE: Inactive");
// REGEX_IGNORECASE
// defaults to: No
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");
// Read DEBUG_... setting from pihole-FTL.conf
read_debuging_settings(fp);
+1
View File
@@ -32,6 +32,7 @@ typedef struct {
bool analyze_only_A_AAAA;
bool DBimport;
bool parse_arp_cache;
bool regex_ignorecase;
} ConfigStruct;
typedef struct {
+4 -1
View File
@@ -39,7 +39,10 @@ static bool init_regex(const char *regexin, const int index)
{
// compile regular expressions into data structures that
// can be used with regexec to match against a string
const int errcode = regcomp(&regex[index], regexin, REG_EXTENDED);
int regflags = REG_EXTENDED;
if(config.regex_ignorecase)
regflags |= REG_ICASE;
const int errcode = regcomp(&regex[index], regexin, regflags);
if(errcode != 0)
{
log_regex_error("compiling", errcode, index);