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:
Simon Kelley
2021-06-24 23:28:47 +01:00
parent be291d979d
commit 8c9196bff8
2 changed files with 16 additions and 21 deletions

View File

@@ -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;