Add undocumented --whitewild option that does the same --wild does for the whitelist.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2019-07-22 21:03:42 +02:00
parent 0692be9bae
commit 40d0caa70b
No known key found for this signature in database
GPG key ID: FB60471F0575164A
2 changed files with 3 additions and 1 deletions

View file

@ -75,7 +75,7 @@ HandleOther() {
# Check validity of domain (don't check for regex entries)
if [[ "${#domain}" -le 253 ]]; then
if [[ "${listType}" == "regex_blacklist" && "${wildcard}" == false ]]; then
if [[ ( "${listType}" == "regex_blacklist" || "${listType}" == "regex_whitelist" ) && "${wildcard}" == false ]]; then
validDomain="${domain}"
else
validDomain=$(grep -P "^((-|_)*[a-z\\d]((-|_)*[a-z\\d])*(-|_)*)(\\.(-|_)*([a-z\\d]((-|_)*[a-z\\d])*))*$" <<< "${domain}") # Valid chars check
@ -224,6 +224,7 @@ for var in "$@"; do
"--wild" | "wildcard" ) listType="regex_blacklist"; wildcard=true;;
"--regex" | "regex" ) listType="regex_blacklist";;
"--whiteregex" | "whiteregex" ) listType="regex_whitelist";;
"--whitewild" | "whitewild" ) listType="regex_whitelist"; wildcard=true;;
"-nr"| "--noreload" ) reload=false;;
"-d" | "--delmode" ) addmode=false;;
"-q" | "--quiet" ) verbose=false;;

1
pihole
View file

@ -440,6 +440,7 @@ case "${1}" in
"--wild" | "wildcard" ) listFunc "$@";;
"--regex" | "regex" ) listFunc "$@";;
"--whiteregex" | "whiteregex" ) listFunc "$@";;
"--whitewild" | "whitewild" ) listFunc "$@";;
"-d" | "debug" ) debugFunc "$@";;
"-f" | "flush" ) flushFunc "$@";;
"-up" | "updatePihole" ) updatePiholeFunc "$@";;