Commit b8ea456f authored by Mark Andrews's avatar Mark Andrews
Browse files

Failure to pass a valid IPv6 address now returns DNS_R_BADAAAA.

parent 767d29c4
......@@ -45,8 +45,9 @@ typedef unsigned int dns_result_t;
#define DNS_R_NOTFOUND 22
#define DNS_R_SYNTAX 23
#define DNS_R_BADCKSUM 24
#define DNS_R_BADAAAA 25
#define DNS_R_LASTENTRY 24 /* Last entry on list. */
#define DNS_R_LASTENTRY 25 /* Last entry on list. */
#define DNS_R_UNEXPECTED 0xFFFFFFFFL
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: a6_38.c,v 1.2 1999/02/06 01:45:11 halley Exp $ */
/* $Id: a6_38.c,v 1.3 1999/02/09 07:52:32 marka Exp $ */
/* draft-ietf-ipngwg-dns-lookups-03.txt */
......@@ -68,7 +68,7 @@ fromtext_in_a6(dns_rdataclass_t class, dns_rdatatype_t type,
RETERR(gettoken(lexer, &token, isc_tokentype_string,
ISC_FALSE));
if (isc_inet_pton(AF_INET6, token.value.as_pointer, addr) != 1)
return (DNS_R_UNEXPECTED);
return (DNS_R_BADAAAA);
mask = 0xff >> (prefixlen % 8);
addr[octets] &= mask;
RETERR(mem_tobuffer(target, &addr[octets], 16 - octets));
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: a6_38.h,v 1.2 1999/02/06 01:45:11 halley Exp $ */
/* $Id: a6_38.h,v 1.3 1999/02/09 07:52:32 marka Exp $ */
/* draft-ietf-ipngwg-dns-lookups-03.txt */
......@@ -68,7 +68,7 @@ fromtext_in_a6(dns_rdataclass_t class, dns_rdatatype_t type,
RETERR(gettoken(lexer, &token, isc_tokentype_string,
ISC_FALSE));
if (isc_inet_pton(AF_INET6, token.value.as_pointer, addr) != 1)
return (DNS_R_UNEXPECTED);
return (DNS_R_BADAAAA);
mask = 0xff >> (prefixlen % 8);
addr[octets] &= mask;
RETERR(mem_tobuffer(target, &addr[octets], 16 - octets));
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: aaaa_28.c,v 1.4 1999/02/06 01:45:11 halley Exp $ */
/* $Id: aaaa_28.c,v 1.5 1999/02/09 07:52:31 marka Exp $ */
/* RFC 1886 */
......@@ -49,7 +49,7 @@ fromtext_in_aaaa(dns_rdataclass_t class, dns_rdatatype_t type,
RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE));
if (isc_inet_pton(AF_INET6, token.value.as_pointer, addr) != 1)
return (DNS_R_UNEXPECTED);
return (DNS_R_BADAAAA);
isc_buffer_available(target, &region);
if (region.length < 16)
return (DNS_R_NOSPACE);
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: aaaa_28.h,v 1.4 1999/02/06 01:45:11 halley Exp $ */
/* $Id: aaaa_28.h,v 1.5 1999/02/09 07:52:31 marka Exp $ */
/* RFC 1886 */
......@@ -49,7 +49,7 @@ fromtext_in_aaaa(dns_rdataclass_t class, dns_rdatatype_t type,
RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE));
if (isc_inet_pton(AF_INET6, token.value.as_pointer, addr) != 1)
return (DNS_R_UNEXPECTED);
return (DNS_R_BADAAAA);
isc_buffer_available(target, &region);
if (region.length < 16)
return (DNS_R_NOSPACE);
......
......@@ -45,6 +45,7 @@ static char *text_table[DNS_R_LASTENTRY + 1] = {
"not found", /* 22 */
"syntax error", /* 23 */
"bad checksum", /* 24 */
"bad IPv6 address", /* 25 */
};
char *
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment