about summary refs log tree commit diff
path: root/resolv
diff options
context:
space:
mode:
Diffstat (limited to 'resolv')
-rw-r--r--resolv/Banner2
-rw-r--r--resolv/arpa/nameser.h7
-rw-r--r--resolv/gethnamaddr.c11
-rw-r--r--resolv/res_comp.c8
-rw-r--r--resolv/res_debug.c30
-rw-r--r--resolv/res_init.c2
-rw-r--r--resolv/res_send.c52
-rw-r--r--resolv/resolv.h6
8 files changed, 75 insertions, 43 deletions
diff --git a/resolv/Banner b/resolv/Banner
index e08f0b4cd3..5d0dc48e95 100644
--- a/resolv/Banner
+++ b/resolv/Banner
@@ -1 +1 @@
-BIND-4.9.5-T4B
+BIND-4.9.5-T6B
diff --git a/resolv/arpa/nameser.h b/resolv/arpa/nameser.h
index 2352af684c..66b3530d91 100644
--- a/resolv/arpa/nameser.h
+++ b/resolv/arpa/nameser.h
@@ -92,10 +92,8 @@
 #include <sys/cdefs.h>
 
 #ifdef _AUX_SOURCE
-#include <sys/types.h>			/* ech for A/UX */
-#define res_send ucb_res_send		/* already def'd in libc */
-#define _res_close _ucb_res_close    /* removing res_send.o from the library */
-#endif				     /* gives an undefined symbol... */
+# include <sys/types.h>
+#endif
 
 /*
  * revision information.  this is the release date in YYYYMMDD format.
@@ -182,6 +180,7 @@
 #define T_NIMLOC	32		/* Nimrod locator */
 #define T_SRV		33		/* Server selection */
 #define T_ATMA		34		/* ATM Address */
+#define T_NAPTR		35		/* Naming Authority PoinTeR */
 	/* non standard */
 #define T_UINFO		100		/* user (finger) information */
 #define T_UID		101		/* user ID */
diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c
index 1cae1f7295..7c3096c967 100644
--- a/resolv/gethnamaddr.c
+++ b/resolv/gethnamaddr.c
@@ -341,12 +341,11 @@ getanswer(answer, anslen, qname, qtype)
 				cp += n;
 				continue;	/* XXX - had_error++ ? */
 			}
-			if (haveanswer) {
-				if (n != host.h_length) {
-					cp += n;
-					continue;
-				}
-			} else {
+			if (n != host.h_length) {
+				cp += n;
+				continue;
+			}
+			if (!haveanswer) {
 				register int nn;
 
 				host.h_name = bp;
diff --git a/resolv/res_comp.c b/resolv/res_comp.c
index 76f7cea5c5..d96fe6e432 100644
--- a/resolv/res_comp.c
+++ b/resolv/res_comp.c
@@ -394,8 +394,12 @@ int
 res_ownok(dn)
 	const char *dn;
 {
-	if (asterchar(dn[0]) && periodchar(dn[1]))
-		dn += 2;
+	if (asterchar(dn[0])) {
+		if (periodchar(dn[1]))
+			return (res_hnok(dn+2));
+		if (dn[1] == '\0')
+			return (1);
+	}
 	return (res_hnok(dn));
 }
 
diff --git a/resolv/res_debug.c b/resolv/res_debug.c
index cc6f84fea1..49eef72cd2 100644
--- a/resolv/res_debug.c
+++ b/resolv/res_debug.c
@@ -671,7 +671,7 @@ __p_rr(cp, msg, file)
 		fprintf(file, "\t%s", inet_ntop(AF_INET6, cp, t, sizeof t));
 		cp += dlen;
 		break;
-	}
+	    }
 
 	case T_LOC: {
 		char t[255];
@@ -679,7 +679,30 @@ __p_rr(cp, msg, file)
 		(void) fprintf(file, "\t%s", loc_ntoa(cp, t));
 		cp += dlen;
 		break;
-	}
+	    }
+
+	case T_NAPTR: {
+		u_int order, preference;
+
+		order = _getshort(cp);  cp += INT16SZ;
+		preference   = _getshort(cp);  cp += INT16SZ;
+		fprintf(file, "\t%u %u ",order, preference);
+		/* Flags */
+		n = *cp++;
+		fprintf(file,"\"%.*s\" ", (int)n, cp);
+		cp += n;
+		/* Service */
+		n = *cp++;
+		fprintf(file,"\"%.*s\" ", (int)n, cp);
+		cp += n;
+		/* Regexp */
+		n = *cp++;
+		fprintf(file,"\"%.*s\" ", (int)n, cp);
+		cp += n;
+		if ((cp = p_fqname(cp, msg, file)) == NULL)
+			return (NULL);
+		break;
+	    }
 
 	case T_SRV: {
 		u_int priority, weight, port;
@@ -691,7 +714,7 @@ __p_rr(cp, msg, file)
 		if ((cp = p_fqname(cp, msg, file)) == NULL)
 			return (NULL);
 		break;
-	}
+	    }
 
 	case T_MINFO:
 	case T_RP:
