summaryrefslogtreecommitdiffstats
path: root/contrib/bind/lib/resolv/res_debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bind/lib/resolv/res_debug.c')
-rw-r--r--contrib/bind/lib/resolv/res_debug.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/contrib/bind/lib/resolv/res_debug.c b/contrib/bind/lib/resolv/res_debug.c
index f2c0689..392796a 100644
--- a/contrib/bind/lib/resolv/res_debug.c
+++ b/contrib/bind/lib/resolv/res_debug.c
@@ -95,7 +95,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_debug.c,v 8.46 2002/05/21 01:57:45 marka Exp $";
+static const char rcsid[] = "$Id: res_debug.c,v 8.49.6.1 2003/06/04 01:09:43 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@@ -615,9 +615,6 @@ p_option(u_long option) {
#ifdef RES_USE_EDNS0 /* KAME extension */
case RES_USE_EDNS0: return "edns0";
#endif
-#ifdef RES_USE_A6
- case RES_USE_A6: return "a6";
-#endif
#ifdef RES_USE_DNAME
case RES_USE_DNAME: return "dname";
#endif
@@ -655,6 +652,33 @@ p_rcode(int rcode) {
}
/*
+ * Return a string for a res_sockaddr_union.
+ */
+const char *
+p_sockun(union res_sockaddr_union u, char *buf, size_t size) {
+ char ret[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:123.123.123.123"];
+
+ switch (u.sin.sin_family) {
+ case AF_INET:
+ inet_ntop(AF_INET, &u.sin.sin_addr, ret, sizeof ret);
+ break;
+#ifdef HAS_INET6_STRUCTS
+ case AF_INET6:
+ inet_ntop(AF_INET6, &u.sin6.sin6_addr, ret, sizeof ret);
+ break;
+#endif
+ default:
+ sprintf(ret, "[af%d]", u.sin.sin_family);
+ break;
+ }
+ if (size > 0) {
+ strncpy(buf, ret, size - 1);
+ buf[size - 1] = '0';
+ }
+ return (buf);
+}
+
+/*
* routines to convert between on-the-wire RR format and zone file format.
* Does not contain conversion to/from decimal degrees; divide or multiply
* by 60*60*1000 for that.
@@ -1101,8 +1125,9 @@ res_nametoclass(const char *buf, int *successp) {
if (strncasecmp(buf, "CLASS", 5) != 0 ||
!isdigit((unsigned char)buf[5]))
goto done;
+ errno = 0;
result = strtoul(buf + 5, &endptr, 10);
- if (*endptr == '\0' && result <= 0xffff)
+ if (errno == 0 && *endptr == '\0' && result <= 0xffff)
success = 1;
done:
if (successp)
@@ -1123,8 +1148,9 @@ res_nametotype(const char *buf, int *successp) {
if (strncasecmp(buf, "type", 4) != 0 ||
!isdigit((unsigned char)buf[4]))
goto done;
+ errno = 0;
result = strtoul(buf + 4, &endptr, 10);
- if (*endptr == '\0' && result <= 0xffff)
+ if (errno == 0 && *endptr == '\0' && result <= 0xffff)
success = 1;
done:
if (successp)
OpenPOWER on IntegriCloud