From a6c7169033e1ae9352c5097569b1d15e1a10770c Mon Sep 17 00:00:00 2001 From: ValdikSS Date: Wed, 14 Aug 2024 17:42:05 +0300 Subject: [PATCH] Allow to add the whole root zones into blacklist. Fixes #564. --- src/blackwhitelist.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/blackwhitelist.c b/src/blackwhitelist.c index e59b59d9..075ca298 100644 --- a/src/blackwhitelist.c +++ b/src/blackwhitelist.c @@ -70,8 +70,8 @@ int blackwhitelist_load_list(const char *filename) { line); continue; } - if (strlen(line) < 3) { - printf("WARNING: host %s is less than 3 bytes, skipping\n", line); + if (strlen(line) < 2) { + printf("WARNING: host %s is less than 2 characters, skipping\n", line); continue; } if (add_hostname(line)) @@ -99,8 +99,7 @@ int blackwhitelist_check_hostname(const char *host_addr, size_t host_len) { tokenized_host = strchr(current_host, '.'); while (tokenized_host != NULL && tokenized_host < (current_host + HOST_MAXLEN)) { - /* Search hostname only if there is next token */ - if (strchr(tokenized_host + 1, '.') && check_get_hostname(tokenized_host + 1)) + if (check_get_hostname(tokenized_host + 1)) return TRUE; tokenized_host = strchr(tokenized_host + 1, '.'); }