diff --git a/bin/tests/master_test.c b/bin/tests/master_test.c index 3a4975eab9..1862a6ba13 100644 --- a/bin/tests/master_test.c +++ b/bin/tests/master_test.c @@ -13,16 +13,19 @@ #include #include -dns_result_t print_dataset(dns_name_t *owner, dns_rdataset_t *dataset); +dns_result_t print_dataset(dns_name_t *owner, dns_rdataset_t *dataset, + isc_mem_t *mctx); isc_mem_t *mctx; dns_result_t -print_dataset(dns_name_t *owner, dns_rdataset_t *dataset) { +print_dataset(dns_name_t *owner, dns_rdataset_t *dataset, isc_mem_t *mctx) { char buf[64*1024]; isc_buffer_t target; dns_result_t result; + mctx = mctx; + isc_buffer_init(&target, buf, 64*1024, ISC_BUFFERTYPE_TEXT); result = dns_rdataset_totext(dataset, owner, ISC_FALSE, &target); if (result == DNS_R_SUCCESS) @@ -42,6 +45,8 @@ main(int argc, char *argv[]) { isc_buffer_t source; isc_buffer_t target; unsigned char name_buf[255]; + int soacount = 0; + int nscount = 0; argc = argc; @@ -63,10 +68,14 @@ main(int argc, char *argv[]) { } - result = dns_load_master(argv[1], &origin, 1, + result = dns_load_master(argv[1], &origin, &origin, 1, + &soacount, &nscount, print_dataset, mctx); fprintf(stdout, "dns_load_master: %s\n", dns_result_totext(result)); + if (result == DNS_R_SUCCESS) + fprintf(stdout, "soacount = %d, nscount = %d\n", + soacount, nscount); } exit(0); } diff --git a/lib/dns/gen.c b/lib/dns/gen.c index 4aacc6bbca..90b84ef2bb 100644 --- a/lib/dns/gen.c +++ b/lib/dns/gen.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: gen.c,v 1.10 1999/01/27 13:38:18 marka Exp $ */ + /* $Id: gen.c,v 1.11 1999/01/28 05:03:23 marka Exp $ */ #include @@ -26,6 +26,7 @@ #include #include #include +#include #define FROMTEXTDECL "dns_rdataclass_t class, dns_rdatatype_t type, isc_lex_t *lexer, dns_name_t *origin, isc_boolean_t downcase, isc_buffer_t *target" @@ -303,9 +304,26 @@ main(int argc, char **argv) { time_t now; char year[11]; int lasttype; + int code = 1; + int class_enum = 0; + int type_enum = 0; + int c; - argc = argc; - argv = argv; + while ((c = getopt(argc, argv, "ct")) != -1) + switch (c) { + case 'c': + code = 0; + type_enum = 0; + class_enum = 1; + break; + case 't': + code = 0; + class_enum = 0; + type_enum = 1; + break; + case '?': + exit(1); + } if ((d = opendir("rdata")) == NULL) exit(1); @@ -335,52 +353,82 @@ main(int argc, char **argv) { fprintf(stdout, copyright, year); - dodecl("dns_result_t", "fromtext", FROMTEXTDECL); - dodecl("dns_result_t", "totext", TOTEXTDECL); - dodecl("dns_result_t", "fromwire", FROMWIREDECL); - dodecl("dns_result_t", "towire", TOWIREDECL); - dodecl("int", "compare", COMPAREDECL); - dodecl("dns_result_t", "fromstruct", FROMSTRUCTDECL); - dodecl("dns_result_t", "tostruct", TOSTRUCTDECL); + if (code) { + dodecl("dns_result_t", "fromtext", FROMTEXTDECL); + dodecl("dns_result_t", "totext", TOTEXTDECL); + dodecl("dns_result_t", "fromwire", FROMWIREDECL); + dodecl("dns_result_t", "towire", TOWIREDECL); + dodecl("int", "compare", COMPAREDECL); + dodecl("dns_result_t", "fromstruct", FROMSTRUCTDECL); + dodecl("dns_result_t", "tostruct", TOSTRUCTDECL); - doswitch("FROMTEXTSWITCH", "fromtext", FROMTEXTARGS, - FROMTEXTTYPE, FROMTEXTCLASS, FROMTEXTDEF); - doswitch("TOTEXTSWITCH", "totext", TOTEXTARGS, - TOTEXTTYPE, TOTEXTCLASS, TOTEXTDEF); - doswitch("FROMWIRESWITCH", "fromwire", FROMWIREARGS, - FROMWIRETYPE, FROMWIRECLASS, FROMWIREDEF); - doswitch("TOWIRESWITCH", "towire", TOWIREARGS, - TOWIRETYPE, TOWIRECLASS, TOWIREDEF); - doswitch("COMPARESWITCH", "compare", COMPAREARGS, - COMPARETYPE, COMPARECLASS, COMPAREDEF); - doswitch("FROMSTRUCTSWITCH", "fromstruct", FROMSTRUCTARGS, - FROMSTRUCTTYPE, FROMSTRUCTCLASS, FROMSTRUCTDEF); - doswitch("TOSTRUCTSWITCH", "tostruct", TOSTRUCTARGS, - TOSTRUCTTYPE, TOSTRUCTCLASS, TOSTRUCTDEF); + doswitch("FROMTEXTSWITCH", "fromtext", FROMTEXTARGS, + FROMTEXTTYPE, FROMTEXTCLASS, FROMTEXTDEF); + doswitch("TOTEXTSWITCH", "totext", TOTEXTARGS, + TOTEXTTYPE, TOTEXTCLASS, TOTEXTDEF); + doswitch("FROMWIRESWITCH", "fromwire", FROMWIREARGS, + FROMWIRETYPE, FROMWIRECLASS, FROMWIREDEF); + doswitch("TOWIRESWITCH", "towire", TOWIREARGS, + TOWIRETYPE, TOWIRECLASS, TOWIREDEF); + doswitch("COMPARESWITCH", "compare", COMPAREARGS, + COMPARETYPE, COMPARECLASS, COMPAREDEF); + doswitch("FROMSTRUCTSWITCH", "fromstruct", FROMSTRUCTARGS, + FROMSTRUCTTYPE, FROMSTRUCTCLASS, FROMSTRUCTDEF); + doswitch("TOSTRUCTSWITCH", "tostruct", TOSTRUCTARGS, + TOSTRUCTTYPE, TOSTRUCTCLASS, TOSTRUCTDEF); - fprintf(stdout, "\n#define TYPENAMES%s\n", - types != NULL ? " \\" : ""); + fprintf(stdout, "\n#define TYPENAMES%s\n", + types != NULL ? " \\" : ""); - lasttype = 0; - for (tt = types; tt != NULL ; tt = tt->next) - if (tt->type != lasttype) - fprintf(stdout, "\t{ %d, \"%s\" },%s\n", - lasttype = tt->type, upper(tt->typename), - tt->next != NULL ? " \\" : ""); + lasttype = 0; + for (tt = types; tt != NULL ; tt = tt->next) + if (tt->type != lasttype) + fprintf(stdout, "\t{ %d, \"%s\" },%s\n", + lasttype = tt->type, + upper(tt->typename), + tt->next != NULL ? " \\" : ""); - fputs("\n", stdout); - fprintf(stdout, "\n#define CLASSNAMES%s\n", - classes != NULL ? " \\" : ""); + fputs("\n", stdout); + fprintf(stdout, "\n#define CLASSNAMES%s\n", + classes != NULL ? " \\" : ""); - for (cc = classes; cc != NULL; cc = cc->next) - fprintf(stdout, "\t{ %d, \"%s\" },%s\n", cc->class, - upper(cc->classname), cc->next != NULL ? " \\" : ""); + for (cc = classes; cc != NULL; cc = cc->next) + fprintf(stdout, "\t{ %d, \"%s\" },%s\n", cc->class, + upper(cc->classname), + cc->next != NULL ? " \\" : ""); - fputs("\n", stdout); - for (tt = types; tt != NULL ; tt = tt->next) - fprintf(stdout, "#include \"%s/%s_%d.h\"\n", - tt->dirname, tt->typename, tt->type); + fputs("\n", stdout); + for (tt = types; tt != NULL ; tt = tt->next) + fprintf(stdout, "#include \"%s/%s_%d.h\"\n", + tt->dirname, tt->typename, tt->type); + } else if (type_enum) { + fprintf(stdout, "#ifndef TYPEENUM\n"); + fprintf(stdout, "#define TYPEENUM%s\n", + types != NULL ? " \\" : ""); + + lasttype = 0; + for (tt = types; tt != NULL ; tt = tt->next) + if (tt->type != lasttype) + fprintf(stdout, "\t ns_t_%s = %d,%s\n", + tt->typename, + lasttype = tt->type, + tt->next != NULL ? " \\" : ""); + fprintf(stdout, "#endif /* TYPEENUM */\n"); + } else if (class_enum) { + fprintf(stdout, "#ifndef CLASSENUM\n"); + fprintf(stdout, "#define CLASSENUM%s\n", + classes != NULL ? " \\" : ""); + + for (cc = classes; cc != NULL; cc = cc->next) + fprintf(stdout, "\t ns_c_%s = %d,%s\n", + cc->classname, + cc->class, + cc->next != NULL ? " \\" : ""); + fprintf(stdout, "#endif /* CLASSENUM */\n"); + + + } if (ferror(stdout) != 0) exit(1); diff --git a/lib/dns/include/dns/master.h b/lib/dns/include/dns/master.h index 249c85203b..d0d6cbf7b4 100644 --- a/lib/dns/include/dns/master.h +++ b/lib/dns/include/dns/master.h @@ -26,9 +26,13 @@ #include dns_result_t dns_load_master(char *master_file, + dns_name_t *top, dns_name_t *origin, dns_rdataclass_t class, + int *soacount, + int *nscount, dns_result_t (*callback)(dns_name_t *owner, - dns_rdataset_t *dataset), + dns_rdataset_t *dataset, + isc_mem_t *mctx), isc_mem_t *mctx); #endif /* DNS_MASTER_H */ diff --git a/lib/dns/include/dns/types.h b/lib/dns/include/dns/types.h index 58bacc93a9..cc2e38d71b 100644 --- a/lib/dns/include/dns/types.h +++ b/lib/dns/include/dns/types.h @@ -57,4 +57,17 @@ typedef enum { dns_bitlabel_1 = 1 } dns_bitlabel_t; +#include +enum { + ns_t_none = 0, + TYPEENUM + ns_t_any = 255 +} ns_type_t; +#include +enum { + ns_c_none = 0, + CLASSENUM + ns_c_any = 255 +} ns_class_t; + #endif /* DNS_TYPES_H */ diff --git a/lib/dns/master.c b/lib/dns/master.c index 081433ec59..a4140192ee 100644 --- a/lib/dns/master.c +++ b/lib/dns/master.c @@ -1,3 +1,24 @@ +/* + * Copyright (C) 1999 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + + /* $Id: master.c,v 1.5 1999/01/28 05:03:24 marka Exp $ */ + +#include + #include #include @@ -19,7 +40,9 @@ typedef ISC_LIST(dns_rdatalist_t) rdatalist_head_t; static dns_result_t commit(rdatalist_head_t *, dns_name_t *, dns_result_t (*)(dns_name_t *, - dns_rdataset_t *)); + dns_rdataset_t *, + isc_mem_t *), + isc_mem_t *); static isc_boolean_t is_glue(rdatalist_head_t *, dns_name_t *); static dns_rdatalist_t *grow_rdatalist(int, dns_rdatalist_t *, int, rdatalist_head_t *, @@ -29,10 +52,32 @@ static dns_rdata_t *grow_rdata(int, dns_rdata_t *, int, rdatalist_head_t *, rdatalist_head_t *, isc_mem_t *); +#define GETTOKEN(lexer, options, token, eol) \ + do { \ + unsigned int __o; \ + isc_token_t *__t = (token); \ + __o = (options) | ISC_LEXOPT_EOL | ISC_LEXOPT_EOF | \ + ISC_LEXOPT_DNSMULTILINE; \ + if (isc_lex_gettoken(lexer, __o, __t) \ + != ISC_R_SUCCESS) { \ + result = DNS_R_UNEXPECTED; \ + goto cleanup; \ + } \ + if (eol != ISC_TRUE) \ + if (__t->type == isc_tokentype_eol || \ + __t->type == isc_tokentype_eof) { \ + result = DNS_R_UNEXPECTEDEND; \ + goto cleanup; \ + } \ + } while (0) + + dns_result_t -dns_load_master(char *master_file, dns_name_t *origin, - dns_rdataclass_t zclass, dns_result_t (*callback)(), +dns_load_master(char *master_file, dns_name_t *top, dns_name_t *origin, + dns_rdataclass_t zclass, int *soacount, int *nscount, + dns_result_t (*callback)(dns_name_t *, dns_rdataset_t *, + isc_mem_t *mctx), isc_mem_t *mctx) { dns_rdataclass_t class; @@ -42,7 +87,7 @@ dns_load_master(char *master_file, dns_name_t *origin, dns_name_t current_name; dns_name_t glue_name; dns_name_t new_name; - dns_name_t origin_name; + dns_name_t origin_name = *origin; isc_boolean_t ttl_known = ISC_FALSE; isc_boolean_t default_ttl_known = ISC_FALSE; isc_boolean_t current_known = ISC_FALSE; @@ -51,20 +96,19 @@ dns_load_master(char *master_file, dns_name_t *origin, isc_boolean_t done = ISC_FALSE; isc_boolean_t finish_origin = ISC_FALSE; isc_boolean_t finish_include = ISC_FALSE; + isc_boolean_t read_till_eol = ISC_FALSE; char *include_file = NULL; isc_token_t token; isc_lex_t *lex = NULL; dns_result_t result = DNS_R_UNEXPECTED; rdatalist_head_t glue_list; rdatalist_head_t current_list; - unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF; dns_rdatalist_t *this; dns_rdatalist_t *rdatalist = NULL; dns_rdatalist_t *new_rdatalist; int rdlcount = 0; int rdlcount_save = 0; int rdatalist_size = 0; - isc_result_t lexres; isc_buffer_t buffer; isc_buffer_t target; isc_buffer_t target_save; @@ -114,21 +158,20 @@ dns_load_master(char *master_file, dns_name_t *origin, target_save = target; memset(name_in_use, 0, 5 * sizeof(isc_boolean_t)); do { - options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF | - ISC_LEXOPT_INITIALWS | ISC_LEXOPT_DNSMULTILINE; - lexres = isc_lex_gettoken(lex, options, &token); - if (lexres != ISC_R_SUCCESS) { - result = DNS_R_UNEXPECTED; - goto cleanup; - } + GETTOKEN(lex, ISC_LEXOPT_INITIALWS, &token, ISC_TRUE); if (token.type == isc_tokentype_eof) { done = ISC_TRUE; continue; } - if (token.type == isc_tokentype_eol) + if (token.type == isc_tokentype_eol) { + read_till_eol = ISC_FALSE; continue; /* blank line */ + } + + if (read_till_eol) + continue; if (token.type == isc_tokentype_initialws) { if (!current_known) { @@ -138,24 +181,16 @@ dns_load_master(char *master_file, dns_name_t *origin, /* still working on the same name */ } else if (token.type == isc_tokentype_string) { - /* XXX "$" Support */ + /* "$" Support */ if (strcasecmp(token.value.as_pointer, "$ORIGIN") == 0) { - options = ISC_LEXOPT_DNSMULTILINE; - lexres = isc_lex_gettoken(lex, options, &token); - if (lexres != ISC_R_SUCCESS) { - result = DNS_R_UNEXPECTED; - goto cleanup; - } + GETTOKEN(lex, 0, &token, ISC_FALSE); + read_till_eol = ISC_TRUE; finish_origin = ISC_TRUE; } else if (strcasecmp(token.value.as_pointer, "$TTL") == 0) { - options = ISC_LEXOPT_NUMBER; - lexres = isc_lex_gettoken(lex, options, &token); - if (lexres != ISC_R_SUCCESS) { - result = DNS_R_UNEXPECTED; - goto cleanup; - } + GETTOKEN(lex, ISC_LEXOPT_NUMBER, &token, + ISC_FALSE); ttl = token.value.as_ulong; if (ttl > 0x7fffffff) { result = DNS_R_RANGE; @@ -164,30 +199,24 @@ dns_load_master(char *master_file, dns_name_t *origin, default_ttl = ttl; ttl_known = ISC_TRUE; default_ttl_known = ISC_TRUE; + read_till_eol = ISC_TRUE; continue; } else if (strcasecmp(token.value.as_pointer, "$INCLUDE") == 0) { - options = 0; - lexres = isc_lex_gettoken(lex, options, &token); - if (lexres != ISC_R_SUCCESS) { - result = DNS_R_UNEXPECTED; - goto cleanup; - } + GETTOKEN(lex, 0, &token, ISC_FALSE); if (include_file != NULL) isc_mem_free(mctx, include_file); include_file = isc_mem_strdup(mctx, token.value.as_pointer); - options = ISC_LEXOPT_EOF | ISC_LEXOPT_EOL; - lexres = isc_lex_gettoken(lex, options, &token); - if (lexres != ISC_R_SUCCESS) { - result = DNS_R_UNEXPECTED; - goto cleanup; - } + GETTOKEN(lex, 0, &token, ISC_TRUE); if (token.type == isc_tokentype_eol || token.type == isc_tokentype_eof) { result = dns_load_master(include_file, - origin, + top, + &origin_name, zclass, + soacount, + nscount, callback, mctx); if (result != DNS_R_SUCCESS) @@ -195,6 +224,7 @@ dns_load_master(char *master_file, dns_name_t *origin, isc_lex_ungettoken(lex, &token); continue; } + read_till_eol = ISC_TRUE; finish_include = ISC_TRUE; } @@ -212,7 +242,7 @@ dns_load_master(char *master_file, dns_name_t *origin, isc_buffer_setactive(&buffer, token.value.as_region.length); result = dns_name_fromtext(&new_name, &buffer, - origin, ISC_FALSE, &name); + &origin_name, ISC_FALSE, &name); if (result != DNS_R_SUCCESS) goto cleanup; @@ -222,14 +252,17 @@ dns_load_master(char *master_file, dns_name_t *origin, origin_in_use = new_in_use; name_in_use[origin_in_use] = ISC_TRUE; origin_name = new_name; - origin = &origin_name; finish_origin =ISC_FALSE; continue; } if (finish_include) { result = dns_load_master(include_file, + top, &new_name, - zclass, callback, + zclass, + soacount, + nscount, + callback, mctx); if (result != DNS_R_SUCCESS) goto cleanup; @@ -242,7 +275,7 @@ dns_load_master(char *master_file, dns_name_t *origin, if (in_glue && dns_name_compare(&glue_name, &new_name) != 0) { result = commit(&glue_list, - &glue_name, callback); + &glue_name, callback, mctx); if (result != DNS_R_SUCCESS) goto cleanup; if (glue_in_use != -1) @@ -269,7 +302,7 @@ dns_load_master(char *master_file, dns_name_t *origin, } else { result = commit(¤t_list, ¤t_name, - callback); + callback, mctx); if (result != DNS_R_SUCCESS) goto cleanup; rdcount = 0; @@ -295,12 +328,7 @@ dns_load_master(char *master_file, dns_name_t *origin, type = 0; class = 0; - options = ISC_LEXOPT_NUMBER | ISC_LEXOPT_DNSMULTILINE; - if (isc_lex_gettoken(lex, options, &token) != ISC_R_SUCCESS) { - result = DNS_R_UNEXPECTED; - goto cleanup; - } - options = ISC_LEXOPT_DNSMULTILINE; + GETTOKEN(lex, ISC_LEXOPT_NUMBER, &token, ISC_FALSE); if (token.type == isc_tokentype_number) { ttl = token.value.as_ulong; @@ -309,50 +337,50 @@ dns_load_master(char *master_file, dns_name_t *origin, goto cleanup; } ttl_known = ISC_TRUE; - if (isc_lex_gettoken(lex, options, &token) != - ISC_R_SUCCESS) { - result = DNS_R_UNEXPECTED; - goto cleanup; - } + GETTOKEN(lex, 0, &token, ISC_FALSE); } else if (!ttl_known && !default_ttl_known) { result = DNS_R_UNEXPECTED; goto cleanup; } else if (default_ttl_known) ttl = default_ttl; - if (token.type != isc_tokentype_string) { + if (token.type != isc_tokentype_string) { result = DNS_R_UNEXPECTED; goto cleanup; } if (dns_rdataclass_fromtext(&class, &token.value.as_textregion) - == DNS_R_SUCCESS) { - - if (isc_lex_gettoken(lex, options, &token) != - ISC_R_SUCCESS) { - result = DNS_R_UNEXPECTED; - goto cleanup; - } - } + == DNS_R_SUCCESS) + GETTOKEN(lex, 0, &token, ISC_FALSE); if (token.type != isc_tokentype_string) { result = DNS_R_UNEXPECTED; goto cleanup; } - if (dns_rdatatype_fromtext(&type, &token.value.as_textregion) - != DNS_R_SUCCESS) { - result = DNS_R_UNEXPECTED; + result = dns_rdatatype_fromtext(&type, + &token.value.as_textregion); + if (result != DNS_R_SUCCESS) goto cleanup; - } if (class != 0 && class != zclass) { result = DNS_R_UNEXPECTED; goto cleanup; } - if (type == 2 && !in_glue) + if (!in_glue && type == ns_t_soa && + dns_name_compare(top, ¤t_name) == 0) { + (*soacount)++; + } + + if (!in_glue && type == ns_t_ns && + dns_name_compare(top, ¤t_name) == 0) { + (*nscount)++; + } + + if (type == ns_t_ns && !in_glue) current_has_delegation = ISC_TRUE; + if (in_glue) this = ISC_LIST_HEAD(glue_list); else @@ -402,17 +430,19 @@ dns_load_master(char *master_file, dns_name_t *origin, rdata = new_rdata; } result = dns_rdata_fromtext(&rdata[rdcount], class, type, - lex, origin, ISC_FALSE, &target); + lex, &origin_name, ISC_FALSE, &target); if (result != DNS_R_SUCCESS) goto cleanup; ISC_LIST_PREPEND(this->rdata, &rdata[rdcount], link); rdcount++; /* We must have at least 64k as rdlen is 16 bits. */ if (target.used > (64*1024)) { - result = commit(¤t_list, ¤t_name, callback); + result = commit(¤t_list, ¤t_name, + callback, mctx); if (result != DNS_R_SUCCESS) goto cleanup; - result = commit(&glue_list, &glue_name, callback); + result = commit(&glue_list, &glue_name, + callback, mctx); if (result != DNS_R_SUCCESS) goto cleanup; rdcount = 0; @@ -426,10 +456,10 @@ dns_load_master(char *master_file, dns_name_t *origin, ISC_BUFFERTYPE_BINARY); } } while (!done); - result = commit(¤t_list, ¤t_name, callback); + result = commit(¤t_list, ¤t_name, callback, mctx); if (result != DNS_R_SUCCESS) goto cleanup; - result = commit(&glue_list, &glue_name, callback); + result = commit(&glue_list, &glue_name, callback, mctx); if (result != DNS_R_SUCCESS) goto cleanup; result = DNS_R_SUCCESS; @@ -555,7 +585,9 @@ grow_rdata(int new_len, dns_rdata_t *old, int old_len, } static dns_result_t -commit(rdatalist_head_t *head, dns_name_t *owner, dns_result_t (*callback)()) { +commit(rdatalist_head_t *head, dns_name_t *owner, + dns_result_t (*callback)(), isc_mem_t *mctx) +{ dns_rdatalist_t *this; dns_rdataset_t dataset; dns_result_t result; @@ -564,7 +596,7 @@ commit(rdatalist_head_t *head, dns_name_t *owner, dns_result_t (*callback)()) { dns_rdataset_init(&dataset); dns_rdatalist_tordataset(this, &dataset); - result = ((*callback)(owner, &dataset)); + result = ((*callback)(owner, &dataset, mctx)); if (result != DNS_R_SUCCESS) return (result); ISC_LIST_UNLINK(*head, this, link); @@ -582,7 +614,7 @@ is_glue(rdatalist_head_t *head, dns_name_t *owner) { /* find NS rrset */ this = ISC_LIST_HEAD(*head); while (this != NULL) { - if (this->type == 2) + if (this->type == ns_t_ns) break; this = ISC_LIST_NEXT(this, link); }