Merge pull request #302 from getdnsapi/devel/rr-types

Devel/rr types
This commit is contained in:
Hoda Rohani 2017-05-02 17:58:03 +02:00 committed by GitHub
commit 2ac13e0807
18 changed files with 342 additions and 62 deletions

View File

@ -13,6 +13,7 @@ addons:
- libev-dev - libev-dev
- valgrind - valgrind
- clang - clang
- wget
script: script:
- mkdir tests - mkdir tests
- cd tests - cd tests

View File

@ -1144,6 +1144,7 @@ esac
AC_SUBST(C99COMPATFLAGS) AC_SUBST(C99COMPATFLAGS)
AC_DEFINE_UNQUOTED([MAX_CNAME_REFERRALS], [100], [The maximum number of cname referrals.]) AC_DEFINE_UNQUOTED([MAX_CNAME_REFERRALS], [100], [The maximum number of cname referrals.])
AC_DEFINE_UNQUOTED([DRAFT_RRTYPES], [1], [Define this to enable all rrtypes in gldns.])
AH_BOTTOM([ AH_BOTTOM([
@ -1159,9 +1160,14 @@ AH_BOTTOM([
* See: https://support.microsoft.com/en-us/kb/111855 * See: https://support.microsoft.com/en-us/kb/111855
*/ */
# ifndef FD_SETSIZE # ifndef FD_SETSIZE
# define FD_SETSIZE 1024 # define FD_SETSIZE 1024
# endif # endif
# define PRIsz "%Iu" # define PRIsz "%Iu"
/* Windows wants us to use _strdup instead of strdup */
# ifndef strdup
# define strdup _strdup
# endif
#else #else
# define PRIsz "%zu" # define PRIsz "%zu"
#endif #endif

View File

@ -244,6 +244,7 @@ static struct const_name_info consts_name_info[] = {
{ "GETDNS_RRTYPE_ANY", 255 }, { "GETDNS_RRTYPE_ANY", 255 },
{ "GETDNS_RRTYPE_APL", 42 }, { "GETDNS_RRTYPE_APL", 42 },
{ "GETDNS_RRTYPE_ATMA", 34 }, { "GETDNS_RRTYPE_ATMA", 34 },
{ "GETDNS_RRTYPE_AVC", 258 },
{ "GETDNS_RRTYPE_AXFR", 252 }, { "GETDNS_RRTYPE_AXFR", 252 },
{ "GETDNS_RRTYPE_CAA", 257 }, { "GETDNS_RRTYPE_CAA", 257 },
{ "GETDNS_RRTYPE_CDNSKEY", 60 }, { "GETDNS_RRTYPE_CDNSKEY", 60 },
@ -283,6 +284,7 @@ static struct const_name_info consts_name_info[] = {
{ "GETDNS_RRTYPE_NINFO", 56 }, { "GETDNS_RRTYPE_NINFO", 56 },
{ "GETDNS_RRTYPE_NS", 2 }, { "GETDNS_RRTYPE_NS", 2 },
{ "GETDNS_RRTYPE_NSAP", 22 }, { "GETDNS_RRTYPE_NSAP", 22 },
{ "GETDNS_RRTYPE_NSAP_PTR", 23 },
{ "GETDNS_RRTYPE_NSEC", 47 }, { "GETDNS_RRTYPE_NSEC", 47 },
{ "GETDNS_RRTYPE_NULL", 10 }, { "GETDNS_RRTYPE_NULL", 10 },
{ "GETDNS_RRTYPE_NXT", 30 }, { "GETDNS_RRTYPE_NXT", 30 },
@ -296,6 +298,7 @@ static struct const_name_info consts_name_info[] = {
{ "GETDNS_RRTYPE_RT", 21 }, { "GETDNS_RRTYPE_RT", 21 },
{ "GETDNS_RRTYPE_SIG", 24 }, { "GETDNS_RRTYPE_SIG", 24 },
{ "GETDNS_RRTYPE_SINK", 40 }, { "GETDNS_RRTYPE_SINK", 40 },
{ "GETDNS_RRTYPE_SMIMEA", 53 },
{ "GETDNS_RRTYPE_SOA", 6 }, { "GETDNS_RRTYPE_SOA", 6 },
{ "GETDNS_RRTYPE_SPF", 99 }, { "GETDNS_RRTYPE_SPF", 99 },
{ "GETDNS_RRTYPE_SRV", 33 }, { "GETDNS_RRTYPE_SRV", 33 },

View File

@ -57,15 +57,6 @@
#include "convert.h" #include "convert.h"
#include "debug.h" #include "debug.h"
/* strdup is marked deprecated by the Windows compiler */
#ifndef STRDUP
#ifdef GETDNS_ON_WINDOWS
#define STRDUP(x) _strdup(x)
#else
#define STRDUP(x) strdup(x)
#endif
#endif
getdns_return_t getdns_return_t
getdns_convert_dns_name_to_fqdn( getdns_convert_dns_name_to_fqdn(
const getdns_bindata *dns_name_wire_fmt, char **fqdn_as_string) const getdns_bindata *dns_name_wire_fmt, char **fqdn_as_string)
@ -212,7 +203,7 @@ getdns_display_ip_address(const struct getdns_bindata
buff, buff,
256); 256);
if (ipStr) { if (ipStr) {
return STRDUP(ipStr); return strdup(ipStr);
} }
} else if (bindata_of_ipv4_or_ipv6_address->size == 16) { } else if (bindata_of_ipv4_or_ipv6_address->size == 16) {
const char *ipStr = inet_ntop(AF_INET6, const char *ipStr = inet_ntop(AF_INET6,
@ -220,7 +211,7 @@ getdns_display_ip_address(const struct getdns_bindata
buff, buff,
256); 256);
if (ipStr) { if (ipStr) {
return STRDUP(ipStr); return strdup(ipStr);
} }
} }
return NULL; return NULL;
@ -1685,7 +1676,7 @@ getdns_str2dict(const char *str, getdns_dict **dict)
char value_buf[3072], *value_str = value_buf; char value_buf[3072], *value_str = value_buf;
if (strlen(str) > sizeof(value_str) - 1) if (strlen(str) > sizeof(value_str) - 1)
value_str = STRDUP(str); value_str = strdup(str);
else else
(void)strncpy(value_buf, str, sizeof(value_buf)); (void)strncpy(value_buf, str, sizeof(value_buf));

View File

@ -377,6 +377,7 @@ typedef enum getdns_callback_type_t {
#define GETDNS_RRTYPE_ISDN 20 #define GETDNS_RRTYPE_ISDN 20
#define GETDNS_RRTYPE_RT 21 #define GETDNS_RRTYPE_RT 21
#define GETDNS_RRTYPE_NSAP 22 #define GETDNS_RRTYPE_NSAP 22
#define GETDNS_RRTYPE_NSAP_PTR 23
#define GETDNS_RRTYPE_SIG 24 #define GETDNS_RRTYPE_SIG 24
#define GETDNS_RRTYPE_KEY 25 #define GETDNS_RRTYPE_KEY 25
#define GETDNS_RRTYPE_PX 26 #define GETDNS_RRTYPE_PX 26
@ -406,6 +407,7 @@ typedef enum getdns_callback_type_t {
#define GETDNS_RRTYPE_NSEC3 50 #define GETDNS_RRTYPE_NSEC3 50
#define GETDNS_RRTYPE_NSEC3PARAM 51 #define GETDNS_RRTYPE_NSEC3PARAM 51
#define GETDNS_RRTYPE_TLSA 52 #define GETDNS_RRTYPE_TLSA 52
#define GETDNS_RRTYPE_SMIMEA 53
#define GETDNS_RRTYPE_HIP 55 #define GETDNS_RRTYPE_HIP 55
#define GETDNS_RRTYPE_NINFO 56 #define GETDNS_RRTYPE_NINFO 56
#define GETDNS_RRTYPE_RKEY 57 #define GETDNS_RRTYPE_RKEY 57
@ -434,6 +436,7 @@ typedef enum getdns_callback_type_t {
#define GETDNS_RRTYPE_ANY 255 #define GETDNS_RRTYPE_ANY 255
#define GETDNS_RRTYPE_URI 256 #define GETDNS_RRTYPE_URI 256
#define GETDNS_RRTYPE_CAA 257 #define GETDNS_RRTYPE_CAA 257
#define GETDNS_RRTYPE_AVC 258
#define GETDNS_RRTYPE_TA 32768 #define GETDNS_RRTYPE_TA 32768
#define GETDNS_RRTYPE_DLV 32769 #define GETDNS_RRTYPE_DLV 32769
/** @} /** @}

View File

@ -469,6 +469,30 @@ gldns_buffer_write_at(gldns_buffer *buffer, size_t at, const void *data, size_t
memcpy(buffer->_data + at, data, count); memcpy(buffer->_data + at, data, count);
} }
/**
* set the given byte to the buffer at the specified position
* \param[in] buffer the buffer
* \param[in] at the position (in number of bytes) to write the data at
* \param[in] c the byte to set to the buffer
* \param[in] count the number of bytes of bytes to write
*/
INLINE void
gldns_buffer_set_at(gldns_buffer *buffer, size_t at, int c, size_t count)
{
if (!buffer->_vfixed)
assert(gldns_buffer_available_at(buffer, at, count));
else if (gldns_buffer_remaining_at(buffer, at) == 0)
return;
else if (count > gldns_buffer_remaining_at(buffer, at)) {
memset(buffer->_data + at, c,
gldns_buffer_remaining_at(buffer, at));
return;
}
memset(buffer->_data + at, c, count);
}
/** /**
* writes count bytes of data to the current position of the buffer * writes count bytes of data to the current position of the buffer
* \param[in] buffer the buffer * \param[in] buffer the buffer

View File

@ -120,6 +120,10 @@ gldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *l
if (line_nr) { if (line_nr) {
*line_nr = *line_nr + 1; *line_nr = *line_nr + 1;
} }
if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) {
*t = '\0';
return -1;
}
*t++ = ' '; *t++ = ' ';
prev_c = c; prev_c = c;
continue; continue;

View File

@ -175,7 +175,7 @@ static const gldns_rdf_type type_tkey_wireformat[] = {
GLDNS_RDF_TYPE_TIME, GLDNS_RDF_TYPE_TIME,
GLDNS_RDF_TYPE_TIME, GLDNS_RDF_TYPE_TIME,
GLDNS_RDF_TYPE_INT16, GLDNS_RDF_TYPE_INT16,
GLDNS_RDF_TYPE_INT16, GLDNS_RDF_TYPE_TSIGERROR,
GLDNS_RDF_TYPE_INT16_DATA, GLDNS_RDF_TYPE_INT16_DATA,
GLDNS_RDF_TYPE_INT16_DATA, GLDNS_RDF_TYPE_INT16_DATA,
}; };
@ -185,7 +185,7 @@ static const gldns_rdf_type type_tsig_wireformat[] = {
GLDNS_RDF_TYPE_INT16, GLDNS_RDF_TYPE_INT16,
GLDNS_RDF_TYPE_INT16_DATA, GLDNS_RDF_TYPE_INT16_DATA,
GLDNS_RDF_TYPE_INT16, GLDNS_RDF_TYPE_INT16,
GLDNS_RDF_TYPE_INT16, GLDNS_RDF_TYPE_TSIGERROR,
GLDNS_RDF_TYPE_INT16_DATA GLDNS_RDF_TYPE_INT16_DATA
}; };
static const gldns_rdf_type type_tlsa_wireformat[] = { static const gldns_rdf_type type_tlsa_wireformat[] = {
@ -341,8 +341,12 @@ static gldns_rr_descriptor rdata_field_descriptors[] = {
{GLDNS_RR_TYPE_NSEC3PARAM, "NSEC3PARAM", 4, 4, type_nsec3param_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, {GLDNS_RR_TYPE_NSEC3PARAM, "NSEC3PARAM", 4, 4, type_nsec3param_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 },
/* 52 */ /* 52 */
{GLDNS_RR_TYPE_TLSA, "TLSA", 4, 4, type_tlsa_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, {GLDNS_RR_TYPE_TLSA, "TLSA", 4, 4, type_tlsa_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 },
/*53 */
#ifdef DRAFT_RRTYPES
{GLDNS_RR_TYPE_SMIMEA, "SMIMEA", 4, 4, type_tlsa_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 },
#else
{GLDNS_RR_TYPE_NULL, "TYPE53", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, {GLDNS_RR_TYPE_NULL, "TYPE53", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 },
#endif
{GLDNS_RR_TYPE_NULL, "TYPE54", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, {GLDNS_RR_TYPE_NULL, "TYPE54", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 },
/* 55 /* 55
* Hip ends with 0 or more Rendezvous Servers represented as dname's. * Hip ends with 0 or more Rendezvous Servers represented as dname's.
@ -600,6 +604,12 @@ static gldns_rr_descriptor rdata_field_descriptors[] = {
{GLDNS_RR_TYPE_URI, "URI", 3, 3, type_uri_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, {GLDNS_RR_TYPE_URI, "URI", 3, 3, type_uri_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 },
/* 257 */ /* 257 */
{GLDNS_RR_TYPE_CAA, "CAA", 3, 3, type_caa_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, {GLDNS_RR_TYPE_CAA, "CAA", 3, 3, type_caa_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 },
#ifdef DRAFT_RRTYPES
/* 258 */
{GLDNS_RR_TYPE_TXT, "AVC", 1, 0, NULL, GLDNS_RDF_TYPE_STR, GLDNS_RR_NO_COMPRESS, 0 },
#else
{GLDNS_RR_TYPE_NULL, "TYPE258", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 },
#endif
/* split in array, no longer contiguous */ /* split in array, no longer contiguous */

View File

@ -38,7 +38,7 @@ extern "C" {
#define GLDNS_KEY_REVOKE_KEY 0x0080 /* used to revoke KSK, rfc 5011 */ #define GLDNS_KEY_REVOKE_KEY 0x0080 /* used to revoke KSK, rfc 5011 */
/* The first fields are contiguous and can be referenced instantly */ /* The first fields are contiguous and can be referenced instantly */
#define GLDNS_RDATA_FIELD_DESCRIPTORS_COMMON 258 #define GLDNS_RDATA_FIELD_DESCRIPTORS_COMMON 259
/** lookuptable for rr classes */ /** lookuptable for rr classes */
extern struct gldns_struct_lookup_table* gldns_rr_classes; extern struct gldns_struct_lookup_table* gldns_rr_classes;
@ -226,6 +226,7 @@ enum gldns_enum_rr_type
GLDNS_RR_TYPE_ANY = 255, GLDNS_RR_TYPE_ANY = 255,
GLDNS_RR_TYPE_URI = 256, /* RFC 7553 */ GLDNS_RR_TYPE_URI = 256, /* RFC 7553 */
GLDNS_RR_TYPE_CAA = 257, /* RFC 6844 */ GLDNS_RR_TYPE_CAA = 257, /* RFC 6844 */
GLDNS_RR_TYPE_AVC = 258,
/** DNSSEC Trust Authorities */ /** DNSSEC Trust Authorities */
GLDNS_RR_TYPE_TA = 32768, GLDNS_RR_TYPE_TA = 32768,
@ -350,6 +351,9 @@ enum gldns_enum_rdf_type
*/ */
GLDNS_RDF_TYPE_LONG_STR, GLDNS_RDF_TYPE_LONG_STR,
/** TSIG extended 16bit error value */
GLDNS_RDF_TYPE_TSIGERROR,
/* Aliases */ /* Aliases */
GLDNS_RDF_TYPE_BITMAP = GLDNS_RDF_TYPE_NSEC GLDNS_RDF_TYPE_BITMAP = GLDNS_RDF_TYPE_NSEC
}; };
@ -422,7 +426,7 @@ enum gldns_enum_edns_option
GLDNS_EDNS_DAU = 5, /* RFC6975 */ GLDNS_EDNS_DAU = 5, /* RFC6975 */
GLDNS_EDNS_DHU = 6, /* RFC6975 */ GLDNS_EDNS_DHU = 6, /* RFC6975 */
GLDNS_EDNS_N3U = 7, /* RFC6975 */ GLDNS_EDNS_N3U = 7, /* RFC6975 */
GLDNS_EDNS_CLIENT_SUBNET = 8, /* draft-vandergaast-edns-client-subnet */ GLDNS_EDNS_CLIENT_SUBNET = 8, /* RFC7871 */
GLDNS_EDNS_KEEPALIVE = 11, /* draft-ietf-dnsop-edns-tcp-keepalive*/ GLDNS_EDNS_KEEPALIVE = 11, /* draft-ietf-dnsop-edns-tcp-keepalive*/
GLDNS_EDNS_PADDING = 12 /* RFC7830 */ GLDNS_EDNS_PADDING = 12 /* RFC7830 */
}; };
@ -430,6 +434,15 @@ typedef enum gldns_enum_edns_option gldns_edns_option;
#define GLDNS_EDNS_MASK_DO_BIT 0x8000 #define GLDNS_EDNS_MASK_DO_BIT 0x8000
/** TSIG and TKEY extended rcodes (16bit), 0-15 are the normal rcodes. */
#define GLDNS_TSIG_ERROR_NOERROR 0
#define GLDNS_TSIG_ERROR_BADSIG 16
#define GLDNS_TSIG_ERROR_BADKEY 17
#define GLDNS_TSIG_ERROR_BADTIME 18
#define GLDNS_TSIG_ERROR_BADMODE 19
#define GLDNS_TSIG_ERROR_BADNAME 20
#define GLDNS_TSIG_ERROR_BADALG 21
/** /**
* Contains all information about resource record types. * Contains all information about resource record types.
* *

View File

@ -664,6 +664,14 @@ rrinternal_parse_rdata(gldns_buffer* strbuf, char* token, size_t token_len,
&pre_data_pos, delimiters, &pre_data_pos, delimiters,
rdftype, &token_strlen)) rdftype, &token_strlen))
break; break;
} else if(rdftype == GLDNS_RDF_TYPE_INT16_DATA &&
strcmp(token, "0")!=0) {
/* affix len and b64 fields */
if(!gldns_affix_token(strbuf, token,
&token_len, &quoted, &parens,
&pre_data_pos, delimiters,
rdftype, &token_strlen))
break;
} }
/* normal RR */ /* normal RR */
@ -940,6 +948,8 @@ int gldns_str2wire_rdf_buf(const char* str, uint8_t* rd, size_t* len,
return gldns_str2wire_time_buf(str, rd, len); return gldns_str2wire_time_buf(str, rd, len);
case GLDNS_RDF_TYPE_PERIOD: case GLDNS_RDF_TYPE_PERIOD:
return gldns_str2wire_period_buf(str, rd, len); return gldns_str2wire_period_buf(str, rd, len);
case GLDNS_RDF_TYPE_TSIGTIME:
return gldns_str2wire_tsigtime_buf(str, rd, len);
case GLDNS_RDF_TYPE_LOC: case GLDNS_RDF_TYPE_LOC:
return gldns_str2wire_loc_buf(str, rd, len); return gldns_str2wire_loc_buf(str, rd, len);
case GLDNS_RDF_TYPE_WKS: case GLDNS_RDF_TYPE_WKS:
@ -964,6 +974,8 @@ int gldns_str2wire_rdf_buf(const char* str, uint8_t* rd, size_t* len,
return gldns_str2wire_tag_buf(str, rd, len); return gldns_str2wire_tag_buf(str, rd, len);
case GLDNS_RDF_TYPE_LONG_STR: case GLDNS_RDF_TYPE_LONG_STR:
return gldns_str2wire_long_str_buf(str, rd, len); return gldns_str2wire_long_str_buf(str, rd, len);
case GLDNS_RDF_TYPE_TSIGERROR:
return gldns_str2wire_tsigerror_buf(str, rd, len);
case GLDNS_RDF_TYPE_HIP: case GLDNS_RDF_TYPE_HIP:
return gldns_str2wire_hip_buf(str, rd, len); return gldns_str2wire_hip_buf(str, rd, len);
case GLDNS_RDF_TYPE_INT16_DATA: case GLDNS_RDF_TYPE_INT16_DATA:
@ -1341,6 +1353,21 @@ int gldns_str2wire_alg_buf(const char* str, uint8_t* rd, size_t* len)
return GLDNS_WIREPARSE_ERR_OK; return GLDNS_WIREPARSE_ERR_OK;
} }
int gldns_str2wire_tsigerror_buf(const char* str, uint8_t* rd, size_t* len)
{
gldns_lookup_table *lt = gldns_lookup_by_name(gldns_tsig_errors, str);
if(*len < 2)
return GLDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
if(lt) {
gldns_write_uint16(rd, (uint16_t)lt->id);
*len = 2;
} else {
/* try as-is (a number) */
return gldns_str2wire_int16_buf(str, rd, len);
}
return GLDNS_WIREPARSE_ERR_OK;
}
int gldns_str2wire_time_buf(const char* str, uint8_t* rd, size_t* len) int gldns_str2wire_time_buf(const char* str, uint8_t* rd, size_t* len)
{ {
/* convert a time YYYYDDMMHHMMSS to wireformat */ /* convert a time YYYYDDMMHHMMSS to wireformat */
@ -1383,6 +1410,24 @@ int gldns_str2wire_time_buf(const char* str, uint8_t* rd, size_t* len)
return GLDNS_WIREPARSE_ERR_OK; return GLDNS_WIREPARSE_ERR_OK;
} }
int gldns_str2wire_tsigtime_buf(const char* str, uint8_t* rd, size_t* len)
{
char* end;
uint64_t t = (uint64_t)strtol((char*)str, &end, 10);
uint16_t high;
uint32_t low;
if(*end != 0)
return RET_ERR(GLDNS_WIREPARSE_ERR_SYNTAX_TIME, end-str);
if(*len < 6)
return GLDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
high = (uint16_t)(t>>32);
low = (uint32_t)(t);
gldns_write_uint16(rd, high);
gldns_write_uint32(rd+2, low);
*len = 6;
return GLDNS_WIREPARSE_ERR_OK;
}
int gldns_str2wire_period_buf(const char* str, uint8_t* rd, size_t* len) int gldns_str2wire_period_buf(const char* str, uint8_t* rd, size_t* len)
{ {
const char* end; const char* end;
@ -2008,16 +2053,29 @@ int gldns_str2wire_hip_buf(const char* str, uint8_t* rd, size_t* len)
int gldns_str2wire_int16_data_buf(const char* str, uint8_t* rd, size_t* len) int gldns_str2wire_int16_data_buf(const char* str, uint8_t* rd, size_t* len)
{ {
size_t sz = gldns_b64_pton_calculate_size(strlen(str)); char* s;
int n; int n;
if(*len < sz+2) n = strtol(str, &s, 10);
if(*len < ((size_t)n)+2)
return GLDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; return GLDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
if(sz > 65535) if(n > 65535)
return GLDNS_WIREPARSE_ERR_LABEL_OVERFLOW; return GLDNS_WIREPARSE_ERR_LABEL_OVERFLOW;
n = gldns_b64_pton(str, rd+2, (*len)-2);
if(n == 0) {
gldns_write_uint16(rd, 0);
*len = 2;
return GLDNS_WIREPARSE_ERR_OK;
}
if(*s != ' ')
return RET_ERR(GLDNS_WIREPARSE_ERR_SYNTAX_INT, s-(char*)str);
s++;
while(*s == ' ')
s++;
n = gldns_b64_pton(s, rd+2, (*len)-2);
if(n < 0) if(n < 0)
return GLDNS_WIREPARSE_ERR_SYNTAX_B64; return GLDNS_WIREPARSE_ERR_SYNTAX_B64;
gldns_write_uint16(rd, (uint16_t)n); gldns_write_uint16(rd, (uint16_t)n);
*len = (size_t)n; *len = ((size_t)n)+2;
return GLDNS_WIREPARSE_ERR_OK; return GLDNS_WIREPARSE_ERR_OK;
} }

View File

@ -417,6 +417,24 @@ int gldns_str2wire_time_buf(const char* str, uint8_t* rd, size_t* len);
*/ */
int gldns_str2wire_period_buf(const char* str, uint8_t* rd, size_t* len); int gldns_str2wire_period_buf(const char* str, uint8_t* rd, size_t* len);
/**
* Convert rdf of type GLDNS_RDF_TYPE_TSIGTIME from string to wireformat.
* @param str: the text to convert for this rdata element.
* @param rd: rdata buffer for the wireformat.
* @param len: length of rd buffer on input, used length on output.
* @return 0 on success, error on failure.
*/
int gldns_str2wire_tsigtime_buf(const char* str, uint8_t* rd, size_t* len);
/**
* Convert rdf of type GLDNS_RDF_TYPE_TSIGERROR from string to wireformat.
* @param str: the text to convert for this rdata element.
* @param rd: rdata buffer for the wireformat.
* @param len: length of rd buffer on input, used length on output.
* @return 0 on success, error on failure.
*/
int gldns_str2wire_tsigerror_buf(const char* str, uint8_t* rd, size_t* len);
/** /**
* Convert rdf of type GLDNS_RDF_TYPE_LOC from string to wireformat. * Convert rdf of type GLDNS_RDF_TYPE_LOC from string to wireformat.
* @param str: the text to convert for this rdata element. * @param str: the text to convert for this rdata element.

View File

@ -173,6 +173,28 @@ static gldns_lookup_table gldns_edns_options_data[] = {
}; };
gldns_lookup_table* gldns_edns_options = gldns_edns_options_data; gldns_lookup_table* gldns_edns_options = gldns_edns_options_data;
static gldns_lookup_table gldns_tsig_errors_data[] = {
{ GLDNS_TSIG_ERROR_NOERROR, "NOERROR" },
{ GLDNS_RCODE_FORMERR, "FORMERR" },
{ GLDNS_RCODE_SERVFAIL, "SERVFAIL" },
{ GLDNS_RCODE_NXDOMAIN, "NXDOMAIN" },
{ GLDNS_RCODE_NOTIMPL, "NOTIMPL" },
{ GLDNS_RCODE_REFUSED, "REFUSED" },
{ GLDNS_RCODE_YXDOMAIN, "YXDOMAIN" },
{ GLDNS_RCODE_YXRRSET, "YXRRSET" },
{ GLDNS_RCODE_NXRRSET, "NXRRSET" },
{ GLDNS_RCODE_NOTAUTH, "NOTAUTH" },
{ GLDNS_RCODE_NOTZONE, "NOTZONE" },
{ GLDNS_TSIG_ERROR_BADSIG, "BADSIG" },
{ GLDNS_TSIG_ERROR_BADKEY, "BADKEY" },
{ GLDNS_TSIG_ERROR_BADTIME, "BADTIME" },
{ GLDNS_TSIG_ERROR_BADMODE, "BADMODE" },
{ GLDNS_TSIG_ERROR_BADNAME, "BADNAME" },
{ GLDNS_TSIG_ERROR_BADALG, "BADALG" },
{ 0, NULL }
};
gldns_lookup_table* gldns_tsig_errors = gldns_tsig_errors_data;
char* gldns_wire2str_pkt(uint8_t* data, size_t len) char* gldns_wire2str_pkt(uint8_t* data, size_t len)
{ {
size_t slen = (size_t)gldns_wire2str_pkt_buf(data, len, NULL, 0); size_t slen = (size_t)gldns_wire2str_pkt_buf(data, len, NULL, 0);
@ -195,22 +217,14 @@ char* gldns_wire2str_type(uint16_t rrtype)
{ {
char buf[16]; char buf[16];
gldns_wire2str_type_buf(rrtype, buf, sizeof(buf)); gldns_wire2str_type_buf(rrtype, buf, sizeof(buf));
#ifndef USE_WINSOCK
return strdup(buf); return strdup(buf);
#else
return _strdup(buf);
#endif
} }
char* gldns_wire2str_class(uint16_t rrclass) char* gldns_wire2str_class(uint16_t rrclass)
{ {
char buf[16]; char buf[16];
gldns_wire2str_class_buf(rrclass, buf, sizeof(buf)); gldns_wire2str_class_buf(rrclass, buf, sizeof(buf));
#ifndef USE_WINSOCK
return strdup(buf); return strdup(buf);
#else
return _strdup(buf);
#endif
} }
char* gldns_wire2str_dname(uint8_t* dname, size_t dname_len) char* gldns_wire2str_dname(uint8_t* dname, size_t dname_len)
@ -226,11 +240,7 @@ char* gldns_wire2str_rcode(int rcode)
{ {
char buf[16]; char buf[16];
gldns_wire2str_rcode_buf(rcode, buf, sizeof(buf)); gldns_wire2str_rcode_buf(rcode, buf, sizeof(buf));
#ifndef USE_WINSOCK
return strdup(buf); return strdup(buf);
#else
return _strdup(buf);
#endif
} }
int gldns_wire2str_pkt_buf(uint8_t* d, size_t dlen, char* s, size_t slen) int gldns_wire2str_pkt_buf(uint8_t* d, size_t dlen, char* s, size_t slen)
@ -285,6 +295,12 @@ int gldns_wire2str_rcode_buf(int rcode, char* s, size_t slen)
return gldns_wire2str_rcode_print(&s, &slen, rcode); return gldns_wire2str_rcode_print(&s, &slen, rcode);
} }
int gldns_wire2str_opcode_buf(int opcode, char* s, size_t slen)
{
/* use arguments as temporary variables */
return gldns_wire2str_opcode_print(&s, &slen, opcode);
}
int gldns_wire2str_dname_buf(uint8_t* d, size_t dlen, char* s, size_t slen) int gldns_wire2str_dname_buf(uint8_t* d, size_t dlen, char* s, size_t slen)
{ {
/* use arguments as temporary variables */ /* use arguments as temporary variables */
@ -982,6 +998,8 @@ int gldns_wire2str_rdf_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen,
return gldns_wire2str_tag_scan(d, dlen, s, slen); return gldns_wire2str_tag_scan(d, dlen, s, slen);
case GLDNS_RDF_TYPE_LONG_STR: case GLDNS_RDF_TYPE_LONG_STR:
return gldns_wire2str_long_str_scan(d, dlen, s, slen); return gldns_wire2str_long_str_scan(d, dlen, s, slen);
case GLDNS_RDF_TYPE_TSIGERROR:
return gldns_wire2str_tsigerror_scan(d, dlen, s, slen);
} }
/* unknown rdf type */ /* unknown rdf type */
return -1; return -1;
@ -1580,6 +1598,7 @@ int gldns_wire2str_hip_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
int gldns_wire2str_int16_data_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) int gldns_wire2str_int16_data_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
{ {
int w;
uint16_t n; uint16_t n;
if(*dl < 2) if(*dl < 2)
return -1; return -1;
@ -1588,7 +1607,12 @@ int gldns_wire2str_int16_data_scan(uint8_t** d, size_t* dl, char** s, size_t* sl
return -1; return -1;
(*d)+=2; (*d)+=2;
(*dl)-=2; (*dl)-=2;
return gldns_wire2str_b64_scan_num(d, dl, s, sl, n); if(n == 0) {
return gldns_str_print(s, sl, "0");
}
w = gldns_str_print(s, sl, "%u ", (unsigned)n);
w += gldns_wire2str_b64_scan_num(d, dl, s, sl, n);
return w;
} }
int gldns_wire2str_nsec3_next_owner_scan(uint8_t** d, size_t* dl, char** s, int gldns_wire2str_nsec3_next_owner_scan(uint8_t** d, size_t* dl, char** s,
@ -1645,10 +1669,10 @@ int gldns_wire2str_tag_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
if(*dl < 1+n) if(*dl < 1+n)
return -1; return -1;
for(i=0; i<n; i++) for(i=0; i<n; i++)
if(!isalnum((unsigned char)(*d)[i])) if(!isalnum((unsigned char)(*d)[i+1]))
return -1; return -1;
for(i=0; i<n; i++) for(i=0; i<n; i++)
w += gldns_str_print(s, sl, "%c", (char)(*d)[i]); w += gldns_str_print(s, sl, "%c", (char)(*d)[i+1]);
(*d)+=n+1; (*d)+=n+1;
(*dl)-=(n+1); (*dl)-=(n+1);
return w; return w;
@ -1667,6 +1691,21 @@ int gldns_wire2str_long_str_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
return w; return w;
} }
int gldns_wire2str_tsigerror_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
{
gldns_lookup_table *lt;
int data, w;
if(*dl < 2) return -1;
data = (int)gldns_read_uint16(*d);
lt = gldns_lookup_by_id(gldns_tsig_errors, data);
if(lt && lt->name)
w = gldns_str_print(s, sl, "%s", lt->name);
else w = gldns_str_print(s, sl, "%d", data);
(*dl)-=2;
(*d)+=2;
return w;
}
int gldns_wire2str_edns_llq_print(char** s, size_t* sl, uint8_t* data, int gldns_wire2str_edns_llq_print(char** s, size_t* sl, uint8_t* data,
size_t len) size_t len)
{ {

View File

@ -38,6 +38,8 @@ extern struct gldns_struct_lookup_table* gldns_edns_flags;
extern struct gldns_struct_lookup_table* gldns_edns_options; extern struct gldns_struct_lookup_table* gldns_edns_options;
/** error string from wireparse */ /** error string from wireparse */
extern struct gldns_struct_lookup_table* gldns_wireparse_errors; extern struct gldns_struct_lookup_table* gldns_wireparse_errors;
/** tsig errors are the rcodes with extra (higher) values */
extern struct gldns_struct_lookup_table* gldns_tsig_errors;
/** /**
* Convert wireformat packet to a string representation * Convert wireformat packet to a string representation
@ -441,6 +443,17 @@ int gldns_wire2str_class_buf(uint16_t rrclass, char* str, size_t len);
*/ */
int gldns_wire2str_rcode_buf(int rcode, char* str, size_t len); int gldns_wire2str_rcode_buf(int rcode, char* str, size_t len);
/**
* Convert host format opcode to a string. 'QUERY', 'NOTIFY', 'UPDATE'.
* With user buffer.
* @param opcode: opcode as integer in host order
* @param str: the string to write to.
* @param len: length of str.
* @return the number of characters for this element, excluding zerobyte.
* Is larger or equal than str_len if output was truncated.
*/
int gldns_wire2str_opcode_buf(int opcode, char* str, size_t len);
/** /**
* Convert wire dname to a string, "example.com.". With user buffer. * Convert wire dname to a string, "example.com.". With user buffer.
* @param dname: the dname in uncompressed wireformat. * @param dname: the dname in uncompressed wireformat.
@ -796,6 +809,19 @@ int gldns_wire2str_hip_scan(uint8_t** data, size_t* data_len, char** str,
int gldns_wire2str_int16_data_scan(uint8_t** data, size_t* data_len, char** str, int gldns_wire2str_int16_data_scan(uint8_t** data, size_t* data_len, char** str,
size_t* str_len); size_t* str_len);
/**
* Scan wireformat tsigerror field to string, with user buffers.
* It shifts the arguments to move along (see gldns_wire2str_pkt_scan).
* @param data: wireformat data.
* @param data_len: length of data buffer.
* @param str: string buffer.
* @param str_len: length of string buffer.
* @return number of characters (except null) needed to print.
* Can return -1 on failure.
*/
int gldns_wire2str_tsigerror_scan(uint8_t** data, size_t* data_len, char** str,
size_t* str_len);
/** /**
* Scan wireformat nsec3_next_owner field to string, with user buffers. * Scan wireformat nsec3_next_owner field to string, with user buffers.
* It shifts the arguments to move along (see gldns_wire2str_pkt_scan). * It shifts the arguments to move along (see gldns_wire2str_pkt_scan).

View File

@ -487,6 +487,8 @@ static _getdns_rdata_def rt_rdata[] = {
{ "intermediate_host" , GETDNS_RDF_N , NULL }}; { "intermediate_host" , GETDNS_RDF_N , NULL }};
static _getdns_rdata_def nsap_rdata[] = { static _getdns_rdata_def nsap_rdata[] = {
{ "nsap" , GETDNS_RDF_X , NULL }}; { "nsap" , GETDNS_RDF_X , NULL }};
static _getdns_rdata_def nsap_ptr_rdata[] = {
{ "owner" , GETDNS_RDF_S , NULL }};
static _getdns_rdata_def sig_rdata[] = { static _getdns_rdata_def sig_rdata[] = {
{ "sig_obsolete" , GETDNS_RDF_X , NULL }}; { "sig_obsolete" , GETDNS_RDF_X , NULL }};
static _getdns_rdata_def key_rdata[] = { static _getdns_rdata_def key_rdata[] = {
@ -505,6 +507,10 @@ static _getdns_rdata_def loc_rdata[] = {
{ "loc_obsolete" , GETDNS_RDF_X , NULL }}; { "loc_obsolete" , GETDNS_RDF_X , NULL }};
static _getdns_rdata_def nxt_rdata[] = { static _getdns_rdata_def nxt_rdata[] = {
{ "nxt_obsolete" , GETDNS_RDF_X , NULL }}; { "nxt_obsolete" , GETDNS_RDF_X , NULL }};
static _getdns_rdata_def eid_rdata[] = {
{ "endpoint_identifier" , GETDNS_RDF_X , NULL }};
static _getdns_rdata_def nimloc_rdata[] = {
{ "nimrod_locator" , GETDNS_RDF_X , NULL }};
static _getdns_rdata_def srv_rdata[] = { static _getdns_rdata_def srv_rdata[] = {
{ "priority" , GETDNS_RDF_I2 , NULL }, { "priority" , GETDNS_RDF_I2 , NULL },
{ "weight" , GETDNS_RDF_I2 , NULL }, { "weight" , GETDNS_RDF_I2 , NULL },
@ -598,6 +604,11 @@ static _getdns_rdata_def hip_rdata[] = {
{ "hit" , GETDNS_RDF_SPECIAL, &hip_hit }, { "hit" , GETDNS_RDF_SPECIAL, &hip_hit },
{ "public_key" , GETDNS_RDF_SPECIAL, &hip_public_key }, { "public_key" , GETDNS_RDF_SPECIAL, &hip_public_key },
{ "rendezvous_servers" , GETDNS_RDF_N_M , NULL }}; { "rendezvous_servers" , GETDNS_RDF_N_M , NULL }};
static _getdns_rdata_def talink_rdata[] = {
{ "previous" , GETDNS_RDF_N , NULL },
{ "next" , GETDNS_RDF_N , NULL }};
static _getdns_rdata_def openpgpkey_rdata[] = {
{ "transferable_public_key" , GETDNS_RDF_B , NULL }};
static _getdns_rdata_def csync_rdata[] = { static _getdns_rdata_def csync_rdata[] = {
{ "serial" , GETDNS_RDF_I4 , NULL }, { "serial" , GETDNS_RDF_I4 , NULL },
{ "flags" , GETDNS_RDF_I2 , NULL }, { "flags" , GETDNS_RDF_I2 , NULL },
@ -673,17 +684,17 @@ static _getdns_rr_def _getdns_rr_defs[] = {
{ "X25", x25_rdata, ALEN( x25_rdata) }, { "X25", x25_rdata, ALEN( x25_rdata) },
{ "ISDN", isdn_rdata, ALEN( isdn_rdata) }, { "ISDN", isdn_rdata, ALEN( isdn_rdata) },
{ "RT", rt_rdata, ALEN( rt_rdata) }, { "RT", rt_rdata, ALEN( rt_rdata) },
{ "NSAP", nsap_rdata, ALEN( nsap_rdata) }, /* - 22 */ { "NSAP", nsap_rdata, ALEN( nsap_rdata) },
{ NULL, NULL, 0 }, { "NSAP_PTR", nsap_ptr_rdata, ALEN( nsap_ptr_rdata) },
{ "SIG", sig_rdata, ALEN( sig_rdata) }, /* 24 - */ { "SIG", sig_rdata, ALEN( sig_rdata) },
{ "KEY", key_rdata, ALEN( key_rdata) }, { "KEY", key_rdata, ALEN( key_rdata) },
{ "PX", px_rdata, ALEN( px_rdata) }, { "PX", px_rdata, ALEN( px_rdata) },
{ "GPOS", gpos_rdata, ALEN( gpos_rdata) }, { "GPOS", gpos_rdata, ALEN( gpos_rdata) },
{ "AAAA", aaaa_rdata, ALEN( aaaa_rdata) }, { "AAAA", aaaa_rdata, ALEN( aaaa_rdata) },
{ "LOC", loc_rdata, ALEN( loc_rdata) }, { "LOC", loc_rdata, ALEN( loc_rdata) },
{ "NXT", nxt_rdata, ALEN( nxt_rdata) }, { "NXT", nxt_rdata, ALEN( nxt_rdata) },
{ "EID", UNKNOWN_RDATA, 0 }, { "EID", eid_rdata, ALEN( eid_rdata) },
{ "NIMLOC", UNKNOWN_RDATA, 0 }, { "NIMLOC", nimloc_rdata, ALEN( nimloc_rdata) },
{ "SRV", srv_rdata, ALEN( srv_rdata) }, { "SRV", srv_rdata, ALEN( srv_rdata) },
{ "ATMA", atma_rdata, ALEN( atma_rdata) }, { "ATMA", atma_rdata, ALEN( atma_rdata) },
{ "NAPTR", naptr_rdata, ALEN( naptr_rdata) }, { "NAPTR", naptr_rdata, ALEN( naptr_rdata) },
@ -703,16 +714,16 @@ static _getdns_rr_def _getdns_rr_defs[] = {
{ "DHCID", dhcid_rdata, ALEN( dhcid_rdata) }, { "DHCID", dhcid_rdata, ALEN( dhcid_rdata) },
{ "NSEC3", nsec3_rdata, ALEN( nsec3_rdata) }, { "NSEC3", nsec3_rdata, ALEN( nsec3_rdata) },
{ "NSEC3PARAM", nsec3param_rdata, ALEN(nsec3param_rdata) }, { "NSEC3PARAM", nsec3param_rdata, ALEN(nsec3param_rdata) },
{ "TLSA", tlsa_rdata, ALEN( tlsa_rdata) }, /* - 52 */ { "TLSA", tlsa_rdata, ALEN( tlsa_rdata) },
{ NULL, NULL, 0 }, { "SMIMEA", tlsa_rdata, ALEN( tlsa_rdata) }, /* - 53 */
{ NULL, NULL, 0 }, { NULL, NULL, 0 },
{ "HIP", hip_rdata, ALEN( hip_rdata) }, /* 55 - */ { "HIP", hip_rdata, ALEN( hip_rdata) }, /* 55 - */
{ "NINFO", UNKNOWN_RDATA, 0 }, { "NINFO", UNKNOWN_RDATA, 0 },
{ "RKEY", UNKNOWN_RDATA, 0 }, { "RKEY", UNKNOWN_RDATA, 0 },
{ "TALINK", UNKNOWN_RDATA, 0 }, { "TALINK", talink_rdata, ALEN( talink_rdata) },
{ "CDS", ds_rdata, ALEN( ds_rdata) }, { "CDS", ds_rdata, ALEN( ds_rdata) },
{ "CDNSKEY", dnskey_rdata, ALEN( dnskey_rdata) }, { "CDNSKEY", dnskey_rdata, ALEN( dnskey_rdata) },
{ "OPENPGPKEY", UNKNOWN_RDATA, 0 }, /* 61 - */ { "OPENPGPKEY", openpgpkey_rdata, ALEN(openpgpkey_rdata) }, /* 61 - */
{ "CSYNC", csync_rdata, ALEN( csync_rdata) }, /* - 62 */ { "CSYNC", csync_rdata, ALEN( csync_rdata) }, /* - 62 */
{ NULL, NULL, 0 }, { NULL, NULL, 0 },
{ NULL, NULL, 0 }, { NULL, NULL, 0 },
@ -908,20 +919,21 @@ static _getdns_rr_def _getdns_rr_defs[] = {
{ "MAILA", UNKNOWN_RDATA, 0 }, /* - 254 */ { "MAILA", UNKNOWN_RDATA, 0 }, /* - 254 */
{ NULL, NULL, 0 }, { NULL, NULL, 0 },
{ "URI", uri_rdata, ALEN( uri_rdata) }, /* 256 - */ { "URI", uri_rdata, ALEN( uri_rdata) }, /* 256 - */
{ "CAA", caa_rdata, ALEN( caa_rdata) }, /* - 257 */ { "CAA", caa_rdata, ALEN( caa_rdata) },
{ "TA", UNKNOWN_RDATA, 0 }, /* 32768 */ { "AVC", txt_rdata, ALEN( txt_rdata) }, /* - 258 */
{ "TA", ds_rdata, ALEN( ds_rdata) }, /* 32768 */
{ "DLV", dlv_rdata, ALEN( dlv_rdata) } /* 32769 */ { "DLV", dlv_rdata, ALEN( dlv_rdata) } /* 32769 */
}; };
const _getdns_rr_def * const _getdns_rr_def *
_getdns_rr_def_lookup(uint16_t rr_type) _getdns_rr_def_lookup(uint16_t rr_type)
{ {
if (rr_type <= 257) if (rr_type <= 258)
return &_getdns_rr_defs[rr_type]; return &_getdns_rr_defs[rr_type];
else if (rr_type == 32768) else if (rr_type == 32768)
return &_getdns_rr_defs[258];
else if (rr_type == 32769)
return &_getdns_rr_defs[259]; return &_getdns_rr_defs[259];
else if (rr_type == 32769)
return &_getdns_rr_defs[260];
return _getdns_rr_defs; return _getdns_rr_defs;
} }

View File

@ -0,0 +1,15 @@
BaseName: 080-iana-rr-types
Version: 1.0
Description: Fetch dns-parameters.xml from iana and check all RR types
CreationDate: di 2 mei 2017 15:11:53 CEST
Maintainer: Willem Toorop
Category:
Component:
Depends:
CmdDepends: wget, grep
Pre:
Post:
Test: 080-iana-rr-types.test
AuxFiles:
Passed:
Failure:

View File

@ -0,0 +1,51 @@
# source the master var file when it's there
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
# use .tpkg.var.test for in test variable passing
[ -f .tpkg.var.test ] && source .tpkg.var.test
# svnserve resets the path, you may need to adjust it, like this:
PATH=$PATH:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:.
# first arg is the build dir
TPKG_BUILD=$1
PARAM_XML="dns-parameters.xml"
PARAM_URL="http://www.iana.org/assignments/dns-parameters/$PARAM_XML"
if [ -f $PARAM_XML ]
then
mv $PARAM_XML ${PARAM_XML}.aandekant
fi
if which wget
then
wget "$PARAM_URL"
elif ! ( echo quit | ftp "$PARAM_URL" )
then
echo "Don't have wget or ftp to get $PARAM_URL"
exit -1
fi
EXIT_STATUS=0
for TYPE_VAL in `awk '/<type>[^<>]*<\/type>/{ a=$1; getline; b=$1; print a""b }' dns-parameters.xml | sed -e 's/<type>//g' -e 's/<\/type>//g' -e 's/<value>/:/g' -e 's/<\/value>//g'|egrep -v '^(Unassigned|Private|Reserved)'`
do
TYPE=${TYPE_VAL%:*}
VALUE=${TYPE_VAL#*:}
case "x$TYPE" in
x\*) TYPE="ANY"
;;
xNSAP-PTR) TYPE="NSAP_PTR"
;;
esac
if ! grep -q "LDNS_RR_TYPE_${TYPE} = ${VALUE}" ${SRCROOT}/src/gldns/rrdef.h
then
echo "RR type ${TYPE} (value ${VALUE}) not in rrdef.h"
EXIT_STATUS=1
fi
if ! grep -q "GETDNS_RRTYPE_${TYPE}[ ][ ]*${VALUE}" ${SRCROOT}/src/getdns/getdns.h.in
then
echo "RR type ${TYPE} (value ${VALUE}) not in getdns.h.in"
EXIT_STATUS=1
fi
done
exit $EXIT_STATUS

View File

@ -322,6 +322,7 @@
"name": <bindata for eid.net-dns.org.>, "name": <bindata for eid.net-dns.org.>,
"rdata": "rdata":
{ {
"endpoint_identifier": <bindata of 0xe32c6f78164a9348>,
"rdata_raw": <bindata of 0xe32c6f78164a9348> "rdata_raw": <bindata of 0xe32c6f78164a9348>
}, },
"ttl": 30, "ttl": 30,
@ -699,6 +700,7 @@
"name": <bindata for nimloc.net-dns.org.>, "name": <bindata for nimloc.net-dns.org.>,
"rdata": "rdata":
{ {
"nimrod_locator": <bindata of 0x32251b030067>,
"rdata_raw": <bindata of 0x32251b030067> "rdata_raw": <bindata of 0x32251b030067>
}, },
"ttl": 30, "ttl": 30,
@ -720,10 +722,11 @@
"name": <bindata for 444433332222111199990123000000ff.net-dns.org.>, "name": <bindata for 444433332222111199990123000000ff.net-dns.org.>,
"rdata": "rdata":
{ {
"owner": <bindata of "host">,
"rdata_raw": <bindata of 0x04686f7374> "rdata_raw": <bindata of 0x04686f7374>
}, },
"ttl": 30, "ttl": 30,
"type": 23 "type": GETDNS_RRTYPE_NSAP_PTR
}, },
{ {
"class": GETDNS_RRCLASS_IN, "class": GETDNS_RRCLASS_IN,
@ -772,7 +775,8 @@
"name": <bindata for 3fa2675708e4613939a03a3a8f3517118fe470e519d634a763d89037._openpgpkey.net-dns.org.>, "name": <bindata for 3fa2675708e4613939a03a3a8f3517118fe470e519d634a763d89037._openpgpkey.net-dns.org.>,
"rdata": "rdata":
{ {
"rdata_raw": <bindata of 0x99010d0454d3894e010800dd21ce0d43...> "rdata_raw": <bindata of 0x99010d0454d3894e010800dd21ce0d43...>,
"transferable_public_key": <bindata of 0x99010d0454d3894e010800dd21ce0d43...>
}, },
"ttl": 30, "ttl": 30,
"type": GETDNS_RRTYPE_OPENPGPKEY "type": GETDNS_RRTYPE_OPENPGPKEY
@ -901,6 +905,8 @@
"name": <bindata for talink.net-dns.org.>, "name": <bindata for talink.net-dns.org.>,
"rdata": "rdata":
{ {
"next": <bindata for h2.net-dns.org.>,
"previous": <bindata for h0.net-dns.org.>,
"rdata_raw": <bindata of 0x026830076e65742d646e73036f726700...> "rdata_raw": <bindata of 0x026830076e65742d646e73036f726700...>
}, },
"ttl": 30, "ttl": 30,
@ -1018,7 +1024,7 @@ aaaa.net-dns.org. 30 IN AAAA 2a04:b900::2:0:0:23
afsdb.net-dns.org. 30 IN AFSDB 12 getdnsapi.net-dns.org. afsdb.net-dns.org. 30 IN AFSDB 12 getdnsapi.net-dns.org.
apl.net-dns.org. 30 IN APL 1:192.168.42.0/26 1:192.168.42.64/26 !1:192.168.42.128/25 1:224.0.0.0/4 2:ff00:0000:0000:0000:0000:0000:0000:0000/8 apl.net-dns.org. 30 IN APL 1:192.168.42.0/26 1:192.168.42.64/26 !1:192.168.42.128/25 1:224.0.0.0/4 2:ff00:0000:0000:0000:0000:0000:0000:0000/8
atm-host.net-dns.org. 30 IN ATMA 4700790001020000000000000000A03E00000200 atm-host.net-dns.org. 30 IN ATMA 4700790001020000000000000000A03E00000200
caa.net-dns.org. 30 IN CAA \# 21 0005697373756563612E6E65742D646E732E6F7267 caa.net-dns.org. 30 IN CAA 0 issue "ca.net-dns.org"
cdnskey.net-dns.org. 30 IN CDNSKEY 256 3 5 AQOraLfzarHAlFskVGwAGnX0LRjlcOiO6y5WM4Kz+QvZ9vX28h4lOvnfd5tkxnZm7ERLTAJoFq+1w/wl7VXs2Isz75BSZ7LQh3OT2xXnS6VT5ZxXko/UCOdoGiKZZ63jHZ0jNSTCYy8+5rfvwRD8s3gGuErp5KcHg3V8VLUKSDNNEQ== cdnskey.net-dns.org. 30 IN CDNSKEY 256 3 5 AQOraLfzarHAlFskVGwAGnX0LRjlcOiO6y5WM4Kz+QvZ9vX28h4lOvnfd5tkxnZm7ERLTAJoFq+1w/wl7VXs2Isz75BSZ7LQh3OT2xXnS6VT5ZxXko/UCOdoGiKZZ63jHZ0jNSTCYy8+5rfvwRD8s3gGuErp5KcHg3V8VLUKSDNNEQ==
cds.net-dns.org. 30 IN CDS 13026 3 1 0259F20021 cds.net-dns.org. 30 IN CDS 13026 3 1 0259F20021
cert.net-dns.org. 30 IN CERT PKIX 65535 1 AQOppkQvFlPFLiWZc0NXX5/QY44jphv3vfX0dscHNmThNtfx0TUgfBb1YQKJX6MNrzu/vvtV3xpLcCJ+tIP8ADDiMaUYT5Gh6kmn22V7FgHPlCHRJ+AcudQbeYgw1KCYS9D46oEvBR8mQ4HFTEkdWg+PETATQk77P1CmmURdogcmzZqZIer+VAs6uusIdxrmWeP8j2aYRvozdjvgzmHXSabDDxrnuIbnL4r4qAoc6Q9DAybYA7Ya52gtH06dFOkaQr1dvHu1iJES16H0SL/OlhsOVrZmM1RFcwDGXcnxiKZ4TdtFeXQ/6VN3JegLR5t2FyKzoKYb4klpdZM8JVuVtc/n cert.net-dns.org. 30 IN CERT PKIX 65535 1 AQOppkQvFlPFLiWZc0NXX5/QY44jphv3vfX0dscHNmThNtfx0TUgfBb1YQKJX6MNrzu/vvtV3xpLcCJ+tIP8ADDiMaUYT5Gh6kmn22V7FgHPlCHRJ+AcudQbeYgw1KCYS9D46oEvBR8mQ4HFTEkdWg+PETATQk77P1CmmURdogcmzZqZIer+VAs6uusIdxrmWeP8j2aYRvozdjvgzmHXSabDDxrnuIbnL4r4qAoc6Q9DAybYA7Ya52gtH06dFOkaQr1dvHu1iJES16H0SL/OlhsOVrZmM1RFcwDGXcnxiKZ4TdtFeXQ/6VN3JegLR5t2FyKzoKYb4klpdZM8JVuVtc/n
@ -1029,7 +1035,7 @@ dlv.net-dns.org. 30 IN DLV 13026 3 1 0259F20021A0F2FF8BBBD8AB6174AC2412FDF363
dname.net-dns.org. 30 IN DNAME net-dns.net. dname.net-dns.org. 30 IN DNAME net-dns.net.
dnskey.net-dns.org. 30 IN DNSKEY 256 3 5 AQOraLfzarHAlFskVGwAGnX0LRjlcOiO6y5WM4Kz+QvZ9vX28h4lOvnfd5tkxnZm7ERLTAJoFq+1w/wl7VXs2Isz75BSZ7LQh3OT2xXnS6VT5ZxXko/UCOdoGiKZZ63jHZ0jNSTCYy8+5rfvwRD8s3gGuErp5KcHg3V8VLUKSDNNEQ== ;{id = 42860 (zsk), size = 1024b} dnskey.net-dns.org. 30 IN DNSKEY 256 3 5 AQOraLfzarHAlFskVGwAGnX0LRjlcOiO6y5WM4Kz+QvZ9vX28h4lOvnfd5tkxnZm7ERLTAJoFq+1w/wl7VXs2Isz75BSZ7LQh3OT2xXnS6VT5ZxXko/UCOdoGiKZZ63jHZ0jNSTCYy8+5rfvwRD8s3gGuErp5KcHg3V8VLUKSDNNEQ== ;{id = 42860 (zsk), size = 1024b}
ds.net-dns.org. 30 IN DS 13026 3 1 0259F20021A0F2FF8BBBD8AB6174AC2412FDF363 ds.net-dns.org. 30 IN DS 13026 3 1 0259F20021A0F2FF8BBBD8AB6174AC2412FDF363
eid.net-dns.org. 30 IN EID \# 0 eid.net-dns.org. 30 IN EID E32C6F78164A9348
eui48.net-dns.org. 30 IN EUI48 00-00-5e-00-53-2a eui48.net-dns.org. 30 IN EUI48 00-00-5e-00-53-2a
eui64.net-dns.org. 30 IN EUI64 00-00-5e-ef-10-00-00-2a eui64.net-dns.org. 30 IN EUI64 00-00-5e-ef-10-00-00-2a
gpos.net-dns.org. 30 IN GPOS "-32.6882" "116.8652" "10.0" gpos.net-dns.org. 30 IN GPOS "-32.6882" "116.8652" "10.0"
@ -1059,13 +1065,13 @@ mr.net-dns.org. 30 IN MR services.net-dns.org.
mx.net-dns.org. 30 IN MX 10 a.net-dns.org. mx.net-dns.org. 30 IN MX 10 a.net-dns.org.
naptr.net-dns.org. 30 IN NAPTR 100 100 "s" "http+I2R" "" _https._tcp.net-dns.org. naptr.net-dns.org. 30 IN NAPTR 100 100 "s" "http+I2R" "" _https._tcp.net-dns.org.
nid.net-dns.org. 30 IN NID 10 0014:4fff:ff20:ef64 nid.net-dns.org. 30 IN NID 10 0014:4fff:ff20:ef64
nimloc.net-dns.org. 30 IN NIMLOC \# 0 nimloc.net-dns.org. 30 IN NIMLOC 32251B030067
nsap.net-dns.org. 30 IN NSAP 0x47000580005A0000000001E133FFFFFF00016100 nsap.net-dns.org. 30 IN NSAP 0x47000580005A0000000001E133FFFFFF00016100
444433332222111199990123000000ff.net-dns.org. 30 IN NSAP-PTR \# 0 444433332222111199990123000000ff.net-dns.org. 30 IN NSAP-PTR "host"
nsec.net-dns.org. 30 IN NSEC host.net-dns.org. A MX NSEC nsec.net-dns.org. 30 IN NSEC host.net-dns.org. A MX NSEC
nsec3.net-dns.org. 30 IN NSEC3 1 0 5 FD5EEADE2BA67B64 92qfhk1g2m21l1j89pju33nrm9586bpu A NS SOA MX RRSIG DNSKEY NSEC3PARAM nsec3.net-dns.org. 30 IN NSEC3 1 0 5 FD5EEADE2BA67B64 92qfhk1g2m21l1j89pju33nrm9586bpu A NS SOA MX RRSIG DNSKEY NSEC3PARAM
nsec3param.net-dns.org. 30 IN NSEC3PARAM 1 0 5 FD5EEADE2BA67B64 nsec3param.net-dns.org. 30 IN NSEC3PARAM 1 0 5 FD5EEADE2BA67B64
3fa2675708e4613939a03a3a8f3517118fe470e519d634a763d89037._openpgpkey.net-dns.org. 30 IN OPENPGPKEY \# 0 3fa2675708e4613939a03a3a8f3517118fe470e519d634a763d89037._openpgpkey.net-dns.org. 30 IN OPENPGPKEY mQENBFTTiU4BCADdIc4NQ6vZqyDJtKVqXabvj66t3V+OTvoDrceeTjmwtUoFIU2p5xQPmeHQcT+YPLOJC7rKI/raNBe/sQ9+WKanWko9xVzki3l2YqHCuioUAdgbtZMrSnkSTnCyST/rAuxxQYMHo5Ck/0g4b9Z0jZnRIACd8oxX89CRH5zu1KP6X7Df7aGpnNlFBUWTdODTkrUapLXLdn3dHJmsMxwBL1xLJvhWRmIvk27L18ix50IDLw/JHiraCCClyDXfDXkahWAR2GTFxp9iZ0FS1G+f+EFsGhP72LAuiLsBgauDuekPf01xnbn3PgMi8NSNsrJJMFQKfCLx0iPy5KCKvWL2KW7nABEBAAG0H0hvZGEgUm9oYW5pIDxob2RhQG5sbmV0bGFicy5ubD6JATgEEwECACIFAlTTiU4CGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEBS2RC1wiYvnD88H/0kwmg5HcisUjwquaOSaybp8MQ46KNVZO+CI3csyhHlmOdYk3BDUDMWTzs0JvHAOIS5tyRBVaXdbxtth7sIbI1CwdHf2jwSs16rApJs4XC5kndF3Z6uk8QHyNanvTxLL+CSZX7I/GAx4dLgN/3v7kx/bKNtXRKy525KHbbl3AqPVRcynqJ/yLuiA47jEUfR5ZI3awrtdlVtmq/9Zv4tw3mRM/GVvOCPBfzWHe57BI4D+PeIgRmTpLCSwtQwfbGvf/wufaVXX+fCqUuGGpNda8F1BQPdoTMIS+rQVjOSFKNWOIRauNsDWQHYQTSafRuCk0p1FSzmsWjXQJCpXIzmwZP+5AQ0EVNOJTgEIALxEVGUggMZFzr732mGrUjmDK25eVwZ5KDaFnn3RvtvbW1Dg7VaeI+V0foLQGqzge1p/kvLQHMY1MJMZYWSK3MqL4hnavSklDnOQTUAeMZ6k2+1njE1kcYM2DeZGqPufRB6jeaa2SYvGLL4EUbaCzW5r0pv3rgewUzmMvzOf+SgsHQFfRPQZOtGGIVrLTn9G9uFIE80RSV316oYTvXgUVbTSGObpfxWY5i9UwMQgsNgzN1TpAj2ktjROY0c85DxoY/HBTEsAh+jHyNKH+z1Dng2luWY1P/w7wAZNEqPrqk3AUkGt9jDbACbcr3Cyu/6GKsxpJbjPIzal33sunwEZ4+EAEQEAAYkBHwQYAQIACQUCVNOJTgIbDAAKCRAUtkQtcImL5/6ZCACj2HPhLyCJNB7ozf39SuuAdI1PgUfNSx3adOZeMQ03itGnY+YKDiSOcWlUwYvbX4PMiXjHiL+bOlMNAN6Lxfsfqj6Lef7r6s5I+m0VW+/wcb0J1+V0ObGDux69kxPwsozu1Khbpamsj1S8AiGtdUA1Qc0/qXzkEjW7MQ5YwYr0vL4nAlOoxD4l/U8PrLIo1ftwShf1cTXu2TlFAzaUzyfSLqkqQLQtMZ/3yx5w4uvRXElbOVbRi9bebAzLrUx12JUTDNzWv3qDH0hJnQxSrpu9gy21VRwlyfWz4Nz3GhsmRn1pbmzaUclEL6Rk/zv4gy6Z/X0CK1eepZ/JAEwkRCvq
128.1.0.10.in-addr.arpa. 30 IN PTR a.net-dns.org. 128.1.0.10.in-addr.arpa. 30 IN PTR a.net-dns.org.
px.net-dns.org. 30 IN PX 2 map822. mapx400. px.net-dns.org. 30 IN PX 2 map822. mapx400.
rp.net-dns.org. 30 IN RP a.getdnsapi.net-dns.org. getdnsapi.net-dns.org. rp.net-dns.org. 30 IN RP a.getdnsapi.net-dns.org. getdnsapi.net-dns.org.
@ -1075,7 +1081,7 @@ sig.net-dns.org. 30 IN SIG A 3 3 1285 20170327122207 20170226122207 22004 net-dn
spf.net-dns.org. 30 IN SPF "v=spf1 +mx a:colo.nlnetlabs.nl/28 -all" spf.net-dns.org. 30 IN SPF "v=spf1 +mx a:colo.nlnetlabs.nl/28 -all"
srv.net-dns.org. 30 IN SRV 0 5 80 www.net-dns.org. srv.net-dns.org. 30 IN SRV 0 5 80 www.net-dns.org.
sshfp.net-dns.org. 30 IN SSHFP 1 1 450C7D19D5DA9A3A5B7C19992D1FBDE15D8DAD44 sshfp.net-dns.org. 30 IN SSHFP 1 1 450C7D19D5DA9A3A5B7C19992D1FBDE15D8DAD44
talink.net-dns.org. 30 IN TALINK \# 0 talink.net-dns.org. 30 IN TALINK h0.net-dns.org. h2.net-dns.org.
_443._tcp.net-dns.org. 30 IN TLSA 3 1 1 274C6F96C9885C8050E8A05AD1C3162C1D51752C35B6196474E3F05AD31CD923 _443._tcp.net-dns.org. 30 IN TLSA 3 1 1 274C6F96C9885C8050E8A05AD1C3162C1D51752C35B6196474E3F05AD31CD923
_443._tcp.www.net-dns.org. 30 IN TLSA 3 1 1 274C6F96C9885C8050E8A05AD1C3162C1D51752C35B6196474E3F05AD31CD923 _443._tcp.www.net-dns.org. 30 IN TLSA 3 1 1 274C6F96C9885C8050E8A05AD1C3162C1D51752C35B6196474E3F05AD31CD923
dynup.net-dns.org. 30 IN TXT "fooFoo2" "Bla ; Foo" dynup.net-dns.org. 30 IN TXT "fooFoo2" "Bla ; Foo"
@ -1087,5 +1093,5 @@ x25.net-dns.org. 30 IN X25 "1234567"
;; AUTHORITY SECTION: ;; AUTHORITY SECTION:
;; ADDITIONAL SECTION: ;; ADDITIONAL SECTION:
;; MSG SIZE rcvd: 5328 ;; MSG SIZE rcvd: 6561

View File

@ -92,7 +92,7 @@ static int get_rrtype(const char *t)
if (strlen(t) > sizeof(buf) - 15) if (strlen(t) > sizeof(buf) - 15)
return -1; return -1;
for (i = 14; *t && i < sizeof(buf) - 1; i++, t++) for (i = 14; *t && i < sizeof(buf) - 1; i++, t++)
buf[i] = toupper(*t); buf[i] = *t == '-' ? '_' : toupper(*t);
buf[i] = '\0'; buf[i] = '\0';
if (!getdns_str2int(buf, &rrtype)) if (!getdns_str2int(buf, &rrtype))