mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
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:
@@ -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);
|
||||
|
||||
|
||||
@@ -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
@@ -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(®ex[index], regexin, REG_EXTENDED);
|
||||
int regflags = REG_EXTENDED;
|
||||
if(config.regex_ignorecase)
|
||||
regflags |= REG_ICASE;
|
||||
const int errcode = regcomp(®ex[index], regexin, regflags);
|
||||
if(errcode != 0)
|
||||
{
|
||||
log_regex_error("compiling", errcode, index);
|
||||
|
||||
Reference in New Issue
Block a user