diff options
author | Simon Kelley <simon@thekelleys.org.uk> | 2015-04-21 22:57:06 +0100 |
---|---|---|
committer | Simon Kelley <simon@thekelleys.org.uk> | 2015-04-21 22:57:06 +0100 |
commit | cbe379ad6b52a538a4416a7cd992817e5637ccf9 (patch) | |
tree | 72bef1eb68e8109747df0d6fa9e950e242490b49 /src/rfc1035.c | |
parent | 338b340be9e7198f5c0f68133d070d6598a0814c (diff) | |
download | dnsmasq-escape_names.tar.gz |
Handle domain names with '.' or /000 within labels.v2.73rc5escape_names
Only in DNSSEC mode, where we might need to validate or store
such names. In none-DNSSEC mode, simply don't cache these, as before.
Diffstat (limited to 'src/rfc1035.c')
-rw-r--r-- | src/rfc1035.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/rfc1035.c b/src/rfc1035.c index a995ab5..19fecc8 100644 --- a/src/rfc1035.c +++ b/src/rfc1035.c @@ -128,6 +128,15 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp, if (isExtract) { unsigned char c = *p; +#ifdef HAVE_DNSSEC + if (option_bool(OPT_DNSSEC_VALID)) + { + if (c == 0 || c == '.' || c == NAME_ESCAPE) + *cp++ = NAME_ESCAPE; + *cp++ = c; + } + else +#endif if (c != 0 && c != '.') *cp++ = c; else @@ -144,9 +153,14 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp, cp++; if (c1 >= 'A' && c1 <= 'Z') c1 += 'a' - 'A'; +#ifdef HAVE_DNSSEC + if (option_bool(OPT_DNSSEC_VALID) && c1 == NAME_ESCAPE) + c1 = *cp++; +#endif + if (c2 >= 'A' && c2 <= 'Z') c2 += 'a' - 'A'; - + if (c1 != c2) retvalue = 2; } |