diff options
Diffstat (limited to 'src/tools/adig.c')
-rw-r--r-- | src/tools/adig.c | 55 |
1 files changed, 19 insertions, 36 deletions
diff --git a/src/tools/adig.c b/src/tools/adig.c index 9c3747a..412ad46 100644 --- a/src/tools/adig.c +++ b/src/tools/adig.c @@ -25,14 +25,8 @@ #ifdef HAVE_NETDB_H # include <netdb.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #ifdef HAVE_STRINGS_H # include <strings.h> @@ -62,30 +56,6 @@ #undef WIN32 /* Redefined in MingW headers */ #endif -#ifndef T_SRV -# define T_SRV 33 /* Server selection */ -#endif -#ifndef T_NAPTR -# define T_NAPTR 35 /* Naming authority pointer */ -#endif -#ifndef T_DS -# define T_DS 43 /* Delegation Signer (RFC4034) */ -#endif -#ifndef T_SSHFP -# define T_SSHFP 44 /* SSH Key Fingerprint (RFC4255) */ -#endif -#ifndef T_RRSIG -# define T_RRSIG 46 /* Resource Record Signature (RFC4034) */ -#endif -#ifndef T_NSEC -# define T_NSEC 47 /* Next Secure (RFC4034) */ -#endif -#ifndef T_DNSKEY -# define T_DNSKEY 48 /* DNS Public Key (RFC4034) */ -#endif -#ifndef T_CAA -# define T_CAA 257 /* Certification Authority Authorization */ -#endif struct nv { const char *name; @@ -151,6 +121,7 @@ static const struct nv types[] = { { "NSEC", T_NSEC }, { "DNSKEY", T_DNSKEY }, { "CAA", T_CAA }, + { "URI", T_URI }, { "ANY", T_ANY } }; static const int ntypes = sizeof(types) / sizeof(types[0]); @@ -335,7 +306,7 @@ int main(int argc, char **argv) options.udp_port = (unsigned short)strtol(optarg, NULL, 0); optmask |= ARES_OPT_UDP_PORT; break; - + case 'x': use_ptr_helper++; break; @@ -546,7 +517,7 @@ static const unsigned char *display_rr(const unsigned char *aptr, const unsigned char *abuf, int alen) { const unsigned char *p; - int type, dnsclass, ttl, dlen, status; + int type, dnsclass, ttl, dlen, status, i; long len; int vlen; char addr[46]; @@ -703,7 +674,7 @@ static const unsigned char *display_rr(const unsigned char *aptr, p += len; } break; - + case T_CAA: p = aptr; @@ -767,6 +738,18 @@ static const unsigned char *display_rr(const unsigned char *aptr, ares_free_string(name.as_char); break; + case T_URI: + /* The RR data is two two-byte numbers representing the + * priority and weight, followed by a target. + */ + + printf("\t%d ", (int)DNS__16BIT(aptr)); + printf("%d \t\t", (int)DNS__16BIT(aptr+2)); + p = aptr +4; + for (i=0; i <dlen-4; ++i) + printf("%c",p[i]); + break; + case T_NAPTR: printf("\t%d", (int)DNS__16BIT(aptr)); /* order */ @@ -992,7 +975,7 @@ static void print_help_info_adig(void) { " KEY, LOC, MAILA, MAILB, MB, MD,\n" " MF, MG, MINFO, MR, MX, NAPTR, NS,\n" " NSAP, NSAP_PTR, NULL, PTR, PX, RP,\n" - " RT, SIG, SOA, SRV, TXT, WKS, X25\n\n" + " RT, SIG, SOA, SRV, TXT, URI, WKS, X25\n\n" " -x : For a '-t PTR a.b.c.d' lookup, query for 'd.c.b.a.in-addr.arpa.'\n" " -xx : As above, but for IPv6, compact the format into a bitstring like\n" " '[xabcdef00000000000000000000000000].IP6.ARPA.'\n"); |