@@ -908,6 +931,7 @@ const struct res_sym __p_type_syms[] = {
 	{T_UINFO,	"UINFO",	"user information (nonstandard)"},
 	{T_UID,		"UID",		"user ID (nonstandard)"},
 	{T_GID,		"GID",		"group ID (nonstandard)"},
+	{T_NAPTR,	"NAPTR",	"URN Naming Authority"},
 #ifdef ALLOW_T_UNSPEC
 	{T_UNSPEC,	"UNSPEC",	"unspecified data (nonstandard)"},
 #endif /* ALLOW_T_UNSPEC */
diff --git a/resolv/res_init.c b/resolv/res_init.c
index c8a74f6e05..459948660d 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -645,7 +645,7 @@ netinfo_res_init(haveenv, havesearch)
 }
 #endif	/* NeXT */
 
-u_int16_t
+u_int
 res_randomid()
 {
 	struct timeval now;
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 3efc6cf96f..a5b4fba44b 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -94,8 +94,6 @@ static char rcsid[] = "$Id$";
 # include <../conf/options.h>
 #endif
 
-void _res_close __P((void));
-
 static int s = -1;	/* socket used for communications */
 static int connected = 0;	/* is the socket connected */
 static int vc = 0;	/* is the socket a virtual ciruit? */
@@ -320,7 +318,7 @@ res_send(buf, buflen, ans, anssiz)
 		struct sockaddr_in *nsap = &_res.nsaddr_list[ns];
     same_ns:
 		if (badns & (1 << ns)) {
-			_res_close();
+			res_close();
 			goto next_ns;
 		}
 
@@ -337,7 +335,7 @@ res_send(buf, buflen, ans, anssiz)
 					done = 1;
 					break;
 				case res_nextns:
-					_res_close();
+					res_close();
 					goto next_ns;
 				case res_done:
 					return (resplen);
@@ -372,7 +370,7 @@ res_send(buf, buflen, ans, anssiz)
 			truncated = 0;
 			if ((s < 0) || (!vc)) {
 				if (s >= 0)
-					_res_close();
+					res_close();
 
 				s = socket(PF_INET, SOCK_STREAM, 0);
 				if (s < 0) {
@@ -387,7 +385,7 @@ res_send(buf, buflen, ans, anssiz)
 					Aerror(stderr, "connect/vc",
 					       errno, *nsap);
 					badns |= (1 << ns);
-					_res_close();
+					res_close();
 					goto next_ns;
 				}
 				vc = 1;
@@ -404,7 +402,7 @@ res_send(buf, buflen, ans, anssiz)
 				terrno = errno;
 				Perror(stderr, "write failed", errno);
 				badns |= (1 << ns);
-				_res_close();
+				res_close();
 				goto next_ns;
 			}
 			/*
@@ -421,7 +419,7 @@ read_len:
 			if (n <= 0) {
 				terrno = errno;
 				Perror(stderr, "read failed", errno);
-				_res_close();
+				res_close();
 				/*
 				 * A long running process might get its TCP
 				 * connection reset if the remote server was
@@ -433,10 +431,10 @@ read_len:
 				 */
 				if (terrno == ECONNRESET && !connreset) {
 					connreset = 1;
-					_res_close();
+					res_close();
 					goto same_ns;
 				}
-				_res_close();
+				res_close();
 				goto next_ns;
 			}
 			resplen = _getshort(ans);
@@ -457,7 +455,7 @@ read_len:
 			if (n <= 0) {
 				terrno = errno;
 				Perror(stderr, "read(vc)", errno);
-				_res_close();
+				res_close();
 				goto next_ns;
 			}
 			if (truncated) {
@@ -504,7 +502,7 @@ read_len:
 
 			if ((s < 0) || vc) {
 				if (vc)
-					_res_close();
+					res_close();
 				s = socket(PF_INET, SOCK_DGRAM, 0);
 				if (s < 0) {
 #if !CAN_RECONNECT
@@ -544,7 +542,7 @@ read_len:
 						       "connect(dg)",
 						       errno, *nsap);
 						badns |= (1 << ns);
-						_res_close();
+						res_close();
 						goto next_ns;
 					}
 					connected = 1;
@@ -552,7 +550,7 @@ read_len:
 				if (send(s, (char*)buf, buflen, 0) != buflen) {
 					Perror(stderr, "send", errno);
 					badns |= (1 << ns);
-					_res_close();
+					res_close();
 					goto next_ns;
 				}
 			} else {
@@ -589,7 +587,7 @@ read_len:
 				    != buflen) {
 					Aerror(stderr, "sendto", errno, *nsap);
 					badns |= (1 << ns);
-					_res_close();
+					res_close();
 					goto next_ns;
 				}
 			}
