diff options
author | asmodai <asmodai@FreeBSD.org> | 2001-07-30 16:51:36 +0000 |
---|---|---|
committer | asmodai <asmodai@FreeBSD.org> | 2001-07-30 16:51:36 +0000 |
commit | 4764c8658fdd2787fdd421279037fe93eb05ac7c (patch) | |
tree | 575f66c4e2766172b1fb832ef43000016e089b3c /contrib/bind/bin | |
parent | c56e32d41edb68ef6a2360025bff9df4a544e5fa (diff) | |
download | FreeBSD-src-4764c8658fdd2787fdd421279037fe93eb05ac7c.zip FreeBSD-src-4764c8658fdd2787fdd421279037fe93eb05ac7c.tar.gz |
Virgin import of BIND v8.2.4-REL
Diffstat (limited to 'contrib/bind/bin')
27 files changed, 423 insertions, 246 deletions
diff --git a/contrib/bind/bin/dig/dig.c b/contrib/bind/bin/dig/dig.c index 01d87a9..f8030fd 100644 --- a/contrib/bind/bin/dig/dig.c +++ b/contrib/bind/bin/dig/dig.c @@ -1,5 +1,5 @@ #ifndef lint -static const char rcsid[] = "$Id: dig.c,v 8.44 2000/12/23 08:14:31 vixie Exp $"; +static const char rcsid[] = "$Id: dig.c,v 8.46 2001/04/01 17:35:01 vixie Exp $"; #endif /* @@ -346,7 +346,6 @@ main(int argc, char **argv) { res.id = 1; gettimeofday(&tv1, NULL); - assert(tv1.tv_usec >= 0 && tv1.tv_usec < 1000000); /* * Main section: once if cmd-line query @@ -862,7 +861,6 @@ main(int argc, char **argv) { if (res.pfcode & RES_PRF_HEAD1) fp_resstat(&res, stdout); (void) gettimeofday(&start_time, NULL); - assert(start_time.tv_usec >= 0 && start_time.tv_usec < 1000000); if (keyfile) n = res_nsendsigned(&res, packet, n, &key, answer, sizeof answer); else @@ -887,7 +885,6 @@ main(int argc, char **argv) { } } (void) gettimeofday(&end_time, NULL); - assert(end_time.tv_usec >= 0 && end_time.tv_usec < 1000000); if (res.pfcode & RES_PRF_STATS) { query_time = difftv(start_time, end_time); @@ -919,11 +916,11 @@ main(int argc, char **argv) { * batches started at different sites somewhat synchronized. */ gettimeofday(&tv2, NULL); - assert(tv2.tv_usec >= 0 && tv2.tv_usec < 1000000); delay = (int)(tv2.tv_sec - tv1.tv_sec); if (delay < wait) { sleep(wait - delay); } + tv1 = tv2; } return (eecode); } @@ -964,7 +961,7 @@ where: server,\n\ fputs("\ notes: defname and search don't work; use fully-qualified names.\n\ this is DiG version " VSTRING "\n\ - $Id: dig.c,v 8.44 2000/12/23 08:14:31 vixie Exp $\n\ + $Id: dig.c,v 8.46 2001/04/01 17:35:01 vixie Exp $\n\ ", stderr); } diff --git a/contrib/bind/bin/dnskeygen/dnskeygen.c b/contrib/bind/bin/dnskeygen/dnskeygen.c index f226a6f..593fb00 100644 --- a/contrib/bind/bin/dnskeygen/dnskeygen.c +++ b/contrib/bind/bin/dnskeygen/dnskeygen.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: dnskeygen.c,v 1.11 2000/12/23 08:14:31 vixie Exp $"; +static const char rcsid[] = "$Id: dnskeygen.c,v 1.11.2.1 2001/04/26 02:56:06 marka Exp $"; #endif /* not lint */ /* @@ -33,6 +33,9 @@ static const char rcsid[] = "$Id: dnskeygen.c,v 1.11 2000/12/23 08:14:31 vixie E #include "port_after.h" #define PRINT_SUPPORTED 2 +#ifndef PATH_SEP +#define PATH_SEP '/' +#endif static void usage(char *str, int full); @@ -54,7 +57,7 @@ main(int argc, char **argv) { extern char *optarg; dst_init(); - if ((prog = strrchr(argv[0],'/')) == NULL) + if ((prog = strrchr(argv[0], PATH_SEP)) == NULL) prog = strdup(argv[0]); else prog = strdup(++prog); diff --git a/contrib/bind/bin/host/host.c b/contrib/bind/bin/host/host.c index adb4feb..9303ab1 100644 --- a/contrib/bind/bin/host/host.c +++ b/contrib/bind/bin/host/host.c @@ -1,5 +1,5 @@ #ifndef lint -static const char rcsid[] = "$Id: host.c,v 8.42 2000/12/23 08:14:32 vixie Exp $"; +static const char rcsid[] = "$Id: host.c,v 8.43.2.1 2001/04/26 02:56:07 marka Exp $"; #endif /* not lint */ /* @@ -115,6 +115,9 @@ static const char copyright[] = /* Global. */ +#ifndef PATH_SEP +#define PATH_SEP '/' +#endif #define SIG_RDATA_BY_NAME 18 #define NS_HEADERDATA_SIZE 10 @@ -190,7 +193,7 @@ static int getdomaininfo(const char *name, const char *domain); static int getinfo(const char *name, const char *domain, int type); static int printinfo(const querybuf *answer, const u_char *eom, - int filter, int isls); + int filter, int isls, int isinaddr); static const u_char * pr_rr(const u_char *cp, const u_char *msg, FILE *file, int filter); static const char * pr_type(int type); @@ -231,7 +234,7 @@ main(int argc, char **argv) { dst_init(); - if ((progname = strrchr(argv[0], '/')) == NULL) + if ((progname = strrchr(argv[0], PATH_SEP)) == NULL) progname = argv[0]; else progname++; @@ -630,11 +633,13 @@ getinfo(const char *name, const char *domain, int type) { return (0); } eom = answer.qb2 + n; - return (printinfo(&answer, eom, ns_t_any, 0)); + return (printinfo(&answer, eom, ns_t_any, 0, (type == ns_t_ptr))); } static int -printinfo(const querybuf *answer, const u_char *eom, int filter, int isls) { +printinfo(const querybuf *answer, const u_char *eom, int filter, int isls, + int isinaddr) +{ int n, nmx, ancount, nscount, arcount, qdcount, buflen, savesigchase; const u_char *bp, *cp; const HEADER *hp; @@ -705,7 +710,7 @@ printinfo(const querybuf *answer, const u_char *eom, int filter, int isls) { * don't really want to print the address at this * point. */ - if (cname && ! verbose) + if (cname && (!verbose) && (!isinaddr)) return (1); } } @@ -1881,7 +1886,7 @@ ListHosts(char *namePtr, int queryType) { break; } - result = printinfo(&buf, cp, queryType, 1); + result = printinfo(&buf, cp, queryType, 1, 0); if (! result) { error = ERR_PRINTING; break; diff --git a/contrib/bind/bin/named-xfer/named-xfer.c b/contrib/bind/bin/named-xfer/named-xfer.c index 774adb9..1a08f7b 100644 --- a/contrib/bind/bin/named-xfer/named-xfer.c +++ b/contrib/bind/bin/named-xfer/named-xfer.c @@ -130,7 +130,7 @@ char copyright[] = #if !defined(lint) && !defined(SABER) static const char sccsid[] = "@(#)named-xfer.c 4.18 (Berkeley) 3/7/91"; -static const char rcsid[] = "$Id: named-xfer.c,v 8.104 2000/12/23 08:14:44 vixie Exp $"; +static const char rcsid[] = "$Id: named-xfer.c,v 8.105.2.1 2001/04/26 02:56:09 marka Exp $"; #endif /* not lint */ #include "port_before.h" @@ -169,6 +169,10 @@ static const char rcsid[] = "$Id: named-xfer.c,v 8.104 2000/12/23 08:14:44 vixie #include "port_after.h" +#ifndef PATH_SEP +#define PATH_SEP '/' +#endif + #define MAIN_PROGRAM #include "../named/named.h" #undef MAIN_PROGRAM @@ -330,7 +334,7 @@ main(int argc, char *argv[]) { set42sig(); #endif memset(&axfr_src, 0, sizeof axfr_src); - ProgName = strrchr(argv[0], '/'); + ProgName = strrchr(argv[0], PATH_SEP); if (ProgName != NULL) ProgName++; else @@ -891,13 +895,13 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { (void)fprintf(ddt,"getzone() %s ", zp->z_origin); switch (zp->z_type) { case Z_STUB: - fprintf(ddt,"stub\n"); + fprintf(ddt, "stub\n"); break; case Z_SECONDARY: - fprintf(ddt,"secondary\n"); + fprintf(ddt, "slave\n"); break; default: - fprintf(ddt,"unknown type\n"); + fprintf(ddt, "unknown type\n"); } } #endif diff --git a/contrib/bind/bin/named/db_defs.h b/contrib/bind/bin/named/db_defs.h index a3e9032..f18acae 100644 --- a/contrib/bind/bin/named/db_defs.h +++ b/contrib/bind/bin/named/db_defs.h @@ -1,6 +1,6 @@ /* * from db.h 4.16 (Berkeley) 6/1/90 - * $Id: db_defs.h,v 8.40 2000/11/29 06:55:46 marka Exp $ + * $Id: db_defs.h,v 8.41 2001/02/08 02:05:50 marka Exp $ */ /* @@ -119,7 +119,7 @@ struct databuf { * d_ttl is actually the time when * the record will expire. * otherwise (for authoritative - * primary and secondary zones), + * master and slave zones), * d_ttl is the time to live. */ unsigned d_zone :ZONE_BITS; /* zone number or 0 for the cache */ diff --git a/contrib/bind/bin/named/db_dump.c b/contrib/bind/bin/named/db_dump.c index 5bb9456..a350719 100644 --- a/contrib/bind/bin/named/db_dump.c +++ b/contrib/bind/bin/named/db_dump.c @@ -1,6 +1,6 @@ #if !defined(lint) && !defined(SABER) static const char sccsid[] = "@(#)db_dump.c 4.33 (Berkeley) 3/3/91"; -static const char rcsid[] = "$Id: db_dump.c,v 8.48 2000/12/23 08:14:34 vixie Exp $"; +static const char rcsid[] = "$Id: db_dump.c,v 8.49 2001/02/06 06:42:19 marka Exp $"; #endif /* not lint */ /* @@ -217,11 +217,13 @@ zt_dump(FILE *fp) { static int fwd_dump(FILE *fp) { int i; + fprintf(fp, ";; ++forwarders table++\n"); - for (i=0;i<fwddata_count;i++) { - fprintf(fp,"; %s rtt=%d\n", - inet_ntoa(fwddata[i]->fwdaddr.sin_addr), - fwddata[i]->nsdata->d_nstime); + for (i = 0; i < fwddata_count; i++) { + if (fwddata[i] != NULL) + fprintf(fp,"; %s rtt=%d\n", + inet_ntoa(fwddata[i]->fwdaddr.sin_addr), + fwddata[i]->nsdata->d_nstime); } fprintf(fp, ";; --forwarders table--\n"); return (0); diff --git a/contrib/bind/bin/named/db_ixfr.c b/contrib/bind/bin/named/db_ixfr.c index 14385d6..e515075 100644 --- a/contrib/bind/bin/named/db_ixfr.c +++ b/contrib/bind/bin/named/db_ixfr.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static char rcsid[] = "$Id: db_ixfr.c,v 8.23 2000/12/23 08:14:35 vixie Exp $"; +static char rcsid[] = "$Id: db_ixfr.c,v 8.23.2.2 2001/05/03 03:53:18 marka Exp $"; #endif /* @@ -102,8 +102,8 @@ ixfr_get_change_list(struct zoneinfo *zp, } INIT_LINK(dl, d_link); INIT_LIST(dl->d_changes); - ret = ixfr_getdelta(zp, fp, zp->z_ixfr_base, origin, &dl->d_changes, - &old_serial, &new_serial); + ret = ixfr_getdelta(zp, fp, zp->z_ixfr_base, origin, + &dl->d_changes, &old_serial, &new_serial); switch (ret) { case DBIXFR_ERROR: ns_warning(ns_log_db, "Logical error in %s: unlinking", @@ -374,6 +374,7 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin, char *dname, *cp, *cp1; char buf[MAXDATA]; u_int32_t serial, ttl; + u_int32_t current_serial; int nonempty_lineno = -1, prev_pktdone = 0, cont = 0, inside_next = 0; int id; @@ -481,6 +482,16 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin, *buf = '\0'; n = sscanf(cp, "origin %s class %s serial %lu", origin, sclass, &serial); + if (current_serial == 0) + current_serial = serial; + else if (current_serial != serial) { + ns_debug(ns_log_update, 1, + "%s:line %d serial # askew %d %d", + filename, lineno, serial, + current_serial); + current_serial = serial; + err++; + } if (n != 3 || ns_samename(origin, zp->z_origin) != 1) err++; if (cp) @@ -647,8 +658,9 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin, err++; break; } - if (opcode == ADD && i == 0) + if (opcode == ADD) *new_serial = n; + current_serial = n; PUTLONG(n, cp); for (i = 0; i < 4; i++) { if (!getword(buf, sizeof buf, fp, 1)) { diff --git a/contrib/bind/bin/named/db_load.c b/contrib/bind/bin/named/db_load.c index 0adb7ab..87bdaed 100644 --- a/contrib/bind/bin/named/db_load.c +++ b/contrib/bind/bin/named/db_load.c @@ -1,6 +1,6 @@ #if !defined(lint) && !defined(SABER) static const char sccsid[] = "@(#)db_load.c 4.38 (Berkeley) 3/2/91"; -static const char rcsid[] = "$Id: db_load.c,v 8.110 2001/01/25 05:50:53 marka Exp $"; +static const char rcsid[] = "$Id: db_load.c,v 8.113.2.1 2001/05/03 03:26:48 marka Exp $"; #endif /* not lint */ /* @@ -271,7 +271,7 @@ db_load(const char *filename, const char *in_origin, /* Any updates should be saved before we attempt to reload. */ INSIST((zp->z_flags & (Z_NEED_DUMP|Z_NEED_SOAUPDATE)) == 0); case Z_HINT: - if(filename == NULL) { + if (filename == NULL) { ns_error(ns_log_load, "Required filename not specified for Hint zone"); zp->z_flags |= Z_DB_BAD; @@ -983,6 +983,9 @@ db_load(const char *filename, const char *in_origin, break; case ns_t_nsap: + if (buf[0] != '0' || + (buf[1] != 'x' && buf[1] != 'X')) + ERRTO("NSAP RR: no leading 0x"); n = inet_nsap_addr(buf, (u_char *)data, sizeof data); if (n == 0) @@ -1132,11 +1135,11 @@ db_load(const char *filename, const char *in_origin, } if (errs != 0) { if (errs != -1) - ns_warning(ns_log_load, + ns_error(ns_log_load, "%s zone \"%s\" (%s) rejected due to errors (serial %u)", - zoneTypeString(zp->z_type), - zp->z_origin, - p_class(zp->z_class), zp->z_serial); + zoneTypeString(zp->z_type), + zp->z_origin, + p_class(zp->z_class), zp->z_serial); if ((zp->z_flags & Z_NOTIFY) != 0) ns_stopnotify(zp->z_origin, zp->z_class); do_reload(zp->z_origin, zp->z_type, zp->z_class, @@ -2178,8 +2181,7 @@ parse_sig_rr(char *buf, int buf_len, u_char *data, int data_size, } else { /* Parse and output OTTL; scan TEXP */ origTTL = wordtouint32(buf); - if (origTTL >= 0 || wordtouint32_error || - (origTTL > 0x7fffffff)) + if (wordtouint32_error || (origTTL > 0x7fffffffU)) ERRTO("Original TTL value bad"); cp = &data[i]; PUTLONG(origTTL, cp); @@ -2414,7 +2416,7 @@ parse_cert_rr(char *buf, int buf_len, u_char *data, int data_size, } else { cp = &data[i]; - certlen = b64_pton(buf, (u_char*)cp, sizeof(data) - i); + certlen = b64_pton(buf, (u_char*)cp, data_size - i); if (certlen < 0) ERRTO("CERT blob has encoding error"); } diff --git a/contrib/bind/bin/named/db_update.c b/contrib/bind/bin/named/db_update.c index b765c4d..d742fe9 100644 --- a/contrib/bind/bin/named/db_update.c +++ b/contrib/bind/bin/named/db_update.c @@ -1,6 +1,6 @@ #if !defined(lint) && !defined(SABER) static const char sccsid[] = "@(#)db_update.c 4.28 (Berkeley) 3/21/91"; -static const char rcsid[] = "$Id: db_update.c,v 8.45 2000/12/23 08:14:36 vixie Exp $"; +static const char rcsid[] = "$Id: db_update.c,v 8.46 2001/02/08 02:05:51 marka Exp $"; #endif /* not lint */ /* @@ -140,8 +140,8 @@ isRefByNS(const char *name, struct hashbuf *htp) { * if you start at NS.CRL.. here, you're in the cache * DEC.COM SOA (primary) * CRL.DEC.COM NS (in primary) - * CRL.DEC.COM SOA (secondary) - * CRL.DEC.COM NS (in secondary) + * CRL.DEC.COM SOA (slave) + * CRL.DEC.COM NS (in slave) * if you start at CRL.. here, you find the CRL.DEC.COM zone * if you start at NS.CRL.. here, you're in the CRL.. zone */ @@ -504,7 +504,7 @@ db_update(const char *name, * being served by the same server. * named will send NS records for * sub.a.b.c during zone transfer of - * a.b.c zone. If we're secondary for + * a.b.c zone. If we're slave for * both zones, and we reload zone * a.b.c, we'll get the NS records * (and possibly A records to go with diff --git a/contrib/bind/bin/named/named.h b/contrib/bind/bin/named/named.h index e9e95fa..29a79fa 100644 --- a/contrib/bind/bin/named/named.h +++ b/contrib/bind/bin/named/named.h @@ -16,7 +16,7 @@ */ /* - * $Id: named.h,v 8.27 2000/04/21 06:54:04 vixie Exp $ + * $Id: named.h,v 8.28 2001/02/12 05:56:15 marka Exp $ */ /* Options. Change them at your peril. */ @@ -44,6 +44,7 @@ #define ALLOW_LONG_TXT_RDATA #define STRICT_RFC2308 #undef BIND_ZXFR +#undef LOG_TSIG_BUG #include <isc/assertions.h> #include <isc/list.h> diff --git a/contrib/bind/bin/named/ns_config.c b/contrib/bind/bin/named/ns_config.c index 82b4da6..c4bca96 100644 --- a/contrib/bind/bin/named/ns_config.c +++ b/contrib/bind/bin/named/ns_config.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: ns_config.c,v 8.118 2000/12/23 08:14:37 vixie Exp $"; +static const char rcsid[] = "$Id: ns_config.c,v 8.121 2001/02/08 02:05:53 marka Exp $"; #endif /* not lint */ /* @@ -688,8 +688,7 @@ update_zone_info(struct zoneinfo *zp, struct zoneinfo *new_zp) { zoneinit(zp); else { /* - ** Force secondary to try transfer soon - ** after SIGHUP. + ** Force slave to try transfer soon after SIGHUP. */ if ((zp->z_flags & (Z_QSERIAL|Z_XFER_RUNNING)) == 0 && reloading && !reconfiging) { @@ -1525,25 +1524,43 @@ periodic_getnetconf(evContext ctx, void *uap, struct timespec due, getnetconf(1); } +static int clean_interval = 0; +static int interface_interval = 0; +static int stats_interval = 0; +static int heartbeat_interval = 0; + static void set_interval_timer(int which_timer, int interval) { evTimerID *tid = NULL; evTimerFunc func = NULL; + int changed = 0; switch (which_timer) { case CLEAN_TIMER: + if (clean_interval != interval) + changed = 1; + clean_interval = interval; tid = &clean_timer; func = ns_cleancache; break; case INTERFACE_TIMER: + if (interface_interval != interval) + changed = 1; + interface_interval = interval; tid = &interface_timer; func = periodic_getnetconf; break; case STATS_TIMER: + if (stats_interval != interval) + changed = 1; + stats_interval = interval; tid = &stats_timer; func = ns_logstats; break; case HEARTBEAT_TIMER: + if (heartbeat_interval != interval) + changed = 1; + heartbeat_interval = interval; tid = &heartbeat_timer; func = ns_heartbeat; break; @@ -1553,7 +1570,8 @@ set_interval_timer(int which_timer, int interval) { } if ((active_timers & which_timer) != 0) { if (interval > 0) { - if (evResetTimer(ev, *tid, func, NULL, + if (changed && + evResetTimer(ev, *tid, func, NULL, evAddTime(evNowTime(), evConsTime(interval, 0)), evConsTime(interval, 0)) < 0) @@ -2259,41 +2277,59 @@ static struct fwddata * find_forwarder(struct in_addr address) { struct fwddata *fdp; + struct fwddata **fdpp = NULL; struct databuf *ns, *nsdata; register int i; - for (i=0;i<fwddata_count; i++) { - fdp=fwddata[i]; - if (memcmp(&fdp->fwdaddr.sin_addr,&address,sizeof(address))==0) { + for (i = 0; i < fwddata_count; i++) { + fdp = fwddata[i]; + if (fdp == NULL) { + if (fdpp == NULL) + fdpp = &fwddata[i]; + continue; + } + if (memcmp(&fdp->fwdaddr.sin_addr, &address, + sizeof(address)) == 0) { fdp->ref_count++; - return fdp; + return (fdp); } } fdp = (struct fwddata *)memget(sizeof(struct fwddata)); if (!fdp) panic("memget failed in find_forwarder", NULL); + fdp->fwdaddr.sin_family = AF_INET; fdp->fwdaddr.sin_addr = address; fdp->fwdaddr.sin_port = ns_port; + ns = fdp->ns = (struct databuf *)memget(sizeof(*ns)); if (!ns) panic("memget failed in find_forwarder", NULL); - memset(ns,0,sizeof(*ns)); + memset(ns, 0, sizeof(*ns)); + nsdata = fdp->nsdata = (struct databuf *)memget(sizeof(*nsdata)); if (!nsdata) panic("memget failed in find_forwarder", NULL); - memset(nsdata,0,sizeof(*nsdata)); + memset(nsdata, 0, sizeof(*nsdata)); + ns->d_type = T_NS; ns->d_class = C_IN; - ns->d_rcnt=1; + ns->d_rcnt = 1; + nsdata->d_type = T_A; nsdata->d_class = C_IN; nsdata->d_nstime = 1 + (int)(25.0*rand()/(RAND_MAX + 1.0)); - nsdata->d_rcnt=1; - fdp->ref_count=1; + nsdata->d_rcnt = 1; + + fdp->ref_count = 1; + + if (fdpp != NULL) { + *fdpp = fdp; + return (fdp); + } - i=0; + i = 0; if (fwddata == NULL) { fwddata = memget(sizeof *fwddata); if (fwddata == NULL) @@ -2301,6 +2337,7 @@ find_forwarder(struct in_addr address) } else { register size_t size; register struct fwddata **an_tmp; + size = fwddata_count * sizeof *fwddata; an_tmp = memget(size + sizeof *fwddata); if (an_tmp == NULL) { @@ -2316,13 +2353,13 @@ find_forwarder(struct in_addr address) fwddata[fwddata_count] = fdp; fwddata_count++; } else { - ns_warning(ns_log_config, - "forwarder add failed (memget) [%s]", - inet_ntoa(address)); + ns_warning(ns_log_config, "forwarder add failed (memget) [%s]", + inet_ntoa(address)); } - return fdp; + return (fdp); } + /* * Forwarder glue * @@ -2460,14 +2497,20 @@ add_zone_forwarder(zone_config zh, struct in_addr address) { void free_forwarders(struct fwdinfo *fwdtab) { struct fwdinfo *ftp, *fnext; + int i; for (ftp = fwdtab; ftp != NULL; ftp = fnext) { fnext = ftp->next; - if (!--ftp->fwddata->ref_count) { + if (--ftp->fwddata->ref_count == 0) { + for (i = 0 ; i < fwddata_count; i++) + if (fwddata[i] == ftp->fwddata) { + fwddata[i] = NULL; + break; + } memput(ftp->fwddata->ns, sizeof *ftp->fwddata->ns); memput(ftp->fwddata->nsdata, sizeof *ftp->fwddata->nsdata); - memput(ftp->fwddata,sizeof *ftp->fwddata); + memput(ftp->fwddata, sizeof *ftp->fwddata); } memput(ftp, sizeof *ftp); } diff --git a/contrib/bind/bin/named/ns_defs.h b/contrib/bind/bin/named/ns_defs.h index 8d480f2..64aecce 100644 --- a/contrib/bind/bin/named/ns_defs.h +++ b/contrib/bind/bin/named/ns_defs.h @@ -1,6 +1,6 @@ /* * from ns.h 4.33 (Berkeley) 8/23/90 - * $Id: ns_defs.h,v 8.102 2000/12/01 05:35:48 vixie Exp $ + * $Id: ns_defs.h,v 8.105 2001/04/01 22:41:24 marka Exp $ */ /* @@ -113,7 +113,8 @@ * dies out in a little more than a minute. * (sequence RETRYBASE, 2*RETRYBASE, 4*RETRYBASE... for MAXRETRY) */ -#define NEWZONES 64 /* must be a power of two. */ +#define NEWZONES 64 /* how many zones to grow the zone table by */ +#define INITIALZONES NEWZONES /* how many zones are allocated initially */ #define MINROOTS 2 /* min number of root hints */ #define NSMAX 16 /* max number of NS addrs to try ([0..255]) */ #define RETRYBASE 4 /* base time between retries */ @@ -123,7 +124,7 @@ #define MAXQUERIES 20 /* max # of queries to be made */ #define MAXQSERIAL 4 /* max # of outstanding QSERIAL's */ /* (prevent "recursive" loops) */ -#define INIT_REFRESH 600 /* retry time for initial secondary */ +#define INIT_REFRESH 600 /* retry time for initial slave */ /* contact (10 minutes) */ #define MIN_REFRESH 2 /* never refresh more frequently than once */ /* every MIN_REFRESH seconds */ @@ -420,6 +421,7 @@ enum zonetype { z_nil, z_master, z_slave, z_hint, z_stub, z_forward, #define Z_PARENT_RELOAD 0x00040000 /* we need to reload this as parent */ #define Z_FORWARD_SET 0x00080000 /* has forwarders been set */ #define Z_EXPIRED 0x00100000 /* expire timer has gone off */ +#define Z_NEEDREFRESH 0x00200000 /* need to perform a refresh check */ /* named_xfer exit codes */ #define XFER_UPTODATE 0 /* zone is up-to-date */ diff --git a/contrib/bind/bin/named/ns_func.h b/contrib/bind/bin/named/ns_func.h index ca30823..ef9780f 100644 --- a/contrib/bind/bin/named/ns_func.h +++ b/contrib/bind/bin/named/ns_func.h @@ -90,7 +90,7 @@ /* ns_func.h - declarations for ns_*.c's externally visible functions * - * $Id: ns_func.h,v 8.104 2001/01/25 05:50:54 marka Exp $ + * $Id: ns_func.h,v 8.105 2001/02/16 04:46:12 marka Exp $ */ /* ++from ns_glue.c++ */ @@ -102,6 +102,7 @@ void ns_info(int, const char *, ...); void ns_notice(int, const char *, ...); void ns_warning(int, const char *, ...); void ns_error(int, const char *, ...); +void ns_critical(int, const char *, ...); void ns_panic(int, int, const char *, ...); void ns_assertion_failed(char *file, int line, assertion_type type, char *cond, diff --git a/contrib/bind/bin/named/ns_glue.c b/contrib/bind/bin/named/ns_glue.c index c1f9be2..a4bd0f1 100644 --- a/contrib/bind/bin/named/ns_glue.c +++ b/contrib/bind/bin/named/ns_glue.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: ns_glue.c,v 8.18 2000/11/08 06:16:36 marka Exp $"; +static const char rcsid[] = "$Id: ns_glue.c,v 8.20 2001/02/16 04:46:14 marka Exp $"; #endif /* not lint */ /* @@ -150,6 +150,17 @@ ns_error(int category, const char *format, ...) { } void +ns_critical(int category, const char *format, ...) { + va_list args; + + if (!log_ctx_valid) + return; + va_start(args, format); + log_vwrite(log_ctx, category, log_critical, format, args); + va_end(args); +} + +void ns_panic(int category, int dump_core, const char *format, ...) { va_list args; @@ -252,7 +263,6 @@ void gettime(struct timeval *ttp) { if (gettimeofday(ttp, NULL) < 0) ns_error(ns_log_default, "gettimeofday: %s", strerror(errno)); - INSIST(ttp->tv_usec >= 0 && ttp->tv_usec < 1000000); } /* diff --git a/contrib/bind/bin/named/ns_init.c b/contrib/bind/bin/named/ns_init.c index c5842f6..553f047 100644 --- a/contrib/bind/bin/named/ns_init.c +++ b/contrib/bind/bin/named/ns_init.c @@ -1,6 +1,6 @@ #if !defined(lint) && !defined(SABER) static const char sccsid[] = "@(#)ns_init.c 4.38 (Berkeley) 3/21/91"; -static const char rcsid[] = "$Id: ns_init.c,v 8.70 2000/12/23 08:14:38 vixie Exp $"; +static const char rcsid[] = "$Id: ns_init.c,v 8.73 2001/04/20 00:21:40 vixie Exp $"; #endif /* not lint */ /* @@ -118,7 +118,11 @@ ns_refreshtime(struct zoneinfo *zp, time_t timebase) { u_long refresh = (zp->z_refresh > 0) ? zp->z_refresh : INIT_REFRESH; time_t half = (refresh + 1) / 2; - zp->z_time = timebase + half + (rand() % half); + if (zp->z_flags & Z_NEEDREFRESH) { + zp->z_flags &= ~Z_NEEDREFRESH; + zp->z_time = timebase; + } else + zp->z_time = timebase + half + (rand() % half); } /* @@ -126,6 +130,8 @@ ns_refreshtime(struct zoneinfo *zp, time_t timebase) { */ void ns_retrytime(struct zoneinfo *zp, time_t timebase) { + + zp->z_flags &= ~Z_NEEDREFRESH; zp->z_time = timebase + zp->z_retry; } @@ -469,35 +475,34 @@ ns_nameok(const struct qinfo *qry, const char *name, int class, s = newstr(strlen(transport_strings[transport]) + sizeof " from [000.000.000.000] for [000.000.000.000]", 0); if (s != NULL) { - if ( (transport == response_trans) && - (qry != NULL) ) { - - if ( qry->q_flags & Q_PRIMING ) { - sprintf(s, "%s from [%s] for priming", - transport_strings[transport], - inet_ntoa(source)); - } else if ( qry->q_flags & Q_ZSERIAL ) { - sprintf(s, "%s from [%s] for soacheck", - transport_strings[transport], - inet_ntoa(source)); - } else if ( qry->q_flags & Q_SYSTEM ) { - sprintf(s, "%s from [%s] for sysquery", - transport_strings[transport], - inet_ntoa(source)); + if (transport == response_trans && qry != NULL) { + if ((qry->q_flags & Q_PRIMING) != 0) { + sprintf(s, "%s from [%s] for priming", + transport_strings[transport], + inet_ntoa(source)); + } else if ((qry->q_flags & Q_ZSERIAL) != 0) { + sprintf(s, "%s from [%s] for soacheck", + transport_strings[transport], + inet_ntoa(source)); + } else if ((qry->q_flags & Q_SYSTEM) != 0) { + sprintf(s, "%s from [%s] for sysquery", + transport_strings[transport], + inet_ntoa(source)); } else { - q=strdup(inet_ntoa(qry->q_from.sin_addr)); - sprintf(s, "%s from [%s] for [%s]", - transport_strings[transport], - inet_ntoa(source), - q != NULL ? q : "memget failed"); - free(q); - } - - } else { - sprintf(s, "%s from [%s]", - transport_strings[transport], - inet_ntoa(source)); + q=strdup(inet_ntoa(qry->q_from.sin_addr)); + sprintf(s, "%s from [%s] for [%s]", + transport_strings[transport], + inet_ntoa(source), + q != NULL ? q : "memget failed"); + free(q); } + } else { + sprintf(s, "%s from [%s]", + (transport == response_trans) + ? "query" + : transport_strings[transport], + inet_ntoa(source)); + } } } if (ns_samename(owner, name) == 1) diff --git a/contrib/bind/bin/named/ns_ixfr.c b/contrib/bind/bin/named/ns_ixfr.c index 5dd438b..b54a275 100644 --- a/contrib/bind/bin/named/ns_ixfr.c +++ b/contrib/bind/bin/named/ns_ixfr.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: ns_ixfr.c,v 8.25 2000/12/27 06:56:03 vixie Exp $"; +static const char rcsid[] = "$Id: ns_ixfr.c,v 8.26 2001/03/12 01:48:58 marka Exp $"; #endif /* not lint */ /* @@ -411,7 +411,8 @@ ixfr_log_maint(struct zoneinfo *zp) { int error = 0; long seek = 0; FILE *to_fp, *from_fp, *db_fp; - static char *tmpname; + char *tmpname; + int len; struct stat db_sb; struct stat sb; static char buf[MAXBSIZE]; @@ -474,7 +475,8 @@ ixfr_log_maint(struct zoneinfo *zp) { return (-1); } - tmpname = memget(strlen(zp->z_ixfr_base) + sizeof(".XXXXXX") + 1); + len = strlen(zp->z_ixfr_base) + sizeof(".XXXXXX") + 1; + tmpname = memget(len); if (!tmpname) { ns_warning(ns_log_default, "memget failed"); return (-1); @@ -489,14 +491,16 @@ ixfr_log_maint(struct zoneinfo *zp) { if ((fd = mkstemp(tmpname)) == -1) { ns_warning(ns_log_db, "can't make tmpfile (%s): %s", strerror(errno)); - memput(tmpname, (strlen(zp->z_ixfr_base) + sizeof(".XXXXXX") + 1)); + memput(tmpname, len); + (void) my_fclose(from_fp); return (-1); } if ((to_fp = fdopen(fd, "r+")) == NULL) { ns_warning(ns_log_db, "%s: %s", tmpname, strerror(errno)); (void) unlink(tmpname); - memput(tmpname, (strlen(zp->z_ixfr_base) + sizeof(".XXXXXX") + 1)); + memput(tmpname, len); + (void) my_fclose(from_fp); (void) close(fd); return (-1); } @@ -539,7 +543,8 @@ ixfr_log_maint(struct zoneinfo *zp) { while ((rcount = fread(buf, sizeof(char), MAXBSIZE, from_fp)) > 0) { wcount = fwrite(buf, sizeof(char), rcount, to_fp); if (rcount != wcount || wcount == -1) { - ns_warning(ns_log_default, "ixfr_log_maint: error in writting copy"); + ns_warning(ns_log_default, + "ixfr_log_maint: error in writting copy"); break; } } @@ -549,7 +554,6 @@ ixfr_log_maint(struct zoneinfo *zp) { } clean_up: (void) my_fclose(to_fp); - (void) close(fd); (void) my_fclose(from_fp); if (error == 0) { if (isc_movefile(tmpname, zp->z_ixfr_base) == -1) { @@ -559,11 +563,13 @@ ixfr_log_maint(struct zoneinfo *zp) { if ((from_fp = fopen(zp->z_ixfr_base, "r")) == NULL) { ns_warning(ns_log_db, "%s: %s", zp->z_ixfr_base, strerror(errno)); + memput(tmpname, len); return (-1); } if (fstat(fileno(from_fp), &sb) < 0) { ns_warning(ns_log_db, "%s: %s", zp->z_ixfr_base, strerror(errno)); + memput(tmpname, len); (void) my_fclose(from_fp); return (-1); } @@ -574,10 +580,10 @@ ixfr_log_maint(struct zoneinfo *zp) { "chmod(%s,%o) failed, pressing on: %s", zp->z_source, sb.st_mode, strerror(errno)); + (void) my_fclose(from_fp); } (void) unlink(tmpname); - memput(tmpname, (strlen(zp->z_ixfr_base) + sizeof(".XXXXXX") + 1)); - (void) my_fclose(from_fp); + memput(tmpname, len); zp->z_serial_ixfr_start = 0; /* signal to read for lowest serial number */ diff --git a/contrib/bind/bin/named/ns_main.c b/contrib/bind/bin/named/ns_main.c index 5caaae9..1d7bfe8 100644 --- a/contrib/bind/bin/named/ns_main.c +++ b/contrib/bind/bin/named/ns_main.c @@ -1,6 +1,6 @@ #if !defined(lint) && !defined(SABER) static const char sccsid[] = "@(#)ns_main.c 4.55 (Berkeley) 7/1/91"; -static const char rcsid[] = "$Id: ns_main.c,v 8.142 2001/01/15 20:06:25 vixie Exp $"; +static const char rcsid[] = "$Id: ns_main.c,v 8.145 2001/03/16 12:07:57 marka Exp $"; #endif /* not lint */ /* @@ -570,6 +570,31 @@ main(int argc, char *argv[], char *envp[]) { return (0); } +static int +ns_socket(int domain, int type, int protocol) { + int fd; + + fd = socket(domain, type, protocol); + if (fd == -1) + return (-1); +#ifdef F_DUPFD /* XXX */ + /* + * Leave a space for stdio to work in. + */ + if (fd >= 0 && fd <= 20) { + int new, tmp; + if ((new = fcntl(fd, F_DUPFD, 20)) == -1) + ns_notice(ns_log_default, "fcntl(fd, F_DUPFD, 20): %s", + strerror(errno)); + tmp = errno; + close(fd); + errno = tmp; + fd = new; + } +#endif + return (fd); +} + #ifndef IP_OPT_BUF_SIZE /* arbitrary size */ #define IP_OPT_BUF_SIZE 50 @@ -595,6 +620,24 @@ stream_accept(evContext lev, void *uap, int rfd, INSIST(ifp != NULL); +#ifdef F_DUPFD + /* + * Leave a space for stdio to work in. + */ + if (rfd >= 0 && rfd <= 20) { + int new, tmp; + new = fcntl(rfd, F_DUPFD, 20); + tmp = errno; + if (new == -1) + ns_notice(ns_log_default, + "fcntl(rfd, F_DUPFD, 20): %s", + strerror(errno)); + close(rfd); + errno = tmp; + rfd = new; + } +#endif + if (rfd < 0) { switch (errno) { case EINTR: @@ -751,13 +794,14 @@ stream_accept(evContext lev, void *uap, int rfd, int tcp_send(struct qinfo *qp) { struct qstream *sp; + struct sockaddr_in src; int on = 1, n; ns_debug(ns_log_default, 1, "tcp_send"); if ((sp = sq_add()) == NULL) { return (SERVFAIL); } - if ((sp->s_rfd = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == -1) { + if ((sp->s_rfd = ns_socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == -1) { sq_remove(sp); return (SERVFAIL); } @@ -777,8 +821,9 @@ tcp_send(struct qinfo *qp) { "tcp_send: setsockopt(SO_REUSEPORT): %s", strerror(errno)); #endif - if (bind(sp->s_rfd, (struct sockaddr *)&server_options->query_source, - sizeof server_options->query_source) < 0) + src = server_options->query_source; + src.sin_port = htons(0); + if (bind(sp->s_rfd, (struct sockaddr *)&src, sizeof(src)) < 0) ns_info(ns_log_default, "tcp_send: bind(query_source): %s", strerror(errno)); if (fcntl(sp->s_rfd, F_SETFD, 1) < 0) { @@ -1454,7 +1499,7 @@ opensocket_d(interface *ifp) { nsa.sin_addr = ifp->addr; nsa.sin_port = ifp->port; - if ((ifp->dfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + if ((ifp->dfd = ns_socket(AF_INET, SOCK_DGRAM, 0)) < 0) { ns_error(ns_log_default, "socket(SOCK_DGRAM): %s", strerror(errno)); return (-1); @@ -1476,17 +1521,6 @@ opensocket_d(interface *ifp) { (void) close(ifp->dfd); return (-1); } -#ifdef F_DUPFD /* XXX */ - /* - * Leave a space for stdio to work in. - */ - if ((fd = fcntl(ifp->dfd, F_DUPFD, 20)) != -1) { - close(ifp->dfd); - ifp->dfd = fd; - } else - ns_notice(ns_log_default, "fcntl(dfd, F_DUPFD, 20): %s", - strerror(errno)); -#endif if (fcntl(ifp->dfd, F_SETFD, 1) < 0) { ns_error(ns_log_default, "F_SETFD: %s", strerror(errno)); close(ifp->dfd); @@ -1633,7 +1667,7 @@ opensocket_s(interface *ifp) { */ n = 0; again: - if ((ifp->sfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + if ((ifp->sfd = ns_socket(AF_INET, SOCK_STREAM, 0)) < 0) { ns_error(ns_log_default, "socket(SOCK_STREAM): %s", strerror(errno)); return (-1); @@ -1643,17 +1677,6 @@ opensocket_s(interface *ifp) { close(ifp->sfd); return (-1); } -#ifdef F_DUPFD /* XXX */ - /* - * Leave a space for stdio to work in. - */ - if ((fd = fcntl(ifp->sfd, F_DUPFD, 20)) != -1) { - close(ifp->sfd); - ifp->sfd = fd; - } else - ns_notice(ns_log_default, "fcntl(sfd, F_DUPFD, 20): %s", - strerror(errno)); -#endif if (fcntl(ifp->sfd, F_SETFD, 1) < 0) { ns_error(ns_log_default, "F_SETFD: %s", strerror(errno)); close(ifp->sfd); diff --git a/contrib/bind/bin/named/ns_maint.c b/contrib/bind/bin/named/ns_maint.c index b5ed644..d8e41dc 100644 --- a/contrib/bind/bin/named/ns_maint.c +++ b/contrib/bind/bin/named/ns_maint.c @@ -1,6 +1,6 @@ #if !defined(lint) && !defined(SABER) static const char sccsid[] = "@(#)ns_maint.c 4.39 (Berkeley) 3/2/91"; -static const char rcsid[] = "$Id: ns_maint.c,v 8.117 2001/01/25 05:50:55 marka Exp $"; +static const char rcsid[] = "$Id: ns_maint.c,v 8.122 2001/03/01 06:26:31 marka Exp $"; #endif /* not lint */ /* @@ -926,6 +926,7 @@ startxfer(struct zoneinfo *zp) { zp->z_flags |= Z_XFER_RUNNING; zp->z_xferpid = pid; xfers_running++; + xfers_deferred--; if (zp->z_max_transfer_time_in) zp->z_time = tt.tv_sec + zp->z_max_transfer_time_in; else @@ -1172,6 +1173,10 @@ remove_zone(struct zoneinfo *zp, const char *verb) { #endif if ((zp->z_flags & Z_NOTIFY) != 0) ns_stopnotify(zp->z_origin, zp->z_class); + if ((zp->z_flags & Z_NEED_XFER) != 0) { + zp->z_flags &= ~Z_NEED_XFER; + xfers_deferred--; + } ns_stopxfrs(zp); do_reload(zp->z_origin, zp->z_type, zp->z_class, 1); ns_notice(ns_log_config, "%s zone \"%s\" (%s) %s", @@ -1278,7 +1283,7 @@ purge_nonglue_2(const char *dname, struct hashbuf *htp, int class, zonecut && !valid_glue(dp, name, belowcut)) { if (log) - ns_error(ns_log_db, + ns_error(ns_log_load, "zone: %s/%s: non-glue record %s bottom of zone: %s/%s", *dname ? dname : ".", p_class(dp->d_class), @@ -1599,7 +1604,6 @@ endxfer() { break; case XFER_SUCCESSIXFR: - zp->z_flags |= Z_XFER_RUNNING; zp->z_xferpid = XFER_ISIXFR; ns_notice(ns_log_default, "IXFR Success %s", @@ -1624,8 +1628,6 @@ endxfer() { ns_notice(ns_log_default, "IXFR Merge failed %s", zp->z_ixfr_tmp); - zp->z_flags &= - ~(Z_XFER_RUNNING|Z_XFER_ABORTED|Z_XFER_GONE); ns_retrytime(zp, tt.tv_sec); sched_zone_maint(zp); } @@ -1635,7 +1637,7 @@ endxfer() { if (!(zp->z_flags & Z_SYSLOGGED)) { zp->z_flags |= Z_SYSLOGGED; ns_notice(ns_log_default, - "zoneref: Masters for secondary zone \"%s\" unreachable", + "zoneref: Masters for slave zone \"%s\" unreachable", zp->z_origin); } ns_retrytime(zp, tt.tv_sec); @@ -1712,7 +1714,6 @@ tryxfer() { if ((xfers = nxfers(zp)) != -1 && xfers < server_options->transfers_per_ns && (zp->z_flags & Z_NEED_XFER)) { - xfers_deferred--; startxfer(zp); sched_zone_maint(zp); } @@ -1912,7 +1913,7 @@ ns_reload(void) { INSIST(reloading == 0); qflush(); sq_flush(NULL); - reloading++; /* To force transfer if secondary and backing up. */ + reloading++; /* To force transfer if slave and backing up. */ confmtime = ns_init(conffile); time(&resettime); reloading--; @@ -1946,20 +1947,21 @@ void make_new_zones(void) { struct zoneinfo *zp; int n; + int newzones = (nzones == 0) ? INITIALZONES : NEWZONES; ns_debug(ns_log_config, 1, "Adding %d template zones", NEWZONES); zp = (struct zoneinfo *) - memget((nzones + NEWZONES) * sizeof(struct zoneinfo)); + memget((nzones + newzones) * sizeof(struct zoneinfo)); if (zp == NULL) panic("no memory for more zones", NULL); - memset(zp, 0, (nzones + NEWZONES) * sizeof(struct zoneinfo)); + memset(zp, 0, (nzones + newzones) * sizeof(struct zoneinfo)); if (zones != NULL) { memcpy(zp, zones, nzones * sizeof(struct zoneinfo)); memput(zones, nzones * sizeof(struct zoneinfo)); } zones = zp; block_signals(); - for (n = 0; n < NEWZONES; n++) { + for (n = 0; n < newzones; n++) { INIT_LINK(&zones[nzones], z_reloadlink); INIT_LINK(&zones[nzones], z_freelink); if (nzones != 0) diff --git a/contrib/bind/bin/named/ns_notify.c b/contrib/bind/bin/named/ns_notify.c index 4523422..20fd700 100644 --- a/contrib/bind/bin/named/ns_notify.c +++ b/contrib/bind/bin/named/ns_notify.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: ns_notify.c,v 8.12 2000/12/23 08:14:40 vixie Exp $"; +static const char rcsid[] = "$Id: ns_notify.c,v 8.14 2001/04/01 18:38:36 vixie Exp $"; #endif /* not lint */ /* @@ -138,7 +138,7 @@ ns_notify(const char *dname, ns_class class, ns_type type) { } /* Delay notification for from five seconds up to fifteen minutes. */ - max_delay = MIN(nzones/5, 895); + max_delay = MIN(nzones, 895); max_delay = MAX(max_delay, 25); delay = 5 + (rand() % max_delay); if (evSetTimer(ev, notify_timer, ni, @@ -352,6 +352,7 @@ sysnotify_ns(const char *dname, const char *aname, struct in_addr nss[NSMAX]; struct hashbuf *htp; int is_us, nsc; + int cname = 0; htp = hashtab; anp = nlookup(aname, &htp, &fname, 0); @@ -361,6 +362,15 @@ sysnotify_ns(const char *dname, const char *aname, for (adp = anp->n_data; adp; adp = adp->d_next) { struct in_addr ina; + if (match(adp, class, T_CNAME)) { + cname = 1; + ns_error(ns_log_notify, + "NS '%s' for '%s/%s' is a CNAME", + *aname ? aname : ".", + *dname ? dname : ".", + p_class(class)); + break; + } if (!match(adp, class, T_A)) continue; if (adp->d_type == ns_t_sig) @@ -374,7 +384,7 @@ sysnotify_ns(const char *dname, const char *aname, nss[nsc++] = ina; } /*next A*/ if (nsc == 0) { - if (!is_us && !NS_OPTION_P(OPTION_NOFETCHGLUE)) { + if (!is_us && !cname && !NS_OPTION_P(OPTION_NOFETCHGLUE)) { struct qinfo *qp; qp = sysquery(aname, class, ns_t_a, 0, 0, ns_port, diff --git a/contrib/bind/bin/named/ns_parser.y b/contrib/bind/bin/named/ns_parser.y index 680a586..ed49549 100644 --- a/contrib/bind/bin/named/ns_parser.y +++ b/contrib/bind/bin/named/ns_parser.y @@ -1,6 +1,6 @@ %{ #if !defined(lint) && !defined(SABER) -static char rcsid[] = "$Id: ns_parser.y,v 8.63 2000/12/23 08:14:41 vixie Exp $"; +static char rcsid[] = "$Id: ns_parser.y,v 8.63.2.4 2001/04/30 08:03:02 marka Exp $"; #endif /* not lint */ /* @@ -265,7 +265,11 @@ statement: include_stmt | error L_END_INCLUDE ; -include_stmt: T_INCLUDE L_QSTRING L_EOS { lexer_begin_file($2, NULL); } +include_stmt: T_INCLUDE L_QSTRING L_EOS + { + lexer_begin_file($2, NULL); + freestr($2); + } ; /* @@ -601,6 +605,7 @@ control: /* Empty */ #ifndef NO_SOCKADDR_UN ns_ctl_add(¤t_controls, ns_ctl_new_unix($2, $4, $6, $8)); #endif + freestr($2); } | error ; @@ -1273,6 +1278,7 @@ address_match_element: address_match_simple } else $$ = new_ip_match_key(dst_key); + (void)freestr(key_name); } ; @@ -1399,13 +1405,11 @@ key_stmt: T_SEC_KEY $3); } else if (lookup_key(key_name) != NULL) { parser_error(0, "can't redefine key '%s'", key_name); - freestr(key_name); } else { if (current_algorithm == NULL || current_secret == NULL) { parser_error(0, "skipping bad key '%s'", key_name); - freestr(key_name); } else { dst_key = new_key_info(key_name, current_algorithm, @@ -1420,6 +1424,15 @@ key_stmt: T_SEC_KEY } } } + if (key_name != NULL) + freestr(key_name); + key_name = NULL; + if (current_algorithm != NULL) + freestr(current_algorithm); + current_algorithm = NULL; + if (current_secret != NULL) + freestr(current_secret); + current_secret = NULL; freestr($3); } ; diff --git a/contrib/bind/bin/named/ns_req.c b/contrib/bind/bin/named/ns_req.c index f103ad6..671b31e 100644 --- a/contrib/bind/bin/named/ns_req.c +++ b/contrib/bind/bin/named/ns_req.c @@ -1,6 +1,6 @@ #if !defined(lint) && !defined(SABER) static const char sccsid[] = "@(#)ns_req.c 4.47 (Berkeley) 7/1/91"; -static const char rcsid[] = "$Id: ns_req.c,v 8.129 2001/01/08 23:46:41 marka Exp $"; +static const char rcsid[] = "$Id: ns_req.c,v 8.138.2.1 2001/04/27 07:44:05 marka Exp $"; #endif /* not lint */ /* @@ -204,16 +204,26 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp, ns_debug(ns_log_default, 1, "ns_req: bad TSIG key name", buf); + error = ns_r_formerr; + hp->rcode = ns_r_formerr; key = NULL; - } - key = find_key(buf, NULL); - if (key == NULL) { + } else if ((key = find_key(buf, NULL)) == NULL) { error = ns_r_badkey; hp->rcode = ns_r_notauth; ns_debug(ns_log_default, 1, "ns_req: TSIG verify failed - unknown key %s", buf); } +#ifdef LOG_TSIG_BUG + if (n < 0 || key == NULL) + ns_error(ns_log_security, + "SECURITY: POSSIBLE ATTEMPT TO EXERCISE \"TSIG BUG\" FROM %s: %s%s%s", + sin_ntoa(from), + (n < 0) ? "bad key (formerr)" : + "unknown key (", + (n < 0) ? "" : (buf[0] != '\0' ? buf : "."), + (n < 0) ? "" : ")"); +#endif } if (has_tsig && key != NULL) { n = ns_verify(msg, &msglen, key, NULL, 0, sig, &siglen, @@ -419,10 +429,12 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp, } #ifdef DEBUG - ns_debug(ns_log_default, 1, - "ns_req: answer -> %s fd=%d id=%d size=%d rc=%d", - sin_ntoa(from), (qsp == NULL) ? dfd : qsp->s_rfd, - ntohs(hp->id), cp - msg, hp->rcode); + if (ns_wouldlog(ns_log_default, 1)) { + ns_debug(ns_log_default, 1, + "ns_req: answer -> %s fd=%d id=%d size=%d rc=%d", + sin_ntoa(from), (qsp == NULL) ? dfd : qsp->s_rfd, + ntohs(hp->id), cp - msg, hp->rcode); + } if (debug >= 10) res_pquery(&res, msg, cp - msg, log_get_stream(packet_channel)); @@ -512,6 +524,13 @@ req_notify(HEADER *hp, u_char **cpp, u_char *eom, u_char *msg, /* XXX - when answers are allowed, we'll need to do compression * correctly here, and we will need to check for packet underflow. */ + /* + * We are ignoring the other field, make sure the header reflects + * *cpp. + */ + hp->ancount = htons(0); + hp->nscount = htons(0); + hp->arcount = htons(0); /* Find the zone this NOTIFY refers to. */ zp = find_auth_zone(dnbuf, class); if (zp == NULL) { @@ -536,7 +555,7 @@ req_notify(HEADER *hp, u_char **cpp, u_char *eom, u_char *msg, * AXFR from you. */ ns_info(ns_log_notify, - "NOTIFY(SOA) for non-secondary name (%s), from %s", + "NOTIFY(SOA) for non-slave zone (%s), from %s", dnbuf, sin_ntoa(from)); goto refuse; } @@ -565,6 +584,7 @@ req_notify(HEADER *hp, u_char **cpp, u_char *eom, u_char *msg, ns_info(ns_log_notify, "NOTIFY(SOA) for zone already xferring (%s)", dnbuf); + zp->z_flags |= Z_NEEDREFRESH; goto noerror; } zp->z_time = tt.tv_sec; @@ -804,6 +824,19 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp, #endif /*YPKLUDGE*/ /* + * Don't accept in a query names which would be rejected in responses. + * (This is primarily in case we have to forward it, but it's also a + * matter of architectural symmetry.) + */ + if (!ns_nameok(NULL, dname, class, NULL, response_trans, + ns_ownercontext(type, response_trans), + dname, from.sin_addr)) { + ns_debug(ns_log_default, 1, "bad name in query"); + hp->rcode = ns_r_formerr; + return (Refuse); + } + + /* * Begin Access Control Point */ @@ -929,8 +962,9 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp, } } ns_notice(ns_log_security, - "denied query from %s for \"%s\"", - sin_ntoa(from), *dname ? dname : "."); + "denied query from %s for \"%s\" %s", + sin_ntoa(from), *dname ? dname : ".", + p_class(class)); nameserIncr(from.sin_addr, nssRcvdUQ); return (Refuse); } @@ -949,9 +983,9 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp, in_key)) { ns_notice(ns_log_security, - "denied %s from %s for \"%s\" (acl)", + "denied %s from %s for \"%s\" %s (acl)", p_type(type), sin_ntoa(from), - *dname ? dname : "."); + *dname ? dname : ".", p_class(class)); nameserIncr(from.sin_addr, nssRcvdUXFR); if (type == ns_t_ixfr) { hp->rcode = ns_r_refused; @@ -979,9 +1013,9 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp, if ((zp->z_flags & Z_AUTH) == 0) { ns_notice(ns_log_security, - "denied %s from %s for \"%s\" (not authoritative)", + "denied %s from %s for \"%s\" %s (not authoritative)", p_type(type), sin_ntoa(from), - *dname ? dname : "."); + *dname ? dname : ".", p_class(class)); nameserIncr(from.sin_addr, nssRcvdUXFR); if (type == ns_t_ixfr) { hp->rcode = ns_r_refused; @@ -994,9 +1028,9 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp, if (ns_samename(zp->z_origin, dname) != 1) { ns_notice(ns_log_security, - "denied %s from %s for \"%s\" (not zone top)", + "denied %s from %s for \"%s\" %s (not zone top)", p_type(type), sin_ntoa(from), - *dname ? dname : "."); + *dname ? dname : ".", p_class(class)); nameserIncr(from.sin_addr, nssRcvdUXFR); if (type == ns_t_ixfr) { hp->rcode = ns_r_refused; @@ -1271,8 +1305,8 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp, if (!founddata && hp->rd && recursion_blocked_by_acl) { ns_notice(ns_log_security, - "denied recursion for query from %s for %s", - sin_ntoa(from), *dname ? dname : "."); + "denied recursion for query from %s for %s %s", + sin_ntoa(from), *dname ? dname : ".", p_class(class)); nameserIncr(from.sin_addr, nssRcvdURQ); } @@ -1333,6 +1367,7 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp, ns_info(ns_log_default, "res_mkquery(%s) failed", dname); hp->rcode = ns_r_servfail; + memput(omsg, omsglen); free_nsp(nsp); return (Finish); } @@ -1350,6 +1385,7 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp, qp->q_cname = cname; qp->q_cmsg = omsg; qp->q_cmsglen = omsglen; + qp->q_cmsgsize = omsglen; qp->q_id = id; } break; @@ -1557,7 +1593,7 @@ stale(struct databuf *dp) { #endif case z_slave: /* - * Check to see whether a secondary zone has expired or + * Check to see whether a slave zone has expired or * time warped; if so clear authority flag for zone, * schedule the zone for immediate maintenance, and * return true. @@ -1569,7 +1605,7 @@ stale(struct databuf *dp) { zp->z_origin); if (!haveComplained((u_long)zp, (u_long)stale)) { ns_notice(ns_log_default, - "secondary zone \"%s\" expired", + "slave zone \"%s\" expired", zp->z_origin); } zp->z_flags &= ~Z_AUTH; @@ -1582,7 +1618,7 @@ stale(struct databuf *dp) { if (zp->z_lastupdate > tt.tv_sec) { if (!haveComplained((u_long)zp, (u_long)stale)) { ns_notice(ns_log_default, - "secondary zone \"%s\" time warp", + "slave zone \"%s\" time warp", zp->z_origin); } zp->z_flags &= ~Z_AUTH; @@ -1606,7 +1642,6 @@ stale(struct databuf *dp) { default: /* FALLTHROUGH */ ; - } panic("stale: impossible condition", NULL); /* NOTREACHED */ diff --git a/contrib/bind/bin/named/ns_resp.c b/contrib/bind/bin/named/ns_resp.c index 2a56e11..31c233a 100644 --- a/contrib/bind/bin/named/ns_resp.c +++ b/contrib/bind/bin/named/ns_resp.c @@ -1,6 +1,6 @@ #if !defined(lint) && !defined(SABER) static const char sccsid[] = "@(#)ns_resp.c 4.65 (Berkeley) 3/3/91"; -static const char rcsid[] = "$Id: ns_resp.c,v 8.149 2001/01/03 09:47:27 marka Exp $"; +static const char rcsid[] = "$Id: ns_resp.c,v 8.152 2001/02/13 23:28:31 marka Exp $"; #endif /* not lint */ /* @@ -470,8 +470,10 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp) if (!haveComplained(ina_ulong(from.sin_addr), (u_long)"unexpected source")) { ns_info(ns_log_default, - "Response from unexpected source (%s)", - sin_ntoa(from)); + "Response from unexpected source (%s) for query \"%s %s %s\"", + sin_ntoa(from), + *(qp->q_name) ? qp->q_name : ".", + p_class(qp->q_class), p_type(qp->q_type)); } /* * We don't know who this response came from so it @@ -508,7 +510,7 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp) (tt.tv_usec - stp->tv_usec) / 1000); } - if (ns_wouldlog(ns_log_default,3)) { + if (ns_wouldlog(ns_log_default, 3)) { ns_debug(ns_log_default, 3, "stime %lu/%lu now %lu/%lu rtt %ld", (u_long)stp->tv_sec, (u_long)stp->tv_usec, @@ -546,10 +548,11 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp) */ if (ns && qs->ns && (qp->q_nusedns < NSMAX)) { qp->q_usedns[qp->q_nusedns++] = qs->ns; - if (ns_wouldlog(ns_log_default,2)) { + if (ns_wouldlog(ns_log_default, 2)) { ns_debug(ns_log_default, 2, "NS #%d addr %s used, rtt %d", - n, sin_ntoa(qs->ns_addr), ns->d_nstime); + n, sin_ntoa(qs->ns_addr), + ns->d_nstime); } } @@ -587,8 +590,9 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp) if (t > 65535) t = 65535; ns2->d_nstime = (u_int16_t)t; - if (ns_wouldlog(ns_log_default,2)) { - ns_debug(ns_log_default, 2, "NS #%d %s rtt now %d", n, + if (ns_wouldlog(ns_log_default, 2)) { + ns_debug(ns_log_default, 2, + "NS #%d %s rtt now %d", n, sin_ntoa(qs->ns_addr), ns2->d_nstime); } @@ -1479,14 +1483,14 @@ tcp_retry: unsched(qp); schedretry(qp, retrytime(qp)); nsa = Q_NEXTADDR(qp, 0); - if (ns_wouldlog(ns_log_default,1)) { - ns_debug(ns_log_default, 1, - "resp: forw -> %s ds=%d nsid=%d id=%d %dms", - sin_ntoa(*nsa), ds, - ntohs(qp->q_nsid), ntohs(qp->q_id), - (qp->q_addr[0].nsdata != NULL) - ? qp->q_addr[0].nsdata->d_nstime - : -1); + if (ns_wouldlog(ns_log_default, 1)) { + ns_debug(ns_log_default, 1, + "resp: forw -> %s ds=%d nsid=%d id=%d %dms", + sin_ntoa(*nsa), ds, + ntohs(qp->q_nsid), ntohs(qp->q_id), + (qp->q_addr[0].nsdata != NULL) + ? qp->q_addr[0].nsdata->d_nstime + : -1); } #ifdef DEBUG if (debug >= 10) @@ -2459,11 +2463,13 @@ sysquery(const char *dname, int class, int type, qp->q_addr[0].stime = tt; /* XXX - why not every? */ nsa = Q_NEXTADDR(qp, 0); - ns_debug(ns_log_default, 1, - "sysquery: send -> %s dfd=%d nsid=%d id=%d retry=%ld", - sin_ntoa(*nsa), qp->q_dfd, - ntohs(qp->q_nsid), ntohs(qp->q_id), - (long)qp->q_time); + if (ns_wouldlog(ns_log_default, 1)) { + ns_debug(ns_log_default, 1, + "sysquery: send -> %s dfd=%d nsid=%d id=%d retry=%ld", + sin_ntoa(*nsa), qp->q_dfd, + ntohs(qp->q_nsid), ntohs(qp->q_id), + (long)qp->q_time); + } #ifdef DEBUG if (debug >= 10) res_pquery(&res, qp->q_msg, qp->q_msglen, @@ -2733,7 +2739,7 @@ findns(struct namebuf **npp, int class, return (NXDOMAIN); } else { /* XXX: zone isn't loaded but we're - * primary or secondary for it. + * primary or slave for it. * should we fwd this? */ return (SERVFAIL); diff --git a/contrib/bind/bin/named/ns_update.c b/contrib/bind/bin/named/ns_update.c index e20d258..4ad697b 100644 --- a/contrib/bind/bin/named/ns_update.c +++ b/contrib/bind/bin/named/ns_update.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: ns_update.c,v 8.89 2001/01/14 09:46:20 marka Exp $"; +static const char rcsid[] = "$Id: ns_update.c,v 8.91.2.2 2001/04/30 03:20:46 marka Exp $"; #endif /* not lint */ /* @@ -1136,7 +1136,7 @@ class=%s, type=%s, ttl=%d, dp=0x%0x", static enum req_action req_update_private(HEADER *hp, u_char *cp, u_char *eom, u_char *msg, struct qstream *qsp, int dfd, struct sockaddr_in from, - struct tsig_record *in_tsig, ns_updque curupd) + struct tsig_record *in_tsig, ns_updque *curupd) { char dnbuf[MAXDNAME], *dname; u_int zocount, prcount, upcount, adcount, class, type, dlen; @@ -1205,8 +1205,9 @@ req_update_private(HEADER *hp, u_char *cp, u_char *eom, u_char *msg, */ if (!ip_addr_or_key_allowed(zp->z_update_acl, from.sin_addr, in_key)) { - ns_notice(ns_log_security, "denied update from %s for \"%s\"", - sin_ntoa(from), *dname ? dname : "."); + ns_notice(ns_log_security, + "denied update from %s for \"%s\" %s", + sin_ntoa(from), *dname ? dname : ".", p_class(class)); nameserIncr(from.sin_addr, nssRcvdUUpd); return (Refuse); } @@ -1282,7 +1283,7 @@ req_update_private(HEADER *hp, u_char *cp, u_char *eom, u_char *msg, rrecp = res_mkupdrec(S_ZONE, dname, class, type, 0); rrecp->r_zone = zonenum; - APPEND(curupd, rrecp, r_link); + APPEND(*curupd, rrecp, r_link); /* * Parse the prerequisite and update sections for format errors. @@ -1342,7 +1343,7 @@ req_update_private(HEADER *hp, u_char *cp, u_char *eom, u_char *msg, DRCNTINC(dp); rrecp->r_dp = dp; /* Append the current record to the end of list of records. */ - APPEND(curupd, rrecp, r_link); + APPEND(*curupd, rrecp, r_link); if (cp > eom) { ns_info(ns_log_update, "Malformed response from %s (overrun)", @@ -1353,7 +1354,7 @@ req_update_private(HEADER *hp, u_char *cp, u_char *eom, u_char *msg, } /* Now process all parsed records in the prereq and update sections. */ - numupdated = process_updates(&curupd, &rcode, from); + numupdated = process_updates(curupd, &rcode, from); hp->rcode = rcode; if (numupdated <= 0) { if (rcode != NOERROR) @@ -1370,7 +1371,7 @@ req_update_private(HEADER *hp, u_char *cp, u_char *eom, u_char *msg, ns_stopxfrs(zp); /* Make a log of the update. */ - (void) printupdatelog(from, &curupd, hp, zp, old_serial); + (void) printupdatelog(from, curupd, hp, zp, old_serial); return (Finish); } @@ -1394,17 +1395,21 @@ free_rrecp(ns_updque *updlist, int rcode, struct sockaddr_in from) { next_rrecp = NEXT(rrecp, r_link); else next_rrecp = PREV(rrecp, r_link); + UNLINK(*updlist, rrecp, r_link); if (rrecp->r_section != S_UPDATE) { if (rrecp->r_dp) { DRCNTDEC(rrecp->r_dp); if (rrecp->r_dp->d_rcnt == 0) db_freedata(rrecp->r_dp); + rrecp->r_dp = NULL; } + INSIST(rrecp->r_deldp == NULL); res_freeupdrec(rrecp); continue; } dname = rrecp->r_dname; dp = rrecp->r_dp; + rrecp->r_dp = NULL; if ((dp->d_mark & D_MARK_ADDED) != 0) { if (rcode == NOERROR) { /* @@ -1437,37 +1442,19 @@ free_rrecp(ns_updque *updlist, int rcode, struct sockaddr_in from) { */ } } - DRCNTDEC(dp); - if (dp->d_rcnt == 0) - db_freedata(dp); - } else { - /* - * Databuf's matching this were deleted by this - * update, or were never executed (because we bailed - * out early). - */ - DRCNTDEC(dp); - if (dp->d_rcnt == 0) - db_freedata(dp); } + DRCNTDEC(dp); + if (dp->d_rcnt == 0) + db_freedata(dp); /* Process deleted databuf's. */ dp = rrecp->r_deldp; + rrecp->r_deldp = NULL; while (dp != NULL) { tmpdp = dp; - DRCNTDEC(tmpdp); - tmpdp->d_next = NULL; dp = dp->d_next; - if (rcode == NOERROR) { - if (tmpdp->d_rcnt) - ns_debug(ns_log_update, 1, - "free_rrecp: type = %d, rcnt = %d", - p_type(tmpdp->d_type), - tmpdp->d_rcnt); - else { - db_freedata(tmpdp); - } - } else { + tmpdp->d_next = NULL; + if (rcode != NOERROR) { /* Add the databuf back. */ tmpdp->d_mark &= ~D_MARK_DELETED; if (db_update(dname, tmpdp, tmpdp, NULL, @@ -1480,13 +1467,13 @@ free_rrecp(ns_updque *updlist, int rcode, struct sockaddr_in from) { "free_rrecp: added back databuf 0x%0x", tmpdp); } - if (tmpdp->d_rcnt == 0) - db_freedata(tmpdp); } + DRCNTDEC(tmpdp); + if (tmpdp->d_rcnt == 0) + db_freedata(tmpdp); } res_freeupdrec(rrecp); } - INIT_LIST(*updlist); } enum req_action @@ -1499,7 +1486,7 @@ req_update(HEADER *hp, u_char *cp, u_char *eom, u_char *msg, INIT_LIST(curupd); ret = req_update_private(hp, cp, eom, msg, qsp, dfd, from, - in_tsig, curupd); + in_tsig, &curupd); free_rrecp(&curupd, ret == Refuse ? ns_r_refused : hp->rcode, from); if (ret == Finish) { hp->qdcount = hp->ancount = hp->nscount = hp->arcount = 0; @@ -2145,7 +2132,6 @@ merge_logs(struct zoneinfo *zp, char *logname) { "isc_movefile(%s,%s) failed: %s :1", logname, zp->z_source, strerror(errno)); - fclose(fp); return (-1); } /* Finally, tell caller to reload zone. */ @@ -2245,6 +2231,7 @@ merge_logs(struct zoneinfo *zp, char *logname) { ns_error(ns_log_update, "error merging update id %d from log file %s", id, logname); + fclose(fp); return(-1); } free_rrecp(&curupd, rcode, empty_from); diff --git a/contrib/bind/bin/named/ns_xfr.c b/contrib/bind/bin/named/ns_xfr.c index 5c05fe0..836195b 100644 --- a/contrib/bind/bin/named/ns_xfr.c +++ b/contrib/bind/bin/named/ns_xfr.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: ns_xfr.c,v 8.63 2000/12/23 08:14:43 vixie Exp $"; +static const char rcsid[] = "$Id: ns_xfr.c,v 8.64 2001/02/15 00:18:46 marka Exp $"; #endif /* not lint */ /* @@ -117,8 +117,10 @@ ns_xfr(struct qstream *qsp, struct namebuf *znp, (void) setsockopt(qsp->s_rfd, SOL_SOCKET, SO_SNDLOWAT, (char *)&sndlowat, sizeof sndlowat); #endif - if (sq_openw(qsp, 64*1024) == -1) + if (sq_openw(qsp, 64*1024) == -1) { + ns_error(ns_log_xfer_out, "ns_xfr: out of memory"); goto abort; + } memset(&qsp->xfr, 0, sizeof qsp->xfr); qsp->xfr.top.axfr = znp; qsp->xfr.zone = zone; @@ -129,8 +131,10 @@ ns_xfr(struct qstream *qsp, struct namebuf *znp, qsp->xfr.id = id; qsp->xfr.opcode = opcode; qsp->xfr.msg = memget(XFER_BUFSIZE); - if (!qsp->xfr.msg) + if (!qsp->xfr.msg) { + ns_error(ns_log_xfer_out, "ns_xfr: out of memory"); goto abort; + } qsp->xfr.eom = qsp->xfr.msg + XFER_BUFSIZE; qsp->xfr.cp = NULL; qsp->xfr.state = s_x_firstsoa; @@ -199,6 +203,7 @@ ns_xfr(struct qstream *qsp, struct namebuf *znp, } } else { if (sx_pushlev(qsp, znp) < 0) { + ns_error(ns_log_xfer_out, "ns_xfr: out of memory"); abort: (void) shutdown(qsp->s_rfd, 2); sq_remove(qsp); diff --git a/contrib/bind/bin/ndc/ndc.c b/contrib/bind/bin/ndc/ndc.c index bc3e2dc..9daf69f 100644 --- a/contrib/bind/bin/ndc/ndc.c +++ b/contrib/bind/bin/ndc/ndc.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: ndc.c,v 1.16 2000/12/23 08:14:45 vixie Exp $"; +static const char rcsid[] = "$Id: ndc.c,v 1.16.2.1 2001/04/26 02:56:10 marka Exp $"; #endif /* not lint */ /* @@ -45,6 +45,9 @@ static const char rcsid[] = "$Id: ndc.c,v 1.16 2000/12/23 08:14:45 vixie Exp $"; #include "port_after.h" #include "pathnames.h" +#ifndef PATH_SEP +#define PATH_SEP '/' +#endif typedef union { struct sockaddr_in in; @@ -115,7 +118,7 @@ main(int argc, char *argv[], char *envp[]) { char *p; int ch; - if ((program = strrchr(argv[0], '/')) != NULL) + if ((program = strrchr(argv[0], PATH_SEP)) != NULL) program++; else program = argv[0]; diff --git a/contrib/bind/bin/nslookup/Makefile b/contrib/bind/bin/nslookup/Makefile index 5c564f4..6680bc6 100644 --- a/contrib/bind/bin/nslookup/Makefile +++ b/contrib/bind/bin/nslookup/Makefile @@ -13,7 +13,7 @@ ## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ## SOFTWARE. -# $Id: Makefile,v 8.26 2000/12/23 08:02:55 vixie Exp $ +# $Id: Makefile,v 8.27 2001/01/31 08:44:43 marka Exp $ DESTDIR= CC= cc @@ -42,7 +42,7 @@ INSTALL_EXEC= INSTALL_LIB=-o bin -g bin LDFLAGS= -DEFS= -D_PATH_HELPFILE=\"${DESTDIR}${DESTHELP}/nslookup.help\" +DEFS= -D_PATH_HELPFILE=\"${DESTHELP}/nslookup.help\" CFLAGS= ${CDEBUG} CPPFLAGS= -I${PORTINCL} -I${INCL} ${DEFS} diff --git a/contrib/bind/bin/nslookup/getinfo.c b/contrib/bind/bin/nslookup/getinfo.c index 57aadd3..8b5cf38 100644 --- a/contrib/bind/bin/nslookup/getinfo.c +++ b/contrib/bind/bin/nslookup/getinfo.c @@ -53,7 +53,7 @@ #ifndef lint static const char sccsid[] = "@(#)getinfo.c 5.26 (Berkeley) 3/21/91"; -static const char rcsid[] = "$Id: getinfo.c,v 8.17 2000/12/23 08:14:46 vixie Exp $"; +static const char rcsid[] = "$Id: getinfo.c,v 8.18 2001/02/27 06:03:40 vixie Exp $"; #endif /* not lint */ /* @@ -174,7 +174,7 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer) */ FreeHostInfoPtr(hostPtr); - status = SendRequest(nsAddrPtr, msg, msglen, (u_char *) &answer, + status = SendRequest(nsAddrPtr, (u_char *)msg, msglen, (u_char *) &answer, sizeof(answer), &n); if (status != SUCCESS) { |