summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorInternet Software Consortium, Inc <@isc.org>2007-09-07 14:14:19 -0600
committerLaMont Jones <lamont@debian.org>2007-09-07 14:14:19 -0600
commite7ee4f9689939f41f745d8ccaae351444c6aed73 (patch)
tree21f8e9f8042f12559ba0c9b6f517bfb657469862 /lib
parent038cb638ae3a14da41169b1d0f5cb1c992984084 (diff)
downloadbind9-e7ee4f9689939f41f745d8ccaae351444c6aed73.tar.gz
9.2.1rc2
Diffstat (limited to 'lib')
-rw-r--r--lib/bind/irs/dns_ho.c242
-rw-r--r--lib/bind/irs/dns_nw.c65
-rw-r--r--lib/bind/irs/getnameinfo.c22
-rw-r--r--lib/bind/port_after.h.in21
-rw-r--r--lib/dns/api6
-rw-r--r--lib/dns/dispatch.c11
-rw-r--r--lib/dns/gen.c16
-rw-r--r--lib/dns/include/dns/result.h11
-rw-r--r--lib/dns/include/dns/tsig.h7
-rw-r--r--lib/dns/master.c5
-rw-r--r--lib/dns/name.c8
-rw-r--r--lib/dns/rdata.c32
-rw-r--r--lib/dns/resolver.c4
-rw-r--r--lib/dns/result.c12
-rw-r--r--lib/dns/tsig.c8
-rw-r--r--lib/dns/zone.c6
-rw-r--r--lib/isc/api6
-rw-r--r--lib/isc/include/isc/result.h8
-rw-r--r--lib/isc/inet_pton.c20
-rw-r--r--lib/isc/lex.c6
-rw-r--r--lib/isc/mem.c6
-rw-r--r--lib/isc/result.c8
-rw-r--r--lib/isc/task.c3
-rw-r--r--lib/isc/unix/errno2result.c4
-rw-r--r--lib/isc/unix/socket.c4
-rw-r--r--lib/isc/win32/file.c8
-rw-r--r--lib/isc/win32/include/isc/strerror.h4
-rw-r--r--lib/isccc/api2
-rw-r--r--lib/isccc/cc.c10
-rw-r--r--lib/isccfg/api2
-rw-r--r--lib/isccfg/check.c56
31 files changed, 409 insertions, 214 deletions
diff --git a/lib/bind/irs/dns_ho.c b/lib/bind/irs/dns_ho.c
index a563ff74..531b79f2 100644
--- a/lib/bind/irs/dns_ho.c
+++ b/lib/bind/irs/dns_ho.c
@@ -52,7 +52,7 @@
/* BIND Id: gethnamaddr.c,v 8.15 1996/05/22 04:56:30 vixie Exp $ */
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: dns_ho.c,v 1.5.2.1 2001/11/02 20:35:28 gson Exp $";
+static const char rcsid[] = "$Id: dns_ho.c,v 1.5.2.2 2002/03/20 19:44:39 marka Exp $";
#endif /* LIBC_SCCS and not lint */
/* Imports. */
@@ -256,47 +256,55 @@ ho_byname2(struct irs_ho *this, const char *name, int af)
char tmp[NS_MAXDNAME];
const char *cp;
struct addrinfo ai;
- struct dns_res_target q, q2, *p;
+ struct dns_res_target *q, *q2, *p;
int querystate = RESQRY_FAIL;
if (init(this) == -1)
return (NULL);
- memset(&q, 0, sizeof(q2));
- memset(&q2, 0, sizeof(q2));
+ q = memget(sizeof(*q));
+ q2 = memget(sizeof(*q2));
+ if (q == NULL || q2 == NULL) {
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ errno = ENOMEM;
+ goto cleanup;
+ }
+ memset(q, 0, sizeof(q));
+ memset(q2, 0, sizeof(q2));
switch (af) {
case AF_INET:
size = INADDRSZ;
- q.qclass = C_IN;
- q.qtype = T_A;
- q.answer = q.qbuf.buf;
- q.anslen = sizeof(q.qbuf);
- q.action = RESTGT_DOALWAYS;
+ q->qclass = C_IN;
+ q->qtype = T_A;
+ q->answer = q->qbuf.buf;
+ q->anslen = sizeof(q->qbuf);
+ q->action = RESTGT_DOALWAYS;
break;
case AF_INET6:
size = IN6ADDRSZ;
- q.qclass = C_IN;
- q.qtype = ns_t_a6;
- q.answer = q.qbuf.buf;
- q.anslen = sizeof(q.qbuf);
- q.next = &q2;
+ q->qclass = C_IN;
+ q->qtype = ns_t_a6;
+ q->answer = q->qbuf.buf;
+ q->anslen = sizeof(q->qbuf);
+ q->next = q2;
#ifdef RES_USE_A6
if ((pvt->res->options & RES_USE_A6) == 0)
- q.action = RESTGT_IGNORE;
+ q->action = RESTGT_IGNORE;
else
#endif
- q.action = RESTGT_DOALWAYS;
- q2.qclass = C_IN;
- q2.qtype = T_AAAA;
- q2.answer = q2.qbuf.buf;
- q2.anslen = sizeof(q2.qbuf);
- q2.action = RESTGT_AFTERFAILURE;
+ q->action = RESTGT_DOALWAYS;
+ q2->qclass = C_IN;
+ q2->qtype = T_AAAA;
+ q2->answer = q2->qbuf.buf;
+ q2->anslen = sizeof(q2->qbuf);
+ q2->action = RESTGT_AFTERFAILURE;
break;
default:
RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
errno = EAFNOSUPPORT;
- return (NULL);
+ hp = NULL;
+ goto cleanup;
}
/*
@@ -308,7 +316,7 @@ ho_byname2(struct irs_ho *this, const char *name, int af)
tmp, sizeof tmp)))
name = cp;
- for (p = &q; p; p = p->next) {
+ for (p = q; p; p = p->next) {
switch(p->action) {
case RESTGT_DOALWAYS:
break;
@@ -331,13 +339,18 @@ ho_byname2(struct irs_ho *this, const char *name, int af)
if ((hp = gethostans(this, p->answer, n, name, p->qtype,
af, size, NULL,
(const struct addrinfo *)&ai)) != NULL)
- return(hp); /* no more loop is necessary */
+ goto cleanup; /* no more loop is necessary */
querystate = RESQRY_FAIL;
continue;
}
- return(hp); /* should be NULL */
+ cleanup:
+ if (q != NULL)
+ memput(q, sizeof(*q));
+ if (q2 != NULL)
+ memput(q2, sizeof(*q2));
+ return(hp);
}
static struct hostent *
@@ -346,17 +359,24 @@ ho_byaddr(struct irs_ho *this, const void *addr, int len, int af)
struct pvt *pvt = (struct pvt *)this->private;
const u_char *uaddr = addr;
char *qp;
- struct hostent *hp;
+ struct hostent *hp = NULL;
struct addrinfo ai;
- struct dns_res_target q, q2, *p;
+ struct dns_res_target *q, *q2, *p;
int n, size;
int querystate = RESQRY_FAIL;
if (init(this) == -1)
return (NULL);
- memset(&q, 0, sizeof(q2));
- memset(&q2, 0, sizeof(q2));
+ q = memget(sizeof(*q));
+ q2 = memget(sizeof(*q2));
+ if (q == NULL || q2 == NULL) {
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ errno = ENOMEM;
+ goto cleanup;
+ }
+ memset(q, 0, sizeof(q));
+ memset(q2, 0, sizeof(q2));
if (af == AF_INET6 && len == IN6ADDRSZ &&
(!memcmp(uaddr, mapped, sizeof mapped) ||
@@ -371,45 +391,47 @@ ho_byaddr(struct irs_ho *this, const void *addr, int len, int af)
switch (af) {
case AF_INET:
size = INADDRSZ;
- q.qclass = C_IN;
- q.qtype = T_PTR;
- q.answer = q.qbuf.buf;
- q.anslen = sizeof(q.qbuf);
- q.action = RESTGT_DOALWAYS;
+ q->qclass = C_IN;
+ q->qtype = T_PTR;
+ q->answer = q->qbuf.buf;
+ q->anslen = sizeof(q->qbuf);
+ q->action = RESTGT_DOALWAYS;
break;
case AF_INET6:
size = IN6ADDRSZ;
- q.qclass = C_IN;
- q.qtype = T_PTR;
- q.answer = q.qbuf.buf;
- q.anslen = sizeof(q.qbuf);
- q.next = &q2;
+ q->qclass = C_IN;
+ q->qtype = T_PTR;
+ q->answer = q->qbuf.buf;
+ q->anslen = sizeof(q->qbuf);
+ q->next = q2;
if ((pvt->res->options & RES_NO_BITSTRING) != 0)
- q.action = RESTGT_IGNORE;
+ q->action = RESTGT_IGNORE;
else
- q.action = RESTGT_DOALWAYS;
- q2.qclass = C_IN;
- q2.qtype = T_PTR;
- q2.answer = q2.qbuf.buf;
- q2.anslen = sizeof(q2.qbuf);
+ q->action = RESTGT_DOALWAYS;
+ q2->qclass = C_IN;
+ q2->qtype = T_PTR;
+ q2->answer = q2->qbuf.buf;
+ q2->anslen = sizeof(q2->qbuf);
if ((pvt->res->options & RES_NO_NIBBLE) != 0)
- q2.action = RESTGT_IGNORE;
+ q2->action = RESTGT_IGNORE;
else
- q2.action = RESTGT_AFTERFAILURE;
+ q2->action = RESTGT_AFTERFAILURE;
break;
default:
errno = EAFNOSUPPORT;
RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
- return (NULL);
+ hp = NULL;
+ goto cleanup;
}
if (size > len) {
errno = EINVAL;
RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
- return (NULL);
+ hp = NULL;
+ goto cleanup;
}
switch (af) {
case AF_INET:
- qp = q.qname;
+ qp = q->qname;
(void) sprintf(qp, "%u.%u.%u.%u.in-addr.arpa",
(uaddr[3] & 0xff),
(uaddr[2] & 0xff),
@@ -417,16 +439,16 @@ ho_byaddr(struct irs_ho *this, const void *addr, int len, int af)
(uaddr[0] & 0xff));
break;
case AF_INET6:
- if (q.action != RESTGT_IGNORE) {
- qp = q.qname;
+ if (q->action != RESTGT_IGNORE) {
+ qp = q->qname;
qp += SPRINTF((qp, "\\[x"));
for (n = 0; n < IN6ADDRSZ; n++)
qp += SPRINTF((qp, "%02x", uaddr[n]));
SPRINTF((qp, "/128].%s",
res_get_bitstringsuffix(pvt->res)));
}
- if (q2.action != RESTGT_IGNORE) {
- qp = q2.qname;
+ if (q2->action != RESTGT_IGNORE) {
+ qp = q2->qname;
for (n = IN6ADDRSZ - 1; n >= 0; n--) {
qp += SPRINTF((qp, "%x.%x.",
uaddr[n] & 0xf,
@@ -439,7 +461,7 @@ ho_byaddr(struct irs_ho *this, const void *addr, int len, int af)
abort();
}
- for (p = &q; p; p = p->next) {
+ for (p = q; p; p = p->next) {
switch(p->action) {
case RESTGT_DOALWAYS:
break;
@@ -477,10 +499,16 @@ ho_byaddr(struct irs_ho *this, const void *addr, int len, int af)
}
RES_SET_H_ERRNO(pvt->res, NETDB_SUCCESS);
- return (hp); /* no more loop is necessary. */
+ goto cleanup; /* no more loop is necessary. */
}
-
- return(NULL); /* H_ERRNO was set by subroutines */
+ hp = NULL; /* H_ERRNO was set by subroutines */
+
+ cleanup:
+ if (q != NULL)
+ memput(q, sizeof(*q));
+ if (q2 != NULL)
+ memput(q2, sizeof(*q2));
+ return(hp);
}
static struct hostent *
@@ -536,74 +564,83 @@ ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai)
int n;
char tmp[NS_MAXDNAME];
const char *cp;
- struct dns_res_target q, q2, q3, *p;
+ struct dns_res_target *q, *q2, *q3, *p;
struct addrinfo sentinel, *cur;
int querystate = RESQRY_FAIL;
if (init(this) == -1)
return (NULL);
- memset(&q, 0, sizeof(q2));
- memset(&q2, 0, sizeof(q2));
- memset(&q3, 0, sizeof(q3));
memset(&sentinel, 0, sizeof(sentinel));
cur = &sentinel;
+ q = memget(sizeof(*q));
+ q2 = memget(sizeof(*q2));
+ q3 = memget(sizeof(*q3));
+ if (q == NULL || q2 == NULL || q3 == NULL) {
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ errno = ENOMEM;
+ goto cleanup;
+ }
+ memset(q, 0, sizeof(q2));
+ memset(q2, 0, sizeof(q2));
+ memset(q3, 0, sizeof(q3));
+
switch (pai->ai_family) {
case AF_UNSPEC:
/* prefer IPv6 */
- q.qclass = C_IN;
- q.qtype = ns_t_a6;
- q.answer = q.qbuf.buf;
- q.anslen = sizeof(q.qbuf);
- q.next = &q2;
+ q->qclass = C_IN;
+ q->qtype = ns_t_a6;
+ q->answer = q->qbuf.buf;
+ q->anslen = sizeof(q->qbuf);
+ q->next = q2;
#ifdef RES_USE_A6
if ((pvt->res->options & RES_USE_A6) == 0)
- q.action = RESTGT_IGNORE;
+ q->action = RESTGT_IGNORE;
else
#endif
- q.action = RESTGT_DOALWAYS;
- q2.qclass = C_IN;
- q2.qtype = T_AAAA;
- q2.answer = q2.qbuf.buf;
- q2.anslen = sizeof(q2.qbuf);
- q2.next = &q3;
+ q->action = RESTGT_DOALWAYS;
+ q2->qclass = C_IN;
+ q2->qtype = T_AAAA;
+ q2->answer = q2->qbuf.buf;
+ q2->anslen = sizeof(q2->qbuf);
+ q2->next = q3;
/* try AAAA only when A6 query fails */
- q2.action = RESTGT_AFTERFAILURE;
- q3.qclass = C_IN;
- q3.qtype = T_A;
- q3.answer = q3.qbuf.buf;
- q3.anslen = sizeof(q3.qbuf);
- q3.action = RESTGT_DOALWAYS;
+ q2->action = RESTGT_AFTERFAILURE;
+ q3->qclass = C_IN;
+ q3->qtype = T_A;
+ q3->answer = q3->qbuf.buf;
+ q3->anslen = sizeof(q3->qbuf);
+ q3->action = RESTGT_DOALWAYS;
break;
case AF_INET:
- q.qclass = C_IN;
- q.qtype = T_A;
- q.answer = q.qbuf.buf;
- q.anslen = sizeof(q.qbuf);
- q.action = RESTGT_DOALWAYS;
+ q->qclass = C_IN;
+ q->qtype = T_A;
+ q->answer = q->qbuf.buf;
+ q->anslen = sizeof(q->qbuf);
+ q->action = RESTGT_DOALWAYS;
break;
case AF_INET6:
- q.qclass = C_IN;
- q.qtype = ns_t_a6;
- q.answer = q.qbuf.buf;
- q.anslen = sizeof(q.qbuf);
- q.next = &q2;
+ q->qclass = C_IN;
+ q->qtype = ns_t_a6;
+ q->answer = q->qbuf.buf;
+ q->anslen = sizeof(q->qbuf);
+ q->next = q2;
#ifdef RES_USE_A6
if ((pvt->res->options & RES_USE_A6) == 0)
- q.action = RESTGT_IGNORE;
+ q->action = RESTGT_IGNORE;
else
#endif
- q.action = RESTGT_DOALWAYS;
- q2.qclass = C_IN;
- q2.qtype = T_AAAA;
- q2.answer = q2.qbuf.buf;
- q2.anslen = sizeof(q2.qbuf);
- q2.action = RESTGT_AFTERFAILURE;
+ q->action = RESTGT_DOALWAYS;
+ q2->qclass = C_IN;
+ q2->qtype = T_AAAA;
+ q2->answer = q2->qbuf.buf;
+ q2->anslen = sizeof(q2->qbuf);
+ q2->action = RESTGT_AFTERFAILURE;
break;
default:
RES_SET_H_ERRNO(pvt->res, NO_RECOVERY); /* better error? */
- return(NULL);
+ goto cleanup;
}
/*
@@ -615,7 +652,7 @@ ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai)
tmp, sizeof tmp)))
name = cp;
- for (p = &q; p; p = p->next) {
+ for (p = q; p; p = p->next) {
struct addrinfo *ai;
switch(p->action) {
@@ -647,6 +684,13 @@ ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai)
querystate = RESQRY_FAIL;
}
+ cleanup:
+ if (q != NULL)
+ memput(q, sizeof(*q));
+ if (q2 != NULL)
+ memput(q2, sizeof(*q2));
+ if (q3 != NULL)
+ memput(q3, sizeof(*q3));
return(sentinel.ai_next);
}
diff --git a/lib/bind/irs/dns_nw.c b/lib/bind/irs/dns_nw.c
index 43a404ed..bbde4edd 100644
--- a/lib/bind/irs/dns_nw.c
+++ b/lib/bind/irs/dns_nw.c
@@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: dns_nw.c,v 1.3.2.1 2002/01/22 04:15:44 marka Exp $";
+static const char rcsid[] = "$Id: dns_nw.c,v 1.3.2.2 2002/03/20 19:44:40 marka Exp $";
#endif /* LIBC_SCCS and not lint */
/* Imports. */
@@ -240,22 +240,33 @@ nw_res_set(struct irs_nw *this, struct __res_state *res,
static struct nwent *
get1101byname(struct irs_nw *this, const char *name) {
struct pvt *pvt = (struct pvt *)this->private;
- u_char ansbuf[MAXPACKET];
+ u_char *ansbuf;
int anslen;
+ struct nwent *result;
- anslen = res_nsearch(pvt->res, name, C_IN, T_PTR,
- ansbuf, sizeof ansbuf);
- if (anslen < 0)
+ ansbuf = memget(MAXPACKET);
+ if (ansbuf == NULL) {
+ errno = ENOMEM;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
return (NULL);
- return (get1101mask(this, get1101answer(this, ansbuf, anslen, by_name,
- AF_INET, name, NULL, 0)));
+ }
+ anslen = res_nsearch(pvt->res, name, C_IN, T_PTR, ansbuf, MAXPACKET);
+ if (anslen < 0) {
+ memput(ansbuf, MAXPACKET);
+ return (NULL);
+ }
+ result = get1101mask(this, get1101answer(this, ansbuf, anslen, by_name,
+ AF_INET, name, NULL, 0));
+ memput(ansbuf, MAXPACKET);
+ return (result);
}
static struct nwent *
get1101byaddr(struct irs_nw *this, u_char *net, int len) {
struct pvt *pvt = (struct pvt *)this->private;
char qbuf[sizeof "255.255.255.255.in-addr.arpa"];
- u_char ansbuf[MAXPACKET];
+ struct nwent *result;
+ u_char *ansbuf;
int anslen;
if (len < 1 || len > 32) {
@@ -265,12 +276,21 @@ get1101byaddr(struct irs_nw *this, u_char *net, int len) {
}
if (make1101inaddr(net, len, qbuf, sizeof qbuf) < 0)
return (NULL);
- anslen = res_nquery(pvt->res, qbuf, C_IN, T_PTR,
- ansbuf, sizeof ansbuf);
- if (anslen < 0)
+ ansbuf = memget(MAXPACKET);
+ if (ansbuf == NULL) {
+ errno = ENOMEM;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ return (NULL);
+ }
+ anslen = res_nquery(pvt->res, qbuf, C_IN, T_PTR, ansbuf, MAXPACKET);
+ if (anslen < 0) {
+ memput(ansbuf, MAXPACKET);
return (NULL);
- return (get1101mask(this, get1101answer(this, ansbuf, anslen, by_addr,
- AF_INET, NULL, net, len)));
+ }
+ result = get1101mask(this, get1101answer(this, ansbuf, anslen, by_addr,
+ AF_INET, NULL, net, len));
+ memput(ansbuf, MAXPACKET);
+ return (result);
}
static struct nwent *
@@ -430,7 +450,7 @@ get1101mask(struct irs_nw *this, struct nwent *nwent) {
struct pvt *pvt = (struct pvt *)this->private;
char qbuf[sizeof "255.255.255.255.in-addr.arpa"], owner[MAXDNAME];
int anslen, type, class, ancount, qdcount;
- u_char ansbuf[MAXPACKET], *cp, *eom;
+ u_char *ansbuf, *cp, *eom;
HEADER *hp;
if (!nwent)
@@ -441,10 +461,18 @@ get1101mask(struct irs_nw *this, struct nwent *nwent) {
return (nwent);
}
+ ansbuf = memget(MAXPACKET);
+ if (ansbuf == NULL) {
+ errno = ENOMEM;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ return (NULL);
+ }
/* Query for the A RR that would hold this network's mask. */
- anslen = res_nquery(pvt->res, qbuf, C_IN, T_A, ansbuf, sizeof ansbuf);
- if (anslen < HFIXEDSZ)
+ anslen = res_nquery(pvt->res, qbuf, C_IN, T_A, ansbuf, MAXPACKET);
+ if (anslen < HFIXEDSZ) {
+ memput(ansbuf, MAXPACKET);
return (nwent);
+ }
/* Initialize, and parse header. */
hp = (HEADER *)ansbuf;
@@ -454,8 +482,10 @@ get1101mask(struct irs_nw *this, struct nwent *nwent) {
while (qdcount-- > 0) {
int n = dn_skipname(cp, eom);
cp += n + QFIXEDSZ;
- if (n < 0 || cp > eom)
+ if (n < 0 || cp > eom) {
+ memput(ansbuf, MAXPACKET);
return (nwent);
+ }
}
ancount = ntohs(hp->ancount);
@@ -489,6 +519,7 @@ get1101mask(struct irs_nw *this, struct nwent *nwent) {
}
cp += n; /* RDATA */
}
+ memput(ansbuf, MAXPACKET);
return (nwent);
}
diff --git a/lib/bind/irs/getnameinfo.c b/lib/bind/irs/getnameinfo.c
index 0e86cc15..9b26c641 100644
--- a/lib/bind/irs/getnameinfo.c
+++ b/lib/bind/irs/getnameinfo.c
@@ -105,9 +105,9 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
int family, i;
const char *addr;
char *p;
- u_char pfx;
char numserv[512];
char numaddr[512];
+ const struct sockaddr_in6 *sin6;
if (sa == NULL)
return EAI_FAIL;
@@ -157,9 +157,23 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
flags |= NI_NUMERICHOST;
break;
case AF_INET6:
- pfx = *addr;
- if (pfx == 0 || pfx == 0xfe || pfx == 0xff)
- flags |= NI_NUMERICHOST;
+ sin6 = (const struct sockaddr_in6 *)sa;
+ switch (sin6->sin6_addr.s6_addr[0]) {
+ case 0x00:
+ if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr))
+ ;
+ else if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr))
+ ;
+ else
+ flags |= NI_NUMERICHOST;
+ break;
+ default:
+ if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))
+ flags |= NI_NUMERICHOST;
+ else if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
+ flags |= NI_NUMERICHOST;
+ break;
+ }
break;
}
if (host == NULL || hostlen == 0) {
diff --git a/lib/bind/port_after.h.in b/lib/bind/port_after.h.in
index f120779e..fcbc99c9 100644
--- a/lib/bind/port_after.h.in
+++ b/lib/bind/port_after.h.in
@@ -156,11 +156,32 @@ extern const struct in6_addr in6addr_any;
IN6_ARE_ADDR_EQUAL(a, &in6addr_any)
#endif
+#ifndef IN6_IS_ADDR_LOOPBACK
+extern const struct in6_addr isc_in6addr_loopback;
+#define IN6_IS_ADDR_LOOPBACK(a) \
+ IN6_ARE_ADDR_EQUAL(a, &isc_in6addr_loopback)
+#endif
+
+#ifndef IN6_IS_ADDR_V4MAPPED
+#define IN6_IS_ADDR_V4MAPPED(a) \
+ ((a)->s6_addr[0] == 0x00 && (a)->s6_addr[1] == 0x00 && \
+ (a)->s6_addr[2] == 0x00 && (a)->s6_addr[3] == 0x00 && \
+ (a)->s6_addr[4] == 0x00 && (a)->s6_addr[5] == 0x00 && \
+ (a)->s6_addr[6] == 0x00 && (a)->s6_addr[9] == 0x00 && \
+ (a)->s6_addr[8] == 0x00 && (a)->s6_addr[9] == 0x00 && \
+ (a)->s6_addr[10] == 0xff && (a)->s6_addr[11] == 0xff)
+#endif
+
#ifndef IN6_IS_ADDR_SITELOCAL
#define IN6_IS_ADDR_SITELOCAL(a) \
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
#endif
+#ifndef IN6_IS_ADDR_LINKLOCAL
+#define IN6_IS_ADDR_LINKLOCAL(a) \
+ (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
+#endif
+
#ifndef IN6_IS_ADDR_MULTICAST
#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)
#endif
diff --git a/lib/dns/api b/lib/dns/api
index c1c50369..b68bc303 100644
--- a/lib/dns/api
+++ b/lib/dns/api
@@ -1,3 +1,3 @@
-LIBINTERFACE = 6
-LIBREVISION = 0
-LIBAGE = 1
+LIBINTERFACE = 7
+LIBREVISION = 1
+LIBAGE = 2
diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c
index 54db08e4..3796487c 100644
--- a/lib/dns/dispatch.c
+++ b/lib/dns/dispatch.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dispatch.c,v 1.101 2001/08/08 22:54:38 gson Exp $ */
+/* $Id: dispatch.c,v 1.101.2.2 2002/03/26 00:54:52 marka Exp $ */
#include <config.h>
@@ -1212,16 +1212,11 @@ dns_dispatchmgr_destroy(dns_dispatchmgr_t **mgrp) {
static isc_boolean_t
local_addr_match(dns_dispatch_t *disp, isc_sockaddr_t *addr) {
- in_port_t port;
if (addr == NULL)
return (ISC_TRUE);
- port = isc_sockaddr_getport(addr);
- if (port == 0)
- return (isc_sockaddr_eqaddr(&disp->local, addr));
- else
- return (isc_sockaddr_equal(&disp->local, addr));
+ return (isc_sockaddr_equal(&disp->local, addr));
}
/*
diff --git a/lib/dns/gen.c b/lib/dns/gen.c
index c24254d9..3373ac3c 100644
--- a/lib/dns/gen.c
+++ b/lib/dns/gen.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1998-2001 Internet Software Consortium.
+ * Copyright (C) 1998-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: gen.c,v 1.65 2001/08/08 22:54:39 gson Exp $ */
+/* $Id: gen.c,v 1.65.2.2 2002/03/26 00:54:54 marka Exp $ */
#include <config.h>
@@ -666,9 +666,11 @@ main(int argc, char **argv) {
* Here, walk the list from top to bottom, calculating
* the hash (mod 256) for each name.
*/
- fprintf(stdout, "#define RDATATYPE_COMPARE(_s, _d, _tn, _tp) \\\n");
+ fprintf(stdout, "#define RDATATYPE_COMPARE(_s, _d, _tn, _n, _tp) \\\n");
fprintf(stdout, "\tdo { \\\n");
- fprintf(stdout, "\t\tif (strcasecmp(_s,(_tn)) == 0) { \\\n");
+ fprintf(stdout, "\t\tif (sizeof(_s) - 1 == _n && \\\n"
+ "\t\t strncasecmp(_s,(_tn),"
+ "(sizeof(_s) - 1)) == 0) { \\\n");
fprintf(stdout, "\t\t\tif ((typeattr[_d].flags & "
"DNS_RDATATYPEATTR_RESERVED) != 0) \\\n");
fprintf(stdout, "\t\t\t\treturn (ISC_R_NOTIMPLEMENTED); \\\n");
@@ -677,8 +679,8 @@ main(int argc, char **argv) {
fprintf(stdout, "\t\t} \\\n");
fprintf(stdout, "\t} while (0)\n\n");
- fprintf(stdout, "#define RDATATYPE_FROMTEXT_SW(_hash,_typename,_typep) "
- "\\\n");
+ fprintf(stdout, "#define RDATATYPE_FROMTEXT_SW(_hash,"
+ "_typename,_length,_typep) \\\n");
fprintf(stdout, "\tswitch (_hash) { \\\n");
for (i = 0 ; i <= 255 ; i++) {
ttn = &typenames[i];
@@ -703,7 +705,7 @@ main(int argc, char **argv) {
if (hash == HASH(ttn2->typename)) {
fprintf(stdout, "\t\t\tRDATATYPE_COMPARE"
"(\"%s\", %u, "
- "_typename, _typep); \\\n",
+ "_typename, _length, _typep); \\\n",
ttn2->typename, j);
ttn2->sorted = 1;
}
diff --git a/lib/dns/include/dns/result.h b/lib/dns/include/dns/result.h
index 44c7e088..768033cb 100644
--- a/lib/dns/include/dns/result.h
+++ b/lib/dns/include/dns/result.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1998-2001 Internet Software Consortium.
+ * Copyright (C) 1998-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: result.h,v 1.81.2.1 2001/09/19 21:51:42 bwelling Exp $ */
+/* $Id: result.h,v 1.81.2.3 2002/03/26 00:55:02 marka Exp $ */
#ifndef DNS_RESULT_H
#define DNS_RESULT_H 1
@@ -116,8 +116,13 @@
#define DNS_R_BADIXFR (ISC_RESULTCLASS_DNS + 77)
/* #define DNS_R_unused (ISC_RESULTCLASS_DNS + 78) */
#define DNS_R_NOVALIDKEY (ISC_RESULTCLASS_DNS + 79)
+#define DNS_R_OBSOLETE (ISC_RESULTCLASS_DNS + 80)
+#define DNS_R_FROZEN (ISC_RESULTCLASS_DNS + 81)
+#define DNS_R_UNKNOWNFLAG (ISC_RESULTCLASS_DNS + 82)
+#define DNS_R_EXPECTEDRESPONSE (ISC_RESULTCLASS_DNS + 83)
-#define DNS_R_NRESULTS 80 /* Number of results */
+
+#define DNS_R_NRESULTS 84 /* Number of results */
/*
* DNS wire format rcodes.
diff --git a/lib/dns/include/dns/tsig.h b/lib/dns/include/dns/tsig.h
index 8a8d7668..1debf9c9 100644
--- a/lib/dns/include/dns/tsig.h
+++ b/lib/dns/include/dns/tsig.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: tsig.h,v 1.40 2001/07/16 05:10:28 mayer Exp $ */
+/* $Id: tsig.h,v 1.40.2.2 2002/03/26 00:55:04 marka Exp $ */
#ifndef DNS_TSIG_H
#define DNS_TSIG_H 1
@@ -188,6 +188,9 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg,
* DNS_R_CLOCKSKEW - the TSIG failed to verify because of
* the time was out of the allowed range.
* DNS_R_TSIGVERIFYFAILURE - the TSIG failed to verify
+ * DNS_R_EXPECTEDRESPONSE - the message was set over TCP and
+ * should have been a response,
+ * but was not.
*/
isc_result_t
diff --git a/lib/dns/master.c b/lib/dns/master.c
index ed790216..f8a2b90d 100644
--- a/lib/dns/master.c
+++ b/lib/dns/master.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: master.c,v 1.122.2.4 2002/02/08 03:57:27 marka Exp $ */
+/* $Id: master.c,v 1.122.2.5 2002/03/20 19:15:13 marka Exp $ */
#include <config.h>
@@ -1110,10 +1110,11 @@ load(dns_loadctx_t *lctx) {
ictx->origin, ISC_FALSE, NULL);
if (MANYERRS(lctx, result)) {
SETRESULT(lctx, result);
+ LOGITFILE(result, include_file);
read_till_eol = ISC_TRUE;
continue;
} else if (result != ISC_R_SUCCESS)
- goto insist_and_cleanup;
+ goto log_and_cleanup;
/*
* Finish $ORIGIN / $INCLUDE processing if required.
diff --git a/lib/dns/name.c b/lib/dns/name.c
index 0ed0a04f..ed6581ff 100644
--- a/lib/dns/name.c
+++ b/lib/dns/name.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1998-2001 Internet Software Consortium.
+ * Copyright (C) 1998-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: name.c,v 1.127 2001/06/28 21:34:11 gson Exp $ */
+/* $Id: name.c,v 1.127.2.2 2002/03/26 00:54:55 marka Exp $ */
#include <config.h>
@@ -1484,8 +1484,8 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source,
* addition of another byte
* below.
*/
- n1 = bitlength - 1 / 8;
- n2 = tbcount - 1 / 8;
+ n1 = (bitlength - 1) / 8;
+ n2 = (tbcount - 1) / 8;
if (n1 != n2) {
if (value != 0)
return
diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c
index 4760958e..9fc7b675 100644
--- a/lib/dns/rdata.c
+++ b/lib/dns/rdata.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdata.c,v 1.147.2.5 2002/02/20 02:17:24 marka Exp $ */
+/* $Id: rdata.c,v 1.147.2.7 2002/03/27 23:52:33 marka Exp $ */
#include <config.h>
#include <ctype.h>
@@ -1028,7 +1028,7 @@ isc_result_t
dns_rdataclass_fromtext(dns_rdataclass_t *classp, isc_textregion_t *source) {
#define COMPARE(string, rdclass) \
if (((sizeof(string) - 1) == source->length) \
- && (strcasecmp(source->base, string) == 0)) { \
+ && (strncasecmp(source->base, string, source->length) == 0)) { \
*classp = rdclass; \
return (ISC_R_SUCCESS); \
}
@@ -1045,12 +1045,18 @@ dns_rdataclass_fromtext(dns_rdataclass_t *classp, isc_textregion_t *source) {
*/
COMPARE("ch", dns_rdataclass_chaos);
COMPARE("chaos", dns_rdataclass_chaos);
+
if (source->length > 5 &&
- strncasecmp("class", source->base, 5) == 0)
- {
+ source->length < (5 + sizeof("65000")) &&
+ strncasecmp("class", source->base, 5) == 0) {
+ char buf[sizeof("65000")];
char *endp;
- int val = strtol(source->base + 5, &endp, 10);
- if (*endp == '\0' && val >= 0 && val <= 0xffff) {
+ unsigned int val;
+
+ strncpy(buf, source->base + 5, source->length - 5);
+ buf[source->length - 5] = '\0';
+ val = strtoul(buf, &endp, 10);
+ if (*endp == '\0' && val <= 0xffff) {
*classp = (dns_rdataclass_t)val;
return (ISC_R_SUCCESS);
}
@@ -1144,12 +1150,18 @@ dns_rdatatype_fromtext(dns_rdatatype_t *typep, isc_textregion_t *source) {
* to return a result to the caller if it is a valid (known)
* rdatatype name.
*/
- RDATATYPE_FROMTEXT_SW(hash, source->base, typep);
+ RDATATYPE_FROMTEXT_SW(hash, source->base, n, typep);
- if (source->length > 4 && strncasecmp("type", source->base, 4) == 0) {
+ if (source->length > 4 && source->length < (4 + sizeof("65000")) &&
+ strncasecmp("type", source->base, 4) == 0) {
+ char buf[sizeof("65000")];
char *endp;
- int val = strtol(source->base + 4, &endp, 10);
- if (*endp == '\0' && val >= 0 && val <= 0xffff) {
+ unsigned int val;
+
+ strncpy(buf, source->base + 4, source->length - 4);
+ buf[source->length - 4] = '\0';
+ val = strtoul(buf, &endp, 10);
+ if (*endp == '\0' && val <= 0xffff) {
*typep = (dns_rdatatype_t)val;
return (ISC_R_SUCCESS);
}
diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c
index 50c0c0da..f52bdb16 100644
--- a/lib/dns/resolver.c
+++ b/lib/dns/resolver.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: resolver.c,v 1.218.2.8 2002/02/26 23:24:18 halley Exp $ */
+/* $Id: resolver.c,v 1.218.2.9 2002/03/26 00:54:58 marka Exp $ */
#include <config.h>
diff --git a/lib/dns/result.c b/lib/dns/result.c
index 693efe07..2bc2d098 100644
--- a/lib/dns/result.c
+++ b/lib/dns/result.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1998-2001 Internet Software Consortium.
+ * Copyright (C) 1998-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: result.c,v 1.90.2.2 2001/09/21 23:18:45 gson Exp $ */
+/* $Id: result.c,v 1.90.2.5 2002/03/26 00:55:00 marka Exp $ */
#include <config.h>
@@ -120,7 +120,12 @@ static const char *text[DNS_R_NRESULTS] = {
"clocks are unsynchronized", /* 76 DNS_R_CLOCKSKEW */
"IXFR failed", /* 77 DNS_R_BADIXFR */
"<unused 78>", /* 78 unused */
- "no valid KEY" /* 79 DNS_R_NOVALIDKEY */
+ "no valid KEY", /* 79 DNS_R_NOVALIDKEY */
+
+ "obsolete", /* 80 DNS_R_OBSOLETE */
+ "already frozen", /* 81 DNS_R_FROZEN */
+ "unknown flag", /* 82 DNS_R_UNKNOWNFLAG */
+ "expected a response" /* 83 DNS_R_EXPECTEDRESPONSE */
};
static const char *rcode_text[DNS_R_NRCODERESULTS] = {
@@ -230,6 +235,7 @@ dns_result_torcode(isc_result_t result) {
rcode = dns_rcode_refused;
break;
case DNS_R_TSIGVERIFYFAILURE:
+ case DNS_R_CLOCKSKEW:
rcode = dns_rcode_notauth;
break;
default:
diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c
index 53172d7e..574d64c3 100644
--- a/lib/dns/tsig.c
+++ b/lib/dns/tsig.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -16,7 +16,7 @@
*/
/*
- * $Id: tsig.c,v 1.112.2.1 2001/09/27 23:17:10 gson Exp $
+ * $Id: tsig.c,v 1.112.2.3 2002/03/26 00:55:01 marka Exp $
*/
#include <config.h>
@@ -910,9 +910,11 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) {
REQUIRE(msg != NULL);
REQUIRE(dns_message_gettsigkey(msg) != NULL);
REQUIRE(msg->tcp_continuation == 1);
- REQUIRE(is_response(msg));
REQUIRE(msg->querytsig != NULL);
+ if (!is_response(msg))
+ return (DNS_R_EXPECTEDRESPONSE);
+
mctx = msg->mctx;
tsigkey = dns_message_gettsigkey(msg);
diff --git a/lib/dns/zone.c b/lib/dns/zone.c
index c8afba04..2581261b 100644
--- a/lib/dns/zone.c
+++ b/lib/dns/zone.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zone.c,v 1.333.2.7 2002/02/08 03:57:31 marka Exp $ */
+/* $Id: zone.c,v 1.333.2.8 2002/03/29 00:20:07 marka Exp $ */
#include <config.h>
@@ -4563,7 +4563,9 @@ notify_done(isc_task_t *task, isc_event_t *event) {
notify->flags |= DNS_NOTIFY_NOSOA;
notify->attempt++;
dns_request_destroy(&notify->request);
- notify_send_queue(notify);
+ result = notify_send_queue(notify);
+ if (result != ISC_R_SUCCESS)
+ notify_destroy(notify, ISC_FALSE);
} else {
if (result == ISC_R_TIMEDOUT)
notify_log(notify->zone, ISC_LOG_DEBUG(1),
diff --git a/lib/isc/api b/lib/isc/api
index 38cabc1d..a2d21190 100644
--- a/lib/isc/api
+++ b/lib/isc/api
@@ -1,3 +1,3 @@
-LIBINTERFACE = 4
-LIBREVISION = 1
-LIBAGE = 0
+LIBINTERFACE = 5
+LIBREVISION = 0
+LIBAGE = 1
diff --git a/lib/isc/include/isc/result.h b/lib/isc/include/isc/result.h
index 685385ee..b990debe 100644
--- a/lib/isc/include/isc/result.h
+++ b/lib/isc/include/isc/result.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1998-2001 Internet Software Consortium.
+ * Copyright (C) 1998-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: result.h,v 1.57 2001/06/15 22:07:51 gson Exp $ */
+/* $Id: result.h,v 1.57.2.2 2002/03/26 00:55:09 marka Exp $ */
#ifndef ISC_RESULT_H
#define ISC_RESULT_H 1
@@ -78,11 +78,13 @@
#define ISC_R_UNBALANCEDQUOTES 52 /* unbalanced quotes */
#define ISC_R_INPROGRESS 53 /* operation in progress */
#define ISC_R_CONNECTIONRESET 54 /* connection reset */
+#define ISC_R_SOFTQUOTA 55 /* soft quota reached */
+#define ISC_R_BADNUMBER 56 /* not a valid number */
/*
* Not a result code: the number of results.
*/
-#define ISC_R_NRESULTS 55
+#define ISC_R_NRESULTS 57
ISC_LANG_BEGINDECLS
diff --git a/lib/isc/inet_pton.c b/lib/isc/inet_pton.c
index 789403dc..f05d1331 100644
--- a/lib/isc/inet_pton.c
+++ b/lib/isc/inet_pton.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1996-2001 Internet Software Consortium.
+ * Copyright (C) 1996-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -17,7 +17,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] =
- "$Id: inet_pton.c,v 1.10 2001/07/16 03:06:52 marka Exp $";
+ "$Id: inet_pton.c,v 1.10.2.2 2002/03/26 00:55:06 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include <config.h>
@@ -51,11 +51,7 @@ static int inet_pton6(const char *src, unsigned char *dst);
* Paul Vixie, 1996.
*/
int
-isc_net_pton(af, src, dst)
- int af;
- const char *src;
- void *dst;
-{
+isc_net_pton(int af, const char *src, void *dst) {
switch (af) {
case AF_INET:
return (inet_pton4(src, dst));
@@ -79,10 +75,7 @@ isc_net_pton(af, src, dst)
* Paul Vixie, 1996.
*/
static int
-inet_pton4(src, dst)
- const char *src;
- unsigned char *dst;
-{
+inet_pton4(const char *src, unsigned char *dst) {
static const char digits[] = "0123456789";
int saw_digit, octets, ch;
unsigned char tmp[NS_INADDRSZ], *tp;
@@ -134,10 +127,7 @@ inet_pton4(src, dst)
* Paul Vixie, 1996.
*/
static int
-inet_pton6(src, dst)
- const char *src;
- unsigned char *dst;
-{
+inet_pton6(const char *src, unsigned char *dst) {
static const char xdigits_l[] = "0123456789abcdef",
xdigits_u[] = "0123456789ABCDEF";
unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
diff --git a/lib/isc/lex.c b/lib/isc/lex.c
index c69a52f2..a440467f 100644
--- a/lib/isc/lex.c
+++ b/lib/isc/lex.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1998-2001 Internet Software Consortium.
+ * Copyright (C) 1998-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lex.c,v 1.66.2.3 2001/12/13 06:17:34 bwelling Exp $ */
+/* $Id: lex.c,v 1.66.2.5 2002/03/26 00:55:07 marka Exp $ */
#include <config.h>
@@ -812,6 +812,8 @@ isc_lex_getmastertoken(isc_lex_t *lex, isc_token_t *token,
if (token->type == isc_tokentype_eol ||
token->type == isc_tokentype_eof)
return (ISC_R_UNEXPECTEDEND);
+ if (expect == isc_tokentype_number)
+ return (ISC_R_BADNUMBER);
return (ISC_R_UNEXPECTEDTOKEN);
}
return (ISC_R_SUCCESS);
diff --git a/lib/isc/mem.c b/lib/isc/mem.c
index 1bd39b1f..431dc8c2 100644
--- a/lib/isc/mem.c
+++ b/lib/isc/mem.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: mem.c,v 1.98.2.4 2002/02/08 03:57:39 marka Exp $ */
+/* $Id: mem.c,v 1.98.2.5 2002/03/20 22:51:43 marka Exp $ */
#include <config.h>
@@ -1559,7 +1559,11 @@ isc__mempool_put(isc_mempool_t *mpctx, void *mem FLARG) {
INSIST(mpctx->allocated > 0);
mpctx->allocated--;
+#if ISC_MEM_TRACKLINES
+ LOCK(&mctx->lock);
DELETE_TRACE(mctx, mem, mpctx->size, file, line);
+ UNLOCK(&mctx->lock);
+#endif /* ISC_MEM_TRACKLINES */
/*
* If our free list is full, return this to the mctx directly.
diff --git a/lib/isc/result.c b/lib/isc/result.c
index 085382f8..b2e9d1c3 100644
--- a/lib/isc/result.c
+++ b/lib/isc/result.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1998-2001 Internet Software Consortium.
+ * Copyright (C) 1998-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: result.c,v 1.56 2001/06/15 22:07:50 gson Exp $ */
+/* $Id: result.c,v 1.56.2.2 2002/03/26 00:55:08 marka Exp $ */
#include <config.h>
@@ -92,7 +92,9 @@ static const char *text[ISC_R_NRESULTS] = {
"not blocking", /* 51 */
"unbalanced quotes", /* 52 */
"operation in progress", /* 53 */
- "connection reset" /* 54 */
+ "connection reset", /* 54 */
+ "soft quota reached", /* 55 */
+ "not a valid number" /* 56 */
};
#define ISC_RESULT_RESULTSET 2
diff --git a/lib/isc/task.c b/lib/isc/task.c
index 3e1cb9dc..2dfcc5c9 100644
--- a/lib/isc/task.c
+++ b/lib/isc/task.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: task.c,v 1.85 2001/06/04 19:33:28 tale Exp $ */
+/* $Id: task.c,v 1.85.2.1 2002/03/29 01:41:01 marka Exp $ */
/*
* Principal Author: Bob Halley
@@ -1211,6 +1211,7 @@ isc_taskmgr_destroy(isc_taskmgr_t **managerp) {
UNLOCK(&manager->lock);
while (isc__taskmgr_ready())
(void)isc__taskmgr_dispatch();
+ INSIST(ISC_LIST_EMPTY(manager->tasks));
#endif /* ISC_PLATFORM_USETHREADS */
manager_free(manager);
diff --git a/lib/isc/unix/errno2result.c b/lib/isc/unix/errno2result.c
index 8b0f1c42..ced3dba5 100644
--- a/lib/isc/unix/errno2result.c
+++ b/lib/isc/unix/errno2result.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: errno2result.c,v 1.8.2.2 2002/02/20 02:17:27 marka Exp $ */
+/* $Id: errno2result.c,v 1.8.2.3 2002/03/20 20:59:39 marka Exp $ */
#include <config.h>
@@ -100,6 +100,8 @@ isc__errno2result(int posixerrno) {
case EADDRINUSE:
return (ISC_R_ADDRINUSE);
#endif
+ case EADDRNOTAVAIL:
+ return (ISC_R_ADDRNOTAVAIL);
default:
isc__strerror(posixerrno, strbuf, sizeof(strbuf));
UNEXPECTED_ERROR(__FILE__, __LINE__,
diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c
index ae499f7d..462d2eff 100644
--- a/lib/isc/unix/socket.c
+++ b/lib/isc/unix/socket.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: socket.c,v 1.207.2.9 2002/02/08 03:57:42 marka Exp $ */
+/* $Id: socket.c,v 1.207.2.10 2002/03/20 20:56:44 marka Exp $ */
#include <config.h>
@@ -929,6 +929,8 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
SOFT_OR_HARD(ENETUNREACH, ISC_R_NETUNREACH);
SOFT_OR_HARD(EHOSTUNREACH, ISC_R_HOSTUNREACH);
SOFT_OR_HARD(EHOSTDOWN, ISC_R_HOSTDOWN);
+ /* HPUX 11.11 can return EADDRNOTAVAIL. */
+ SOFT_OR_HARD(EADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL);
ALWAYS_HARD(ENOBUFS, ISC_R_NORESOURCES);
#undef SOFT_OR_HARD
diff --git a/lib/isc/win32/file.c b/lib/isc/win32/file.c
index 10926952..32dada2a 100644
--- a/lib/isc/win32/file.c
+++ b/lib/isc/win32/file.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001 Internet Software Consortium.
+ * Copyright (C) 2000-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: file.c,v 1.20.2.2 2001/09/05 17:29:25 gson Exp $ */
+/* $Id: file.c,v 1.20.2.4 2002/03/26 00:55:11 marka Exp $ */
#include <config.h>
@@ -302,6 +302,8 @@ isc_file_renameunique(const char *file, char *templet) {
fd = mkstemp(templet);
if (fd == -1)
result = isc__errno2result(errno);
+ else
+ close(fd);
if (result == ISC_R_SUCCESS) {
res = isc_file_safemovefile(file, templet);
@@ -310,8 +312,6 @@ isc_file_renameunique(const char *file, char *templet) {
(void)unlink(templet);
}
}
- if (fd != -1)
- close(fd);
return (result);
}
diff --git a/lib/isc/win32/include/isc/strerror.h b/lib/isc/win32/include/isc/strerror.h
index 662e82c2..4678404f 100644
--- a/lib/isc/win32/include/isc/strerror.h
+++ b/lib/isc/win32/include/isc/strerror.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001 Internet Software Consortium.
+ * Copyright (C) 2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: strerror.h,v 1.2.2.1 2002/02/27 07:20:25 marka Exp $ */
+/* $Id: strerror.h,v 1.2.2.2 2002/03/26 00:55:12 marka Exp $ */
#ifndef ISC_STRERROR_H
#define ISC_STRERROR_H
diff --git a/lib/isccc/api b/lib/isccc/api
index 494278e7..06977fcb 100644
--- a/lib/isccc/api
+++ b/lib/isccc/api
@@ -1,3 +1,3 @@
LIBINTERFACE = 0
-LIBREVISION = 0
+LIBREVISION = 1
LIBAGE = 0
diff --git a/lib/isccc/cc.c b/lib/isccc/cc.c
index 2324cd37..9ac82ad7 100644
--- a/lib/isccc/cc.c
+++ b/lib/isccc/cc.c
@@ -1,6 +1,6 @@
/*
- * Portions Copyright (C) 2001 Internet Software Consortium.
- * Portions Copyright (C) 2001 Nominum, Inc.
+ * Portions Copyright (C) 2001, 2002 Internet Software Consortium.
+ * Portions Copyright (C) 2001, 2002 Nominum, Inc.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -16,7 +16,7 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: cc.c,v 1.4 2001/04/12 20:36:53 tale Exp $ */
+/* $Id: cc.c,v 1.4.2.2 2002/03/26 00:55:13 marka Exp $ */
#include <config.h>
@@ -558,7 +558,7 @@ isccc_cc_isack(isccc_sexpr_t *message)
_ctrl = isccc_alist_lookup(message, "_ctrl");
if (_ctrl == NULL)
- return (ISC_R_FAILURE);
+ return (ISC_FALSE);
if (isccc_cc_lookupstring(_ctrl, "_ack", NULL) == ISC_R_SUCCESS)
return (ISC_TRUE);
return (ISC_FALSE);
@@ -571,7 +571,7 @@ isccc_cc_isreply(isccc_sexpr_t *message)
_ctrl = isccc_alist_lookup(message, "_ctrl");
if (_ctrl == NULL)
- return (ISC_R_FAILURE);
+ return (ISC_FALSE);
if (isccc_cc_lookupstring(_ctrl, "_rpl", NULL) == ISC_R_SUCCESS)
return (ISC_TRUE);
return (ISC_FALSE);
diff --git a/lib/isccfg/api b/lib/isccfg/api
index 06977fcb..7931195a 100644
--- a/lib/isccfg/api
+++ b/lib/isccfg/api
@@ -1,3 +1,3 @@
LIBINTERFACE = 0
-LIBREVISION = 1
+LIBREVISION = 2
LIBAGE = 0
diff --git a/lib/isccfg/check.c b/lib/isccfg/check.c
index 0e2d2606..2fe46e3a 100644
--- a/lib/isccfg/check.c
+++ b/lib/isccfg/check.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: check.c,v 1.14.2.14 2002/02/19 22:30:05 gson Exp $ */
+/* $Id: check.c,v 1.14.2.15 2002/03/20 20:21:15 marka Exp $ */
#include <config.h>
@@ -25,7 +25,9 @@
#include <isc/buffer.h>
#include <isc/log.h>
#include <isc/mem.h>
+#include <isc/netaddr.h>
#include <isc/result.h>
+#include <isc/sockaddr.h>
#include <isc/symtab.h>
#include <isc/util.h>
@@ -392,10 +394,46 @@ freekey(char *key, unsigned int type, isc_symvalue_t value, void *userarg) {
UNUSED(value);
isc_mem_free(userarg, key);
}
-
+
+static isc_result_t
+check_servers(cfg_obj_t *servers, isc_log_t *logctx) {
+ isc_result_t result = ISC_R_SUCCESS;
+ cfg_listelt_t *e1, *e2;
+ cfg_obj_t *v1, *v2;
+ isc_sockaddr_t *s1, *s2;
+ isc_netaddr_t na;
+
+ for (e1 = cfg_list_first(servers); e1 != NULL; e1 = cfg_list_next(e1)) {
+ v1 = cfg_listelt_value(e1);
+ s1 = cfg_obj_assockaddr(cfg_map_getname(v1));
+ e2 = e1;
+ while ((e2 = cfg_list_next(e2)) != NULL) {
+ v2 = cfg_listelt_value(e2);
+ s2 = cfg_obj_assockaddr(cfg_map_getname(v2));
+ if (isc_sockaddr_eqaddr(s1, s2)) {
+ isc_buffer_t target;
+ char buf[128];
+
+ isc_netaddr_fromsockaddr(&na, s2);
+ isc_buffer_init(&target, buf, sizeof(buf) - 1);
+ INSIST(isc_netaddr_totext(&na, &target)
+ == ISC_R_SUCCESS);
+ buf[isc_buffer_usedlength(&target)] = '\0';
+
+ cfg_obj_log(v2, logctx, ISC_LOG_ERROR,
+ "server '%s': already exists",
+ buf);
+ result = ISC_R_FAILURE;
+ }
+ }
+ }
+ return (result);
+}
+
static isc_result_t
check_viewconf(cfg_obj_t *config, cfg_obj_t *vconfig, isc_log_t *logctx, isc_mem_t *mctx)
{
+ cfg_obj_t *servers = NULL;
cfg_obj_t *zones = NULL;
cfg_obj_t *keys = NULL;
cfg_listelt_t *element;
@@ -474,6 +512,14 @@ check_viewconf(cfg_obj_t *config, cfg_obj_t *vconfig, isc_log_t *logctx, isc_mem
result = ISC_R_FAILURE;
}
+
+ if (vconfig != NULL) {
+ (void)cfg_map_get(vconfig, "server", &servers);
+ if (servers != NULL &&
+ check_servers(servers, logctx) != ISC_R_SUCCESS)
+ result = ISC_R_FAILURE;
+ }
+
if (vconfig != NULL)
tresult = check_options(vconfig, logctx);
else
@@ -488,6 +534,7 @@ check_viewconf(cfg_obj_t *config, cfg_obj_t *vconfig, isc_log_t *logctx, isc_mem
isc_result_t
cfg_check_namedconf(cfg_obj_t *config, isc_log_t *logctx, isc_mem_t *mctx) {
cfg_obj_t *options = NULL;
+ cfg_obj_t *servers = NULL;
cfg_obj_t *views = NULL;
cfg_obj_t *acls = NULL;
cfg_obj_t *obj;
@@ -504,6 +551,11 @@ cfg_check_namedconf(cfg_obj_t *config, isc_log_t *logctx, isc_mem_t *mctx) {
check_options(options, logctx) != ISC_R_SUCCESS)
result = ISC_R_FAILURE;
+ (void)cfg_map_get(config, "server", &servers);
+ if (servers != NULL &&
+ check_servers(servers, logctx) != ISC_R_SUCCESS)
+ result = ISC_R_FAILURE;
+
(void)cfg_map_get(config, "view", &views);
if (views == NULL) {