diff --git a/CHANGES b/CHANGES index cc89d1101f..739f27091f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ + 585. [func] dns_db_addrdataset() and and dns_rdataslab_merge() + now support 'exact' additions in a similar manner to + dns_db_subtractrdataset() and dns_rdataslab_subtract(). 584. [func] You can now say 'notify explicit'; to suppress notification of the servers listed in NS records @@ -170,10 +173,10 @@ 526. [bug] nsupdate incorrectly refused to add RRs with a TTL of 0. - 525. [func] New argument 'exact' for dns_db_subtractrdataset(), - and dns_rdataslab_subtract() requesting that the RR's - must exist prior to deletion. DNS_R_NOTEXACT is - returned if the condition is not met. + 525. [func] New arguments 'options' for dns_db_subtractrdataset(), + and 'flags' for dns_rdataslab_subtract() allowing you + to request that the RR's must exist prior to deletion. + DNS_R_NOTEXACT is returned if the condition is not met. 524. [func] The 'forward' and 'forwarders' statement in non-forward zones should work now. diff --git a/lib/dns/db.c b/lib/dns/db.c index deeeb41ac5..3389f74c1d 100644 --- a/lib/dns/db.c +++ b/lib/dns/db.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: db.c,v 1.64 2000/11/30 13:19:04 marka Exp $ */ +/* $Id: db.c,v 1.65 2000/12/01 01:22:38 marka Exp $ */ /*** *** Imports @@ -631,7 +631,7 @@ dns_db_addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, isc_result_t dns_db_subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdataset_t *rdataset, - isc_boolean_t exact, dns_rdataset_t *newrdataset) + unsigned int options, dns_rdataset_t *newrdataset) { /* * Remove any rdata in 'rdataset' from 'node' in version 'version' of @@ -649,7 +649,7 @@ dns_db_subtractrdataset(dns_db_t *db, dns_dbnode_t *node, ! dns_rdataset_isassociated(newrdataset))); return ((db->methods->subtractrdataset)(db, node, version, rdataset, - exact, newrdataset)); + options, newrdataset)); } isc_result_t diff --git a/lib/dns/include/dns/db.h b/lib/dns/include/dns/db.h index 7ee53679d5..11efccabcd 100644 --- a/lib/dns/include/dns/db.h +++ b/lib/dns/include/dns/db.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: db.h,v 1.61 2000/11/30 13:19:08 marka Exp $ */ +/* $Id: db.h,v 1.62 2000/12/01 01:22:44 marka Exp $ */ #ifndef DNS_DB_H #define DNS_DB_H 1 @@ -134,7 +134,7 @@ typedef struct dns_dbmethods { isc_result_t (*subtractrdataset)(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdataset_t *rdataset, - isc_boolean_t exact, + unsigned int options, dns_rdataset_t *newrdataset); isc_result_t (*deleterdataset)(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, @@ -194,6 +194,11 @@ struct dns_db { #define DNS_DBADD_FORCE 0x02 #define DNS_DBADD_EXACT 0x04 +/* + * Options that can be specified for dns_db_subtractrdataset(). + */ +#define DNS_DBSUB_EXACT 0x01 + /***** ***** Methods *****/ @@ -1049,6 +1054,7 @@ dns_db_addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, * ISC_R_SUCCESS * DNS_R_UNCHANGED The operation did not change anything. * ISC_R_NOMEMORY + * DNS_R_NOTEXACT * * Other results are possible, depending upon the database * implementation used. @@ -1057,7 +1063,7 @@ dns_db_addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, isc_result_t dns_db_subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdataset_t *rdataset, - isc_boolean_t exact, dns_rdataset_t *newrdataset); + unsigned int options, dns_rdataset_t *newrdataset); /* * Remove any rdata in 'rdataset' from 'node' in version 'version' of * 'db'. @@ -1066,7 +1072,8 @@ dns_db_subtractrdataset(dns_db_t *db, dns_dbnode_t *node, * * If 'newrdataset' is not NULL, then it will be attached to the * resulting new rdataset in the database, unless the rdataset has - * become nonexistent. + * become nonexistent. If DNS_DBSUB_EXACT is set then all elements + * of 'rdataset' must exist at 'node'. * * Requires: * @@ -1077,9 +1084,6 @@ dns_db_subtractrdataset(dns_db_t *db, dns_dbnode_t *node, * 'rdataset' is a valid, associated rdataset with the same class * as 'db'. * - * 'exact' if ISC_TRUE then all rdata in 'rdataset' must exist - * at 'node'. - * * 'newrdataset' is NULL, or a valid, unassociated rdataset. * * The database has zone semantics and 'version' is a valid @@ -1092,7 +1096,7 @@ dns_db_subtractrdataset(dns_db_t *db, dns_dbnode_t *node, * DNS_R_NXRRSET All rdata of the same type as those * in 'rdataset' have been deleted. * DNS_R_NOTEXACT Some part of 'rdataset' did not - * exist and 'exact' was ISC_TRUE. + * exist and DNS_DBSUB_EXACT was set. * * Other results are possible, depending upon the database * implementation used. diff --git a/lib/dns/include/dns/rdataslab.h b/lib/dns/include/dns/rdataslab.h index 77d7c077bd..d7ba310a37 100644 --- a/lib/dns/include/dns/rdataslab.h +++ b/lib/dns/include/dns/rdataslab.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rdataslab.h,v 1.17 2000/11/30 13:19:09 marka Exp $ */ +/* $Id: rdataslab.h,v 1.18 2000/12/01 01:22:45 marka Exp $ */ #ifndef DNS_RDATASLAB_H #define DNS_RDATASLAB_H 1 @@ -103,7 +103,6 @@ dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab, /* * Merge 'oslab' and 'nslab'. * - * XXX * DNS_RDATASLAB_FORCE and DNS_RDATASLAB_EXACT are mutually exclusive. */ @@ -111,12 +110,13 @@ isc_result_t dns_rdataslab_subtract(unsigned char *mslab, unsigned char *sslab, unsigned int reservelen, isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_rdatatype_t type, - isc_boolean_t exact, unsigned char **tslabp); + unsigned int flags, unsigned char **tslabp); /* * Subtract 'sslab' from 'mslab'. If 'exact' is true then all elements * of 'sslab' must exist in 'mslab'. * * XXX + * valid flags are DNS_RDATASLAB_EXACT */ isc_boolean_t diff --git a/lib/dns/journal.c b/lib/dns/journal.c index b2a1937d61..e97f38e13c 100644 --- a/lib/dns/journal.c +++ b/lib/dns/journal.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: journal.c,v 1.64 2000/11/30 13:19:05 marka Exp $ */ +/* $Id: journal.c,v 1.65 2000/12/01 01:22:39 marka Exp $ */ #include @@ -403,7 +403,7 @@ dns_diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver) } else if (op == DNS_DIFFOP_DEL) { result = dns_db_subtractrdataset(db, node, ver, &rds, - ISC_TRUE, + DNS_DBSUB_EXACT, NULL); } else { INSIST(0); diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index a94371913e..01bc4129b2 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rbtdb.c,v 1.135 2000/11/30 13:19:06 marka Exp $ */ +/* $Id: rbtdb.c,v 1.136 2000/12/01 01:22:41 marka Exp $ */ /* * Principal Author: Bob Halley @@ -3472,7 +3472,7 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, static isc_result_t subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, - dns_rdataset_t *rdataset, isc_boolean_t exact, + dns_rdataset_t *rdataset, unsigned int options, dns_rdataset_t *newrdataset) { dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db; @@ -3524,7 +3524,10 @@ subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, while (header != NULL && IGNORE(header)) header = header->down; if (header != NULL && EXISTS(header)) { + unsigned int flags = 0; subresult = NULL; + if ((options & DNS_DBSUB_EXACT) != 0) + flags |= DNS_RDATASLAB_EXACT; result = dns_rdataslab_subtract( (unsigned char *)header, (unsigned char *)newheader, @@ -3532,7 +3535,7 @@ subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, rbtdb->common.mctx, rbtdb->common.rdclass, (dns_rdatatype_t)header->type, - exact, &subresult); + flags, &subresult); if (result == ISC_R_SUCCESS) { free_rdataset(rbtdb->common.mctx, newheader); newheader = (rdatasetheader_t *)subresult; diff --git a/lib/dns/rdataslab.c b/lib/dns/rdataslab.c index 16316db902..fa69ce1487 100644 --- a/lib/dns/rdataslab.c +++ b/lib/dns/rdataslab.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rdataslab.c,v 1.26 2000/11/30 23:59:08 marka Exp $ */ +/* $Id: rdataslab.c,v 1.27 2000/12/01 01:22:42 marka Exp $ */ #include @@ -302,8 +302,8 @@ dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab, } while (ncount > 0); ncount = nncount; - if ((flags & DNS_RDATASLAB_EXACT) != 0 && - tcount != ncount + ocount) + if (((flags & DNS_RDATASLAB_EXACT) != 0) && + (tcount != ncount + ocount)) return (DNS_R_NOTEXACT); if (!added_something && (flags & DNS_RDATASLAB_FORCE) == 0) @@ -401,7 +401,7 @@ isc_result_t dns_rdataslab_subtract(unsigned char *mslab, unsigned char *sslab, unsigned int reservelen, isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_rdatatype_t type, - isc_boolean_t exact, unsigned char **tslabp) + unsigned int flags, unsigned char **tslabp) { unsigned char *mcurrent, *sstart, *scurrent, *tstart, *tcurrent; unsigned int mcount, scount, rcount ,count, tlength, tcount; @@ -462,7 +462,7 @@ dns_rdataslab_subtract(unsigned char *mslab, unsigned char *sslab, * Check that all the records originally existed. The numeric * check only works as rdataslabs do not contain duplicates. */ - if (exact && (rcount != scount)) + if (((flags & DNS_RDATASLAB_EXACT) != 0) && (rcount != scount)) return (DNS_R_NOTEXACT); /* diff --git a/lib/dns/sdb.c b/lib/dns/sdb.c index 8c33215e60..9792980740 100644 --- a/lib/dns/sdb.c +++ b/lib/dns/sdb.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sdb.c,v 1.19 2000/12/01 01:00:47 gson Exp $ */ +/* $Id: sdb.c,v 1.20 2000/12/01 01:22:43 marka Exp $ */ #include @@ -1033,14 +1033,14 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, static isc_result_t subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, - dns_rdataset_t *rdataset, isc_boolean_t exact, + dns_rdataset_t *rdataset, unsigned int options, dns_rdataset_t *newrdataset) { UNUSED(db); UNUSED(node); UNUSED(version); UNUSED(rdataset); - UNUSED(exact); + UNUSED(options); UNUSED(newrdataset); return (ISC_R_NOTIMPLEMENTED);