Allow to add the whole root zones into blacklist. Fixes #564.

This commit is contained in:
ValdikSS 2024-08-14 17:42:05 +03:00
parent c8c596f37e
commit a6c7169033

View File

@ -70,8 +70,8 @@ int blackwhitelist_load_list(const char *filename) {
line); line);
continue; continue;
} }
if (strlen(line) < 3) { if (strlen(line) < 2) {
printf("WARNING: host %s is less than 3 bytes, skipping\n", line); printf("WARNING: host %s is less than 2 characters, skipping\n", line);
continue; continue;
} }
if (add_hostname(line)) 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, '.'); tokenized_host = strchr(current_host, '.');
while (tokenized_host != NULL && tokenized_host < (current_host + HOST_MAXLEN)) { while (tokenized_host != NULL && tokenized_host < (current_host + HOST_MAXLEN)) {
/* Search hostname only if there is next token */ if (check_get_hostname(tokenized_host + 1))
if (strchr(tokenized_host + 1, '.') && check_get_hostname(tokenized_host + 1))
return TRUE; return TRUE;
tokenized_host = strchr(tokenized_host + 1, '.'); tokenized_host = strchr(tokenized_host + 1, '.');
} }