mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Correct domain search algorithm.
For reasons unknown, I (srk) assumed that the orginal substring domain matching algorithm was still in use, where example.com would match eg. sexample.com In fact the far more sensible label-based match, where example.com (or .example.com) matches example.com and www.example.com, but not sexample.com, has been in use since release 2.22. This commit implements the 2.22 to 2.85 behaviour in the new domain-search code. Thanks to Kevin Darbyshire-Bryant for spotting my mistake.
This commit is contained in:
@@ -2656,8 +2656,11 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
||||
char *last;
|
||||
|
||||
arg++;
|
||||
domain = lastdomain = arg;
|
||||
/* elide leading dots - they are implied in the search algorithm */
|
||||
while (*arg == '.') arg++;
|
||||
|
||||
domain = lastdomain = arg;
|
||||
|
||||
while ((last = split_chr(arg, '/')))
|
||||
{
|
||||
lastdomain = arg;
|
||||
|
||||
Reference in New Issue
Block a user