Merge BIND 9.4.2 into main chunk.

This commit is contained in:
Hajimu UMEMOTO 2007-12-03 15:13:44 +00:00
parent 2092ecacb2
commit d069c2b7f5
2 changed files with 25 additions and 18 deletions

View File

@ -16,7 +16,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$Id: res_data.c,v 1.3.18.1 2005/04/27 05:01:10 sra Exp $"; static const char rcsid[] = "$Id: res_data.c,v 1.3.18.2 2007/09/14 05:35:47 marka Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD$");

View File

@ -66,7 +66,7 @@
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
static const char rcsid[] = "$Id: res_init.c,v 1.16.18.5 2006/08/30 23:23:13 marka Exp $"; static const char rcsid[] = "$Id: res_init.c,v 1.16.18.7 2007/07/09 01:52:58 marka Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD$");
@ -168,7 +168,9 @@ __res_vinit(res_state statp, int preinit) {
#endif #endif
int dots; int dots;
union res_sockaddr_union u[2]; union res_sockaddr_union u[2];
int maxns = MAXNS;
RES_SET_H_ERRNO(statp, 0);
if (statp->_u._ext.ext != NULL) if (statp->_u._ext.ext != NULL)
res_ndestroy(statp); res_ndestroy(statp);
@ -218,8 +220,22 @@ __res_vinit(res_state statp, int preinit) {
statp->_u._ext.ext->nsaddrs[0].sin = statp->nsaddr; statp->_u._ext.ext->nsaddrs[0].sin = statp->nsaddr;
strcpy(statp->_u._ext.ext->nsuffix, "ip6.arpa"); strcpy(statp->_u._ext.ext->nsuffix, "ip6.arpa");
strcpy(statp->_u._ext.ext->nsuffix2, "ip6.int"); strcpy(statp->_u._ext.ext->nsuffix2, "ip6.int");
} else } else {
return (-1); /*
* Historically res_init() rarely, if at all, failed.
* Examples and applications exist which do not check
* our return code. Furthermore several applications
* simply call us to get the systems domainname. So
* rather then immediately fail here we store the
* failure, which is returned later, in h_errno. And
* prevent the collection of 'nameserver' information
* by setting maxns to 0. Thus applications that fail
* to check our return code wont be able to make
* queries anyhow.
*/
RES_SET_H_ERRNO(statp, NETDB_INTERNAL);
maxns = 0;
}
#ifdef RESOLVSORT #ifdef RESOLVSORT
statp->nsort = 0; statp->nsort = 0;
#endif #endif
@ -240,9 +256,9 @@ __res_vinit(res_state statp, int preinit) {
buf[0] = '.'; buf[0] = '.';
cp = strchr(buf, '.'); cp = strchr(buf, '.');
cp = (cp == NULL) ? buf : (cp + 1); cp = (cp == NULL) ? buf : (cp + 1);
if (strlen(cp) >= sizeof(statp->defdname)) strncpy(statp->defdname, cp,
goto freedata; sizeof(statp->defdname) - 1);
strcpy(statp->defdname, cp); statp->defdname[sizeof(statp->defdname) - 1] = '\0';
} }
} }
#endif /* SOLARIS2 */ #endif /* SOLARIS2 */
@ -348,7 +364,7 @@ __res_vinit(res_state statp, int preinit) {
continue; continue;
} }
/* read nameservers to query */ /* read nameservers to query */
if (MATCH(buf, "nameserver") && nserv < MAXNS) { if (MATCH(buf, "nameserver") && nserv < maxns) {
struct addrinfo hints, *ai; struct addrinfo hints, *ai;
char sbuf[NI_MAXSERV]; char sbuf[NI_MAXSERV];
const size_t minsiz = const size_t minsiz =
@ -541,16 +557,7 @@ __res_vinit(res_state statp, int preinit) {
else if ((cp = getenv("RES_OPTIONS")) != NULL) else if ((cp = getenv("RES_OPTIONS")) != NULL)
res_setoptions(statp, cp, "env"); res_setoptions(statp, cp, "env");
statp->options |= RES_INIT; statp->options |= RES_INIT;
return (0); return (statp->res_h_errno);
#ifdef SOLARIS2
freedata:
if (statp->_u._ext.ext != NULL) {
free(statp->_u._ext.ext);
statp->_u._ext.ext = NULL;
}
return (-1);
#endif
} }
static void static void