diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2015-04-18 15:48:58 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2015-04-18 16:22:48 +0100 |
commit | 766e7a65f0fcb236afb7d8ad79db5f340b5d3b83 (patch) | |
tree | 41d8f340d0cd2b8cf0d1c0cf0ae7780a45c6fe05 /src | |
parent | 3ae1aa791976d11d3d1e1f9f30a16339abfc0134 (diff) |
UTF8: Avoid treating a punycoded dns lookup as an implicit redirection
Diffstat (limited to 'src')
-rw-r--r-- | src/src/dns.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/src/dns.c b/src/src/dns.c index 6f75386ed..a9970d9fe 100644 --- a/src/src/dns.c +++ b/src/src/dns.c @@ -581,6 +581,8 @@ if (previous != NULL) { uschar * alabel; uschar * errstr = NULL; + DEBUG(D_dns) if (string_is_utf8(name)) + debug_printf("convert utf8 '%s' to alabel for for lookup\n", name); if ((alabel = string_domain_utf8_to_alabel(name, &errstr)), errstr) { DEBUG(D_dns) @@ -738,7 +740,8 @@ won't return any. If fully_qualified_name is not NULL, set it to point to the full name returned by the resolver, if this is different to what it is given, unless the returned name starts with "*" as some nameservers seem to be returning -wildcards in this form. +wildcards in this form. In international mode "different" means "alabel +forms are different". Arguments: dnsa pointer to dns_answer structure @@ -799,18 +802,19 @@ for (i = 0; i < 10; i++) if (i == 0 && fully_qualified_name != NULL) { - if (cname_rr.data != NULL) - { - if (Ustrcmp(cname_rr.name, *fully_qualified_name) != 0 && - cname_rr.name[0] != '*') - *fully_qualified_name = string_copy_dnsdomain(cname_rr.name); - } - else if (type_rr.data != NULL) - { - if (Ustrcmp(type_rr.name, *fully_qualified_name) != 0 && - type_rr.name[0] != '*') - *fully_qualified_name = string_copy_dnsdomain(type_rr.name); - } + uschar * rr_name = cname_rr.data ? cname_rr.name + : type_rr.data ? type_rr.name : NULL; + if ( rr_name + && Ustrcmp(rr_name, *fully_qualified_name) != 0 + && rr_name[0] != '*' +#ifdef EXPERIMENTAL_INTERNATIONAL + && ( !string_is_utf8(*fully_qualified_name) + || Ustrcmp(rr_name, + string_domain_utf8_to_alabel(*fully_qualified_name, NULL)) != 0 + ) +#endif + ) + *fully_qualified_name = string_copy_dnsdomain(rr_name); } /* If any data records of the correct type were found, we are done. */ |