Skip to content

Commit

Permalink
Add parsing support for trailing #-comments in the dns.hosts entries
Browse files Browse the repository at this point in the history
Signed-off-by: DL6ER <[email protected]>
  • Loading branch information
DL6ER committed Feb 22, 2025
1 parent 04253ed commit 2f1ad68
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/config/validator.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,19 @@ bool validate_dns_hosts(union conf_value *val, const char *key, char err[VALIDAT
while((host = strsep(&tmp, " \t")) != NULL)
{
// Skip extra whitespace/tabs
while(isspace((unsigned char)*host)) host++;
if(strlen(host) == 0) continue;
while(isspace((unsigned char)*host))
host++;

// Skip this entry if it's empty after trimming
// the whitespaces/tabs at the end of the line
if(strlen(host) == 0)
break;

// If this hostname is actually the start of a comment
// (first letter is '#'), skip parsing the rest of the
// entire line
if(host[0] == '#')
break;

if(!valid_domain(host, strlen(host), false))
{
Expand Down

0 comments on commit 2f1ad68

Please sign in to comment.