@@ -612,7 +610,7 @@ read_len:
 				if (errno == EINTR)
 					goto wait;
 				Perror(stderr, "select", errno);
-				_res_close();
+				res_close();
 				goto next_ns;
 			}
 			if (n == 0) {
@@ -622,7 +620,7 @@ read_len:
 				Dprint(_res.options & RES_DEBUG,
 				       (stdout, ";; timeout\n"));
 				gotsomewhere = 1;
-				_res_close();
+				res_close();
 				goto next_ns;
 			}
 			__set_errno (0);
@@ -631,7 +629,7 @@ read_len:
 					   (struct sockaddr *)&from, &fromlen);
 			if (resplen <= 0) {
 				Perror(stderr, "recvfrom", errno);
-				_res_close();
+				res_close();
 				goto next_ns;
 			}
 			gotsomewhere = 1;
@@ -683,7 +681,7 @@ read_len:
 					(stdout, "server rejected query:\n"),
 					ans, (resplen>anssiz)?anssiz:resplen);
 				badns |= (1 << ns);
-				_res_close();
+				res_close();
 				/* don't retry if called from dig */
 				if (!_res.pfcode)
 					goto next_ns;
@@ -696,7 +694,7 @@ read_len:
 				Dprint(_res.options & RES_DEBUG,
 				       (stdout, ";; truncated answer\n"));
 				v_circuit = 1;
-				_res_close();
+				res_close();
 				goto same_ns;
 			}
 		} /*if vc/dg*/
@@ -718,7 +716,7 @@ read_len:
 		 */
 		if ((v_circuit && (!(_res.options & RES_USEVC) || ns != 0)) ||
 		    !(_res.options & RES_STAYOPEN)) {
-			_res_close();
+			res_close();
 		}
 		if (Rhook) {
 			int done = 0, loops = 0;
@@ -734,7 +732,7 @@ read_len:
 					done = 1;
 					break;
 				case res_nextns:
-					_res_close();
+					res_close();
 					goto next_ns;
 				case res_modified:
 					/* give the hook another try */
@@ -753,7 +751,7 @@ read_len:
     next_ns: ;
 	   } /*foreach ns*/
 	} /*foreach retry*/
-	_res_close();
+	res_close();
 	if (!v_circuit)
 		if (!gotsomewhere)
 			__set_errno (ECONNREFUSED); /* no nameservers found */
@@ -772,7 +770,7 @@ read_len:
  * This routine is not expected to be user visible.
  */
 void
-_res_close()
+res_close()
 {
 	if (s >= 0) {
 		(void) close(s);
@@ -787,6 +785,12 @@ _res_close()
  * there is more gunk of this kind over in res_debug.c.
  */
 
+void
+_res_close()
+{
+	res_close();
+}
+
 #undef res_send
 int
 res_send(buf, buflen, ans, anssiz)
diff --git a/resolv/resolv.h b/resolv/resolv.h
index e5ec75a4db..fe90ab5a75 100644
--- a/resolv/resolv.h
+++ b/resolv/resolv.h
@@ -110,7 +110,7 @@ struct __res_state {
 	struct sockaddr_in
 		nsaddr_list[MAXNS];	/* address of name server */
 #define	nsaddr	nsaddr_list[0]		/* for backward compatibility */
-	u_short	id;			/* current packet id */
+	u_short	id;			/* current message id */
 	char	*dnsrch[MAXDNSRCH+1];	/* components of domain to search */
 	char	defdname[256];		/* default domain (deprecated) */
 	u_long	pfcode;			/* RES_PRF_ flags - see below. */
@@ -235,6 +235,7 @@ extern const struct res_sym __p_type_syms[];
 #define	res_isourserver	__res_isourserver
 #define	res_nameinquery	__res_nameinquery
 #define	res_queriesmatch __res_queriesmatch
+#define	res_close	__res_close
 __BEGIN_DECLS
 int		res_hnok __P((const char *));
 int		res_ownok __P((const char *));
@@ -272,7 +273,7 @@ int		dn_comp __P((const char *, u_char *, int,
 int		dn_expand __P((const u_char *, const u_char *, const u_char *,
 			       char *, int));
 int		res_init __P((void));
-u_int16_t	res_randomid __P((void));
+u_int		res_randomid __P((void));
 int		res_query __P((const char *, int, int, u_char *, int));
 int		res_search __P((const char *, int, int, u_char *, int));
 int		res_querydomain __P((const char *, const char *, int, int,
@@ -285,6 +286,7 @@ int		res_nameinquery __P((const char *, int, int,
 				     const u_char *, const u_char *));
 int		res_queriesmatch __P((const u_char *, const u_char *,
 				      const u_char *, const u_char *));
+void		res_close __P((void));
 __END_DECLS
 
 #endif /* !_RESOLV_H_ */