diff options
author | asmodai <asmodai@FreeBSD.org> | 2000-10-31 12:35:45 +0000 |
---|---|---|
committer | asmodai <asmodai@FreeBSD.org> | 2000-10-31 12:35:45 +0000 |
commit | b5459c5b45e8d87dcdb3d5a0ddc31ca631a18480 (patch) | |
tree | ec4d7d21514a97aec7ad9db79cabb486f981b420 /contrib/bind/bin/named | |
parent | 1f7d1df733cba8003f78ea73b609bf5ad47db279 (diff) | |
parent | 90887e8f5bdae690c1ceca0ae12853e5e66c5282 (diff) | |
download | FreeBSD-src-b5459c5b45e8d87dcdb3d5a0ddc31ca631a18480.zip FreeBSD-src-b5459c5b45e8d87dcdb3d5a0ddc31ca631a18480.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r68068,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/bind/bin/named')
-rw-r--r-- | contrib/bind/bin/named/db_load.c | 4 | ||||
-rw-r--r-- | contrib/bind/bin/named/ns_glob.h | 3 | ||||
-rw-r--r-- | contrib/bind/bin/named/ns_glue.c | 3 | ||||
-rw-r--r-- | contrib/bind/bin/named/ns_main.c | 63 | ||||
-rw-r--r-- | contrib/bind/bin/named/ns_maint.c | 14 | ||||
-rw-r--r-- | contrib/bind/bin/named/ns_req.c | 26 | ||||
-rw-r--r-- | contrib/bind/bin/named/ns_resp.c | 6 | ||||
-rw-r--r-- | contrib/bind/bin/named/ns_signal.c | 5 | ||||
-rw-r--r-- | contrib/bind/bin/named/ns_update.c | 134 |
9 files changed, 149 insertions, 109 deletions
diff --git a/contrib/bind/bin/named/db_load.c b/contrib/bind/bin/named/db_load.c index 2d6a6e5..305944c 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.103 2000/04/21 06:54:02 vixie Exp $"; +static const char rcsid[] = "$Id: db_load.c,v 8.104 2000/07/17 07:48:09 vixie Exp $"; #endif /* not lint */ /* @@ -530,7 +530,7 @@ db_load(const char *filename, const char *in_origin, ns_warning(ns_log_load, "Zone \"%s\" (file %s): %s", zp->z_origin, filename, - "No default TTL set using SOA minimum instead"); + "No default TTL ($TTL <value>) set, using SOA minimum instead"); default_warn = 0; } ttl = (u_int32_t)default_ttl; diff --git a/contrib/bind/bin/named/ns_glob.h b/contrib/bind/bin/named/ns_glob.h index af0ea30..e9f70e7 100644 --- a/contrib/bind/bin/named/ns_glob.h +++ b/contrib/bind/bin/named/ns_glob.h @@ -1,6 +1,6 @@ /* * from ns.h 4.33 (Berkeley) 8/23/90 - * $Id: ns_glob.h,v 8.54 2000/04/21 06:54:07 vixie Exp $ + * $Id: ns_glob.h,v 8.55 2000/07/20 22:50:38 vixie Exp $ */ /* @@ -209,7 +209,6 @@ DECL options server_options INIT(NULL); DECL server_info nameserver_info INIT(NULL); DECL key_info_list secretkey_info INIT(NULL); -DECL int main_needs_exit INIT(0); DECL ip_match_list bogus_nameservers INIT(NULL); DECL log_context log_ctx; diff --git a/contrib/bind/bin/named/ns_glue.c b/contrib/bind/bin/named/ns_glue.c index 9c40dde..8360ad5 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.16 2000/04/21 06:50:18 vixie Exp $"; +static const char rcsid[] = "$Id: ns_glue.c,v 8.17 2000/07/17 07:36:52 vixie Exp $"; #endif /* not lint */ /* @@ -252,6 +252,7 @@ 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_main.c b/contrib/bind/bin/named/ns_main.c index 199190f..1461807 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.125 2000/04/21 06:54:08 vixie Exp $"; +static const char rcsid[] = "$Id: ns_main.c,v 8.126 2000/07/20 22:50:39 vixie Exp $"; #endif /* not lint */ /* @@ -163,8 +163,9 @@ static u_int16_t nsid_state2; static int nsid_algorithm; typedef void (*handler)(void); -static int needs = 0; +static int needs = 0, needs_exit = 0; static handler handlers[main_need_num]; +static void need_waitfunc(evContext, void *, const void *); static struct qstream *sq_add(void); static int opensocket_d(interface *), @@ -196,7 +197,7 @@ static void stream_send(evContext, void *, int, static int only_digits(const char *); static void init_needs(void), - handle_need(void); + handle_needs(void); #ifndef HAVE_CUSTOM static void custom_init(void), @@ -525,21 +526,16 @@ main(int argc, char *argv[], char *envp[]) { ns_notice(ns_log_default, "Ready to answer queries."); gettime(&tt); prime_cache(); - while (!main_needs_exit) { + while (!needs_exit) { evEvent event; ns_debug(ns_log_default, 15, "main loop"); - if (needs != 0) { - /* Drain outstanding events; handlers ~block~. */ - while (evGetNext(ev, &event, EV_POLL) != -1) - INSIST_ERR(evDispatch(ev, event) != -1); - INSIST_ERR(errno == EINTR || errno == EWOULDBLOCK); - handle_need(); - } else if (evGetNext(ev, &event, EV_WAIT) != -1) { + if (needs != 0) + handle_needs(); + else if (evGetNext(ev, &event, EV_WAIT) != -1) INSIST_ERR(evDispatch(ev, event) != -1); - } else { + else INSIST_ERR(errno == EINTR); - } } ns_info(ns_log_default, "named shutting down"); #ifdef BIND_UPDATE @@ -2551,11 +2547,6 @@ deallocate_everything(void) { } static void -ns_exit(void) { - main_needs_exit++; -} - -static void ns_restart(void) { ns_info(ns_log_default, "named restarting"); #ifdef BIND_UPDATE @@ -2639,7 +2630,7 @@ init_needs(void) { handlers[main_need_zoneload] = loadxfer; handlers[main_need_dump] = doadump; handlers[main_need_statsdump] = ns_stats; - handlers[main_need_exit] = ns_exit; + handlers[main_need_exit] = wild; handlers[main_need_qrylog] = toggle_qrylog; handlers[main_need_debug] = use_desired_debug; handlers[main_need_restart] = ns_restart; @@ -2648,20 +2639,32 @@ init_needs(void) { } static void -handle_need(void) { - int need; +handle_needs(void) { + int need, queued = 0; - ns_debug(ns_log_default, 15, "handle_need()"); + ns_debug(ns_log_default, 15, "handle_needs()"); + block_signals(); for (need = 0; need < main_need_num; need++) if ((needs & (1 << need)) != 0) { - /* Turn off flag first, handlers ~turn~ it back on. */ - block_signals(); - needs &= ~(1 << need); - unblock_signals(); - (handlers[need])(); - return; + INSIST_ERR(evWaitFor(ev, handle_needs, need_waitfunc, + handlers[need], NULL) != -1); + queued++; } - ns_panic(ns_log_default, 1, "handle_need() found no needs", NULL); + needs = 0; + unblock_signals(); + ns_debug(ns_log_default, 15, "handle_needs(): queued %d", queued); + if (queued != 0) { + INSIST_ERR(evDo(ev, handle_needs) != -1); + return; + } + ns_panic(ns_log_default, 1, "ns_handle_needs: queued == 0", NULL); +} + +static void +need_waitfunc(evContext ctx, void *uap, const void *tag) { + handler hand = (handler) uap; + + (*hand)(); } void @@ -2675,6 +2678,8 @@ ns_need(enum need need) { void ns_need_unsafe(enum need need) { needs |= (1 << need); + if (need == main_need_exit) + needs_exit = 1; } void diff --git a/contrib/bind/bin/named/ns_maint.c b/contrib/bind/bin/named/ns_maint.c index 9b9e16e..952774f 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.103 2000/04/23 02:18:58 vixie Exp $"; +static const char rcsid[] = "$Id: ns_maint.c,v 8.105 2000/07/17 07:25:00 vixie Exp $"; #endif /* not lint */ /* @@ -586,12 +586,12 @@ qserial_answer(struct qinfo *qp) { if (qs->serial != zp->z_serial) ns_notice(ns_log_xfer_in, - "Zone \"%s\" (%s) SOA serial# (%lu) rcvd from [%s] is < ours (%lu)%s", + "Zone \"%s\" (%s) SOA serial# (%lu) rcvd from [%s] is < ours (%lu)%s", zp->z_origin, p_class(zp->z_class), - qs->serial, + (u_long) qs->serial, inet_ntoa(qs->ns_addr.sin_addr), - zp->z_serial, qp->q_naddr != 1 ? - ": skipping" : ""); + (u_long) zp->z_serial, + qp->q_naddr!=1 ? ": skipping" : ""); qs->serial = 0; continue; } @@ -834,8 +834,10 @@ startxfer(struct zoneinfo *zp) { return; } - if ((pid = spawnxfer(argv, zp)) == -1) + if ((pid = spawnxfer(argv, zp)) == -1) { unlink(tsig_name); + return; + } xferstatus[i].xfer_state = XFER_RUNNING; xferstatus[i].xfer_pid = pid; /* XXX - small race condition here if we diff --git a/contrib/bind/bin/named/ns_req.c b/contrib/bind/bin/named/ns_req.c index 5e1459c..d6add30 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.113 2000/04/21 06:54:11 vixie Exp $"; +static const char rcsid[] = "$Id: ns_req.c,v 8.118 2000/07/17 07:57:56 vixie Exp $"; #endif /* not lint */ /* @@ -208,6 +208,7 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp, key = find_key(buf, NULL); if (key == 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); @@ -361,6 +362,7 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp, hp->ancount = htons(0); hp->nscount = htons(0); hp->arcount = htons(0); + cp = msg + HFIXEDSZ; } /* @@ -466,6 +468,14 @@ req_notify(HEADER *hp, u_char **cpp, u_char *eom, u_char *msg, return (Finish); } + /* valid notify's are authoritative */ + if (!hp->aa) { + ns_debug(ns_log_notify, 1, + "FORMERR Notify request without AA"); + hp->rcode = ns_r_formerr; + return (Finish); + } + n = dn_expand(msg, eom, *cpp, dnbuf, sizeof dnbuf); if (n < 0) { ns_debug(ns_log_notify, 1, @@ -556,6 +566,7 @@ req_notify(HEADER *hp, u_char **cpp, u_char *eom, u_char *msg, } noerror: hp->rcode = ns_r_noerror; + hp->aa = 1; return (Finish); refuse: hp->rcode = ns_r_refused; @@ -587,9 +598,6 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp, struct databuf *dp; DST_KEY *in_key = (in_tsig != NULL) ? in_tsig->key : NULL; - - - nameserIncr(from.sin_addr, nssRcvdQ); nsp[0] = NULL; @@ -727,7 +735,7 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp, nameserIncr(from.sin_addr, nssRcvdAXFR); hp->rd = 0; /* Recursion not possible. */ } - *buflenp -= *msglenp; + *buflenp -= (*msglenp - HFIXEDSZ); count = 0; founddata = 0; dname = dnbuf; @@ -1146,7 +1154,7 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp, if (qsp == NULL) return (Finish); else { - if (!ixfr_found) { + if (!ixfr_found && type == ns_t_ixfr) { qsp->flags |= STREAM_AXFRIXFR; hp->qdcount = htons(1); } @@ -1409,13 +1417,13 @@ req_iquery(HEADER *hp, u_char **cpp, u_char *eom, int *buflenp, GETSHORT(class, *cpp); *cpp += INT32SZ; /* ttl */ GETSHORT(dlen, *cpp); - *cpp += dlen; - if (*cpp != eom) { + if (*cpp + dlen != eom) { ns_debug(ns_log_default, 1, "FORMERR IQuery message length off"); hp->rcode = ns_r_formerr; return (Finish); } + *cpp += dlen; /* * not all inverse queries are handled. @@ -1760,7 +1768,7 @@ make_rr(const char *name, struct databuf *dp, u_char *buf, /* Replacement */ ns_debug(ns_log_default, 1, "Replacement = %s", cp1); - n = dn_comp((char *)cp1, cp, buflen, dnptrs, edp); + n = dn_comp((char *)cp1, cp, buflen, comp_ptrs, edp); ns_debug(ns_log_default, 1, "dn_comp's n = %u", n); if (n < 0) goto cleanup; diff --git a/contrib/bind/bin/named/ns_resp.c b/contrib/bind/bin/named/ns_resp.c index 0646618..36e3626 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.143 2000/05/09 07:38:38 vixie Exp $"; +static const char rcsid[] = "$Id: ns_resp.c,v 8.144 2000/07/11 08:26:09 vixie Exp $"; #endif /* not lint */ /* @@ -614,7 +614,8 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp) */ if (hp->opcode == NS_NOTIFY_OP) { ns_info(ns_log_notify, - "Received NOTIFY answer from %s for \"%s %s %s\"", + "Received NOTIFY answer (%sAA) from %s for \"%s %s %s\"", + hp->aa ? "" : "!", inet_ntoa(from.sin_addr), *(qp->q_name) ? qp->q_name : ".", p_class(qp->q_class), p_type(qp->q_type)); @@ -2367,6 +2368,7 @@ sysquery(const char *dname, int class, int type, hp = (HEADER *) qp->q_msg; hp->id = qp->q_nsid = htons(nsid_next()); hp->rd = (qp->q_addr[qp->q_curaddr].forwarder ? 1 : 0); + hp->aa = (opcode == NS_NOTIFY_OP); /* First check for an already pending query for this data. */ for (oqp = nsqhead; oqp != NULL; oqp = oqp->q_link) { diff --git a/contrib/bind/bin/named/ns_signal.c b/contrib/bind/bin/named/ns_signal.c index 8cc715b..f5a6e24 100644 --- a/contrib/bind/bin/named/ns_signal.c +++ b/contrib/bind/bin/named/ns_signal.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_signal.c,v 8.12 2000/04/21 06:54:12 vixie Exp $"; +static const char rcsid[] = "$Id: ns_signal.c,v 8.13 2000/07/11 07:10:12 vixie Exp $"; #endif /* not lint */ /* @@ -245,6 +245,9 @@ init_signals(void) { "sigaction failed in set_signal_handler(%d): %s", sighandlers[sh].sig, strerror(errno)); } + /* Unblock all signals that we expect to handle. */ + if (sigprocmask(SIG_UNBLOCK, &mask, NULL) < 0) + ns_panic(ns_log_os, 1, "sigblock failed: %s", strerror(errno)); } void diff --git a/contrib/bind/bin/named/ns_update.c b/contrib/bind/bin/named/ns_update.c index c7d8ad3..da0c5a9 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.78 2000/04/23 02:19:00 vixie Exp $"; +static const char rcsid[] = "$Id: ns_update.c,v 8.81 2000/07/11 09:25:14 vixie Exp $"; #endif /* not lint */ /* @@ -286,16 +286,24 @@ printupdatelog(struct sockaddr_in srcaddr, if (fp == NULL) return; - ifp = open_ixfr_log(zp); - if (ifp == NULL) { - (void) close_transaction_log(zp, fp); - return; + if (zp->z_maintain_ixfr_base == 1) { + ifp = open_ixfr_log(zp); + if (ifp == NULL) { + (void) close_transaction_log(zp, fp); + return; + } } + else + ifp = NULL; + sprintf(time, "at %lu", (u_long)tt.tv_sec); fprintf(fp, "[DYNAMIC_UPDATE] id %u from %s %s (named pid %ld):\n", ntohs(hp->id), sin_ntoa(srcaddr), time, (long)getpid()); - fprintf(ifp, "[DYNAMIC_UPDATE] id %u from %s %s (named pid %ld):\n", - ntohs(hp->id), sin_ntoa(srcaddr), time, (long)getpid()); + if (ifp) + fprintf(ifp, + "[DYNAMIC_UPDATE] id %u from %s %s (named pid %ld):\n", + ntohs(hp->id), sin_ntoa(srcaddr), time, + (long)getpid()); for (rrecp = HEAD(*updlist); rrecp != NULL; rrecp = NEXT(rrecp, r_link)) { INSIST(zp == &zones[rrecp->r_zone]); switch (rrecp->r_section) { @@ -303,9 +311,11 @@ printupdatelog(struct sockaddr_in srcaddr, fprintf(fp, "zone:\torigin %s class %s serial %u\n", zp->z_origin, p_class(zp->z_class), old_serial); - fprintf(ifp, "zone:\torigin %s class %s serial %u\n", - zp->z_origin, p_class(zp->z_class), - old_serial); + if (ifp) + fprintf(ifp, + "zone:\torigin %s class %s serial %u\n", + zp->z_origin, p_class(zp->z_class), + old_serial); break; case S_PREREQ: opcode = rrecp->r_opcode; @@ -332,15 +342,17 @@ printupdatelog(struct sockaddr_in srcaddr, while (dp != NULL) { if (dp->d_rcode == 0 && !was_added(updlist, dp)) { - fprintf(ifp, - "update:\t{%s} %s. %u %s %s ", - "delete", - rrecp->r_dname, - dp->d_ttl, - p_class(dp->d_class), - p_type(dp->d_type)); - (void) rdata_dump(dp, ifp); - fprintf(ifp, "\n"); + if (ifp) { + fprintf(ifp, + "update:\t{%s} %s. %u %s %s ", + "delete", + rrecp->r_dname, + dp->d_ttl, + p_class(dp->d_class), + p_type(dp->d_type)); + (void) rdata_dump(dp, ifp); + fprintf(ifp, "\n"); + } } dp = dp->d_next; } @@ -353,13 +365,15 @@ printupdatelog(struct sockaddr_in srcaddr, dp->d_type != T_SOA && (dp->d_mark & D_MARK_ADDED) != 0 && !was_deleted(updlist, dp)) { - fprintf(ifp, "update:\t{%s} %s. ", - opcodes[opcode], rrecp->r_dname); - fprintf(ifp, "%u ", rrecp->r_ttl); - fprintf(ifp, "%s ", p_class(zp->z_class)); - fprintf(ifp, "%s ", p_type(rrecp->r_type)); - (void) rdata_dump(dp, ifp); - fprintf(ifp, "\n"); + if (ifp) { + fprintf(ifp, "update:\t{%s} %s. ", + opcodes[opcode], rrecp->r_dname); + fprintf(ifp, "%u ", rrecp->r_ttl); + fprintf(ifp, "%s ", p_class(zp->z_class)); + fprintf(ifp, "%s ", p_type(rrecp->r_type)); + (void) rdata_dump(dp, ifp); + fprintf(ifp, "\n"); + } } /* Update log. */ fprintf(fp, "update:\t{%s} %s. ", @@ -398,13 +412,15 @@ printupdatelog(struct sockaddr_in srcaddr, dp->d_type == T_SOA && (dp->d_mark & D_MARK_ADDED) != 0 && !was_deleted(updlist, dp)) { - fprintf(ifp, "update:\t{%s} %s. ", - opcodes[opcode], rrecp->r_dname); - fprintf(ifp, "%u ", rrecp->r_ttl); - fprintf(ifp, "%s ", p_class(zp->z_class)); - fprintf(ifp, "%s ", p_type(rrecp->r_type)); - (void) rdata_dump(dp, ifp); - fprintf(ifp, "\n[END_DELTA]\n"); + if (ifp) { + fprintf(ifp, "update:\t{%s} %s. ", + opcodes[opcode], rrecp->r_dname); + fprintf(ifp, "%u ", rrecp->r_ttl); + fprintf(ifp, "%s ", p_class(zp->z_class)); + fprintf(ifp, "%s ", p_type(rrecp->r_type)); + (void) rdata_dump(dp, ifp); + fprintf(ifp, "\n[END_DELTA]\n"); + } } break; default: @@ -413,7 +429,8 @@ printupdatelog(struct sockaddr_in srcaddr, } fprintf(fp, "\n"); (void) close_transaction_log(zp, fp); - (void) close_ixfr_log(zp, ifp); + if (ifp) + (void) close_ixfr_log(zp, ifp); } static void @@ -547,7 +564,7 @@ process_prereq(ns_updrec *ur, int *rcodep, u_int16_t zclass) { */ if (rdp && (rdp->d_mark & D_MARK_FOUND) != 0) { /* Already processed. */ - return (1); + return (1); } if (ttl != 0) { ns_debug(ns_log_update, 1, @@ -2962,32 +2979,35 @@ incr_serial(struct zoneinfo *zp) { old_serial, serial, checked_ctime(&t)); if (close_transaction_log(zp, fp)<0) return (-1); - ifp = open_ixfr_log(zp); - if (ifp == NULL) - return (-1); - dp = findzonesoa(zp); - if (dp) { - olddp = memget(DATASIZE(dp->d_size)); - if (olddp != NULL) { - memcpy(olddp, dp, DATASIZE(dp->d_size)); - cp = findsoaserial(olddp->d_data); - PUTLONG(old_serial, cp); - fprintf(ifp, "update: {delete} %s. %u %s %s ", + if (zp->z_maintain_ixfr_base) { + ifp = open_ixfr_log(zp); + if (ifp == NULL) + return (-1); + dp = findzonesoa(zp); + if (dp) { + olddp = memget(DATASIZE(dp->d_size)); + if (olddp != NULL) { + memcpy(olddp, dp, DATASIZE(dp->d_size)); + cp = findsoaserial(olddp->d_data); + PUTLONG(old_serial, cp); + fprintf(ifp, "update: {delete} %s. %u %s %s ", + zp->z_origin, dp->d_ttl, + p_class(dp->d_class), + p_type(dp->d_type)); + (void) rdata_dump(olddp, ifp); + fprintf(ifp, "\n"); + memput(olddp, DATASIZE(dp->d_size)); + } + fprintf(ifp, "update: {add} %s. %u %s %s ", zp->z_origin, dp->d_ttl, - p_class(dp->d_class), p_type(dp->d_type)); - (void) rdata_dump(olddp, ifp); + p_class(dp->d_class), p_type(dp->d_type)); + (void) rdata_dump(dp, ifp); fprintf(ifp, "\n"); - memput(olddp, DATASIZE(dp->d_size)); } - fprintf(ifp, "update: {add} %s. %u %s %s ", - zp->z_origin, dp->d_ttl, - p_class(dp->d_class), p_type(dp->d_type)); - (void) rdata_dump(dp, ifp); - fprintf(ifp, "\n"); + fprintf(ifp, "[END_DELTA]\n"); + if (close_ixfr_log(zp, ifp) < 0) + return (-1); } - fprintf(ifp, "[END_DELTA]\n"); - if (close_ixfr_log(zp, ifp)<0) - return (-1); /* * This shouldn't happen, but we check to be sure. |