Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/dist/bind Pull up revision 1.4 (requested by itojun):
details: https://anonhg.NetBSD.org/src/rev/bda692dc4e8c
branches: netbsd-1-5
changeset: 490561:bda692dc4e8c
user: he <he%NetBSD.org@localhost>
date: Sun Jan 28 15:52:47 2001 +0000
description:
Pull up revision 1.4 (requested by itojun):
Upgrade to BIND version 8.2.3.
diffstat:
dist/bind/bin/host/host.c | 146 +++++++++++++++++++-----------
dist/bind/bin/named/ns_config.c | 154 +++++++++++++++++++++++--------
dist/bind/bin/named/ns_ctl.c | 121 ++++++++++++++++++++----
dist/bind/bin/named/ns_forw.c | 134 ++++++++++++++-------------
dist/bind/bin/named/ns_resp.c | 192 ++++++++++++++++++++++-----------------
dist/bind/include/port_before.h | 6 +-
dist/bind/lib/irs/irs_data.c | 7 +-
dist/bind/man/host.1 | 6 +-
8 files changed, 491 insertions(+), 275 deletions(-)
diffs (truncated from 1724 to 300 lines):
diff -r e7814cf3a6a7 -r bda692dc4e8c dist/bind/bin/host/host.c
--- a/dist/bind/bin/host/host.c Sun Jan 28 15:52:36 2001 +0000
+++ b/dist/bind/bin/host/host.c Sun Jan 28 15:52:47 2001 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: host.c,v 1.2.8.2 2000/11/13 22:00:06 tv Exp $ */
+/* $NetBSD: host.c,v 1.2.8.3 2001/01/28 15:52:47 he Exp $ */
#ifndef lint
-static const char rcsid[] = "Id: host.c,v 8.34 1999/11/11 19:39:10 cyarnell Exp";
+static const char rcsid[] = "Id: host.c,v 8.42 2000/12/23 08:14:32 vixie Exp";
#endif /* not lint */
/*
@@ -128,6 +128,9 @@
#define SUCCESS 0
#define TIME_OUT -1
#define NO_INFO -2
+#ifdef ERROR
+#undef ERROR
+#endif
#define ERROR -3
#define NONAUTH -4
@@ -168,12 +171,13 @@
static int sockFD;
static FILE *filePtr;
-static struct __res_state res, orig;
+static struct __res_state res;
static char *cname = NULL;
static const char *progname = "amnesia";
static int getclass = ns_c_in, verbose = 0, list = 0;
static int server_specified = 0;
-static int gettype;
+static int gettype = 0;
+static int querytype = 0;
static char getdomain[NS_MAXDNAME];
/* Forward. */
@@ -223,9 +227,9 @@
struct in_addr addr;
struct hostent *hp;
char *s;
- int inverse = 0, waitmode = 0;
+ int waitmode = 0;
int ncnames, ch;
- int nkeychains, i;
+ int nkeychains;
dst_init();
@@ -239,7 +243,7 @@
switch (ch) {
case 'a':
verbose = 1;
- gettype = ns_t_any;
+ querytype = ns_t_any;
break;
case 'c':
getclass = parseclass(optarg);
@@ -257,7 +261,7 @@
sigchase = 1;
break;
case 't':
- gettype = parsetype(optarg);
+ querytype = parsetype(optarg);
break;
case 'v':
verbose = 1;
@@ -272,10 +276,10 @@
/*NOTREACHED*/
}
}
- if (gettype == 0) {
+ if ((querytype == 0) && (sigchase)) {
if (verbose)
printf ("Forcing `-t a' for signature trace.\n");
- gettype = ns_t_a;
+ querytype = ns_t_a;
}
argc -= optind;
argv += optind;
@@ -322,7 +326,7 @@
res.options &= ~RES_DEFNAMES;
if (list)
- exit(ListHosts(getdomain, gettype ? gettype : ns_t_a));
+ exit(ListHosts(getdomain, querytype ? querytype : ns_t_a));
ncnames = 5; nkeychains = 18;
while (hp == NULL && res.res_h_errno == TRY_AGAIN) {
if (addr.s_addr == INADDR_NONE) {
@@ -338,12 +342,12 @@
/* start new query, for KEY */
strcpy (getdomain, chase_signer);
strcat (getdomain, ".");
- gettype = ns_t_key;
+ querytype = ns_t_key;
} else if (!(chase_step & SD_BADSIG)) {
/* start new query, for SIG */
strcpy (getdomain, chase_domain);
strcat (getdomain, ".");
- gettype = ns_t_sig;
+ querytype = ns_t_sig;
} else if (hp && !(chase_step & SD_SIG) &&
(chase_step & SD_BADSIG)) {
printf ("%s for %s not found, last verified key %s\n",
@@ -537,7 +541,7 @@
char *cp, **domain;
char tmp[NS_MAXDNAME];
const char *tp;
- int hp, nDomain;
+ int hp;
int asis = 0;
u_int n;
@@ -588,8 +592,8 @@
getdomaininfo(const char *name, const char *domain) {
int val1, val2;
- if (gettype)
- return (getinfo(name, domain, gettype));
+ if (querytype)
+ return (getinfo(name, domain, gettype=querytype));
else {
val1 = getinfo(name, domain, gettype=ns_t_a);
if (cname || verbose)
@@ -601,11 +605,9 @@
static int
getinfo(const char *name, const char *domain, int type) {
- HEADER *hp;
- u_char *eom, *bp, *cp;
+ u_char *eom;
querybuf buf, answer;
- int n, n1, i, j, nmx, ancount, nscount, arcount, qdcount, buflen;
- u_short pref, class;
+ int n;
char host[NS_MAXDNAME];
if (domain == NULL)
@@ -635,8 +637,7 @@
static int
printinfo(const querybuf *answer, const u_char *eom, int filter, int isls) {
- int n, n1, i, j, nmx, ancount, nscount, arcount, qdcount, buflen, savesigchase;
- u_short pref, class;
+ int n, nmx, ancount, nscount, arcount, qdcount, buflen, savesigchase;
const u_char *bp, *cp;
const HEADER *hp;
@@ -697,8 +698,18 @@
if (!hp->ad)
if (verbose && isls == 0)
printf("The following answer is not verified as authentic by the server:\n");
- while (--ancount >= 0 && cp && cp < eom)
+ while (--ancount >= 0 && cp && cp < eom) {
cp = pr_rr(cp, answer->qb2, stdout, filter);
+ /*
+ * When we ask for address and there is a CNAME, it
+ * seems to return both the CNAME and the address.
+ * Since we trace down the CNAME chain ourselves, we
+ * don't really want to print the address at this
+ * point.
+ */
+ if (cname && ! verbose)
+ return (1);
+ }
}
if (!verbose)
return (1);
@@ -968,24 +979,24 @@
}
if (doprint)
- fprintf(file, "(\n\t\t\t%ld\t;serial (version)",
+ fprintf(file, "(\n\t\t\t%lu\t;serial (version)",
ns_get32(cp));
cp += INT32SZ;
if (doprint)
- fprintf(file, "\n\t\t\t%ld\t;refresh period",
+ fprintf(file, "\n\t\t\t%lu\t;refresh period",
ns_get32(cp));
cp += INT32SZ;
if (doprint)
fprintf(file,
- "\n\t\t\t%ld\t;retry refresh this often",
+ "\n\t\t\t%lu\t;retry refresh this often",
ns_get32(cp));
cp += INT32SZ;
if (doprint)
- fprintf(file, "\n\t\t\t%ld\t;expiration period",
+ fprintf(file, "\n\t\t\t%lu\t;expiration period",
ns_get32(cp));
cp += INT32SZ;
if (doprint)
- fprintf(file, "\n\t\t\t%ld\t;minimum TTL\n\t\t\t)",
+ fprintf(file, "\n\t\t\t%lu\t;minimum TTL\n\t\t\t)",
ns_get32(cp));
cp += INT32SZ;
break;
@@ -1044,7 +1055,7 @@
cp += sizeof(u_short);
cp = (u_char *)pr_cdname(cp, msg, name, sizeof(name));
if (doprint)
- fprintf(file,"%s",name);
+ fprintf(file, " %s", name);
break;
case ns_t_naptr:
@@ -1266,7 +1277,7 @@
if (sigchase && !(chase_step & SD_SIG) &&
strcmp (chase_domain, thisdomain) == 0 &&
- chase_class == class & chase_type == tc)
+ chase_class == class && chase_type == tc)
{
u_char cdname[NS_MAXCDNAME];
@@ -1337,7 +1348,7 @@
if (sigchase && (chase_step & (SD_SIG|SD_RR)) &&
strcmp (getdomain, name) == 0 &&
- getclass == class & gettype == type)
+ getclass == class && gettype == type)
{
DST_KEY *dstkey;
int rc, len, i, j;
@@ -1453,7 +1464,7 @@
u_char cdname[NS_MAXCDNAME];
if (doprint && !verbose)
- fprintf (file, " (chasing signature %d)", sigchase-1);
+ fprintf(file, " (chasing signature)");
/* unpack rr */
@@ -1567,6 +1578,7 @@
int nshaveaddr[NUMNS];
struct in_addr nsipaddr[NUMNSADDR];
int numns, numnsaddr, thisns;
+ int qdcount, ancount;
/*
* Normalize to not have trailing dot. We do string compares below
@@ -1639,7 +1651,8 @@
cp = answer.qb2 + HFIXEDSZ;
eom = answer.qb2 + msglen;
- if (ntohs(answer.qb1.qdcount) > 0) {
+ qdcount = ntohs(answer.qb1.qdcount);
+ while (qdcount-- > 0) {
n = dn_skipname(cp, eom);
if (n < 0) {
printf("Form error.\n");
@@ -1877,35 +1890,60 @@
}
numAnswers++;
cp = buf.qb2 + HFIXEDSZ;
- if (ntohs(buf.qb1.qdcount) > 0) {
+ qdcount = ntohs(buf.qb1.qdcount);
+ while (qdcount-- > 0) {
n = dn_skipname(cp, buf.qb2 + len);
- if (n < 0) {
+ if (n <= 0) {
+ error = ERR_PRINTING;
+ break;
+ }
+ if (cp + n + QFIXEDSZ > buf.qb2 + len) {
error = ERR_PRINTING;
break;
}
cp += n + QFIXEDSZ;
}
- nmp = cp;
- n = dn_skipname(cp, buf.qb2 + len);
- if (n < 0) {
- error = ERR_PRINTING;
- break;
- }
- cp += n;
- if (cp + INT16SZ > buf.qb2 + len) {
- error = ERR_PRINTING;
- break;
+ ancount = ntohs(buf.qb1.ancount);
+ while (ancount-- > 0) {
+ nmp = cp;
+ n = dn_skipname(cp, buf.qb2 + len);
+ if (n <= 0) {
+ error = ERR_PRINTING;
+ break;
+ }
+ cp += n;
+ if (cp + INT16SZ > buf.qb2 + len) {
+ error = ERR_PRINTING;
+ break;
+ }
+ type = ns_get16(cp);
+ cp += INT16SZ;
+ if (type == ns_t_soa) {
+ (void) dn_expand(buf.qb2, buf.qb2 + len, nmp,
Home |
Main Index |
Thread Index |
Old Index