mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
allow buffer and stream loading
This commit is contained in:
@@ -38,19 +38,39 @@ ISC_LANG_BEGINDECLS
|
|||||||
*** Function
|
*** Function
|
||||||
***/
|
***/
|
||||||
|
|
||||||
dns_result_t dns_master_load(char *master_file,
|
dns_result_t dns_master_loadfile(char *master_file,
|
||||||
dns_name_t *top,
|
dns_name_t *top,
|
||||||
dns_name_t *origin,
|
dns_name_t *origin,
|
||||||
dns_rdataclass_t zclass,
|
dns_rdataclass_t zclass,
|
||||||
isc_boolean_t age_ttl,
|
isc_boolean_t age_ttl,
|
||||||
int *soacount,
|
int *soacount,
|
||||||
int *nscount,
|
int *nscount,
|
||||||
dns_rdatacallbacks_t *callbacks,
|
dns_rdatacallbacks_t *callbacks,
|
||||||
isc_mem_t *mctx);
|
isc_mem_t *mctx);
|
||||||
|
|
||||||
|
dns_result_t dns_master_loadstream(FILE *stream,
|
||||||
|
dns_name_t *top,
|
||||||
|
dns_name_t *origin,
|
||||||
|
dns_rdataclass_t zclass,
|
||||||
|
isc_boolean_t age_ttl,
|
||||||
|
int *soacount,
|
||||||
|
int *nscount,
|
||||||
|
dns_rdatacallbacks_t *callbacks,
|
||||||
|
isc_mem_t *mctx);
|
||||||
|
|
||||||
|
dns_result_t dns_master_loadbuffer(isc_buffer_t *buffer,
|
||||||
|
dns_name_t *top,
|
||||||
|
dns_name_t *origin,
|
||||||
|
dns_rdataclass_t zclass,
|
||||||
|
isc_boolean_t age_ttl,
|
||||||
|
int *soacount,
|
||||||
|
int *nscount,
|
||||||
|
dns_rdatacallbacks_t *callbacks,
|
||||||
|
isc_mem_t *mctx);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loads a RFC 1305 master file from disk into rdatasets then call
|
* Loads a RFC 1305 master file from a file, stream, or buffer into rdatasets
|
||||||
* 'callbacks->commit' to commit the dataset. Rdata memory belongs
|
* and then calls 'callbacks->commit' to commit the rdatasets. Rdata memory belongs
|
||||||
* to dns_master_load and will be reused / released when the callback
|
* to dns_master_load and will be reused / released when the callback
|
||||||
* completes. dns_load_master will abort if callbacks->commit returns
|
* completes. dns_load_master will abort if callbacks->commit returns
|
||||||
* any value other than DNS_R_SUCCESS.
|
* any value other than DNS_R_SUCCESS.
|
||||||
|
203
lib/dns/master.c
203
lib/dns/master.c
@@ -15,7 +15,7 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: master.c,v 1.21 1999/07/30 23:32:51 halley Exp $ */
|
/* $Id: master.c,v 1.22 1999/08/05 22:10:23 halley Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -87,8 +87,7 @@ static isc_boolean_t on_list(dns_rdatalist_t *this, dns_rdata_t *rdata);
|
|||||||
#define GETTOKEN(lexer, options, token, eol) \
|
#define GETTOKEN(lexer, options, token, eol) \
|
||||||
do { \
|
do { \
|
||||||
dns_result_t isc_r; \
|
dns_result_t isc_r; \
|
||||||
isc_r = gettoken(lexer, options, token, eol, \
|
isc_r = gettoken(lexer, options, token, eol, callbacks); \
|
||||||
master_file, callbacks); \
|
|
||||||
switch (isc_r) { \
|
switch (isc_r) { \
|
||||||
case DNS_R_SUCCESS: \
|
case DNS_R_SUCCESS: \
|
||||||
break; \
|
break; \
|
||||||
@@ -101,7 +100,7 @@ static isc_boolean_t on_list(dns_rdatalist_t *this, dns_rdata_t *rdata);
|
|||||||
|
|
||||||
static inline dns_result_t
|
static inline dns_result_t
|
||||||
gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *token,
|
gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *token,
|
||||||
isc_boolean_t eol, char *master_file, dns_rdatacallbacks_t *callbacks)
|
isc_boolean_t eol, dns_rdatacallbacks_t *callbacks)
|
||||||
{
|
{
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
@@ -124,21 +123,21 @@ gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *token,
|
|||||||
if (token->type == isc_tokentype_eol ||
|
if (token->type == isc_tokentype_eol ||
|
||||||
token->type == isc_tokentype_eof) {
|
token->type == isc_tokentype_eof) {
|
||||||
(*callbacks->error)(callbacks,
|
(*callbacks->error)(callbacks,
|
||||||
"dns_load_master: %s:%d unexpected end of %s\n",
|
"dns_master_load: %s:%d unexpected end of %s\n",
|
||||||
master_file,
|
isc_lex_getsourcename(lex),
|
||||||
isc_lex_getsourceline(lex),
|
isc_lex_getsourceline(lex),
|
||||||
(token->type == isc_tokentype_eol) ?
|
(token->type == isc_tokentype_eol) ?
|
||||||
"line" : "file");
|
"line" : "file");
|
||||||
return (DNS_R_UNEXPECTEDEND);
|
return (DNS_R_UNEXPECTEDEND);
|
||||||
}
|
}
|
||||||
return (DNS_R_SUCCESS);
|
return (DNS_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
dns_result_t
|
static dns_result_t
|
||||||
dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
load(isc_lex_t *lex, dns_name_t *top, dns_name_t *origin,
|
||||||
dns_rdataclass_t zclass, isc_boolean_t age_ttl,
|
dns_rdataclass_t zclass, isc_boolean_t age_ttl,
|
||||||
int *soacount, int *nscount, dns_rdatacallbacks_t *callbacks,
|
int *soacount, int *nscount, dns_rdatacallbacks_t *callbacks,
|
||||||
isc_mem_t *mctx)
|
isc_mem_t *mctx)
|
||||||
{
|
{
|
||||||
dns_rdataclass_t rdclass;
|
dns_rdataclass_t rdclass;
|
||||||
dns_rdatatype_t type;
|
dns_rdatatype_t type;
|
||||||
@@ -161,7 +160,6 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
isc_boolean_t warn_1035 = ISC_TRUE; /* XXX Arguement? */
|
isc_boolean_t warn_1035 = ISC_TRUE; /* XXX Arguement? */
|
||||||
char *include_file = NULL;
|
char *include_file = NULL;
|
||||||
isc_token_t token;
|
isc_token_t token;
|
||||||
isc_lex_t *lex = NULL;
|
|
||||||
dns_result_t result = DNS_R_UNEXPECTED;
|
dns_result_t result = DNS_R_UNEXPECTED;
|
||||||
isc_result_t iresult;
|
isc_result_t iresult;
|
||||||
rdatalist_head_t glue_list;
|
rdatalist_head_t glue_list;
|
||||||
@@ -191,7 +189,7 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
isc_buffer_t name;
|
isc_buffer_t name;
|
||||||
isc_lexspecials_t specials;
|
isc_lexspecials_t specials;
|
||||||
|
|
||||||
REQUIRE(master_file != NULL);
|
REQUIRE(lex != NULL);
|
||||||
REQUIRE(dns_name_isabsolute(top));
|
REQUIRE(dns_name_isabsolute(top));
|
||||||
REQUIRE(dns_name_isabsolute(origin));
|
REQUIRE(dns_name_isabsolute(origin));
|
||||||
REQUIRE(callbacks != NULL);
|
REQUIRE(callbacks != NULL);
|
||||||
@@ -208,17 +206,6 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
ISC_LIST_INIT(glue_list);
|
ISC_LIST_INIT(glue_list);
|
||||||
ISC_LIST_INIT(current_list);
|
ISC_LIST_INIT(current_list);
|
||||||
|
|
||||||
/*
|
|
||||||
* Set up lexer to process master file syntax.
|
|
||||||
*/
|
|
||||||
iresult = isc_lex_create(mctx, 256, &lex);
|
|
||||||
if (iresult != ISC_R_SUCCESS) {
|
|
||||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
|
||||||
"isc_lex_create() failed: %s\n",
|
|
||||||
isc_result_totext(iresult));
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(specials, 0, sizeof specials);
|
memset(specials, 0, sizeof specials);
|
||||||
specials['('] = 1;
|
specials['('] = 1;
|
||||||
specials[')'] = 1;
|
specials[')'] = 1;
|
||||||
@@ -226,17 +213,6 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
isc_lex_setspecials(lex, specials);
|
isc_lex_setspecials(lex, specials);
|
||||||
isc_lex_setcomments(lex, ISC_LEXCOMMENT_DNSMASTERFILE);
|
isc_lex_setcomments(lex, ISC_LEXCOMMENT_DNSMASTERFILE);
|
||||||
|
|
||||||
/*
|
|
||||||
* Open master file.
|
|
||||||
*/
|
|
||||||
iresult = isc_lex_openfile(lex, master_file);
|
|
||||||
if (iresult != ISC_R_SUCCESS) {
|
|
||||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
|
||||||
"isc_lex_openfile(%s) failed: %s\n",
|
|
||||||
master_file, isc_result_totext(iresult));
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate target_size of buffer space. This is greater than twice
|
* Allocate target_size of buffer space. This is greater than twice
|
||||||
* the maximum individual RR data size.
|
* the maximum individual RR data size.
|
||||||
@@ -272,8 +248,8 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
if (!current_known) {
|
if (!current_known) {
|
||||||
(*callbacks->error)(callbacks,
|
(*callbacks->error)(callbacks,
|
||||||
"%s: %s:%d: No current owner name\n",
|
"%s: %s:%d: No current owner name\n",
|
||||||
"dns_load_master",
|
"dns_master_load",
|
||||||
master_file,
|
isc_lex_getsourcename(lex),
|
||||||
isc_lex_getsourceline(lex));
|
isc_lex_getsourceline(lex));
|
||||||
result = DNS_R_NOOWNER;
|
result = DNS_R_NOOWNER;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -300,8 +276,8 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
ISC_FALSE);
|
ISC_FALSE);
|
||||||
if (token.type != isc_tokentype_number) {
|
if (token.type != isc_tokentype_number) {
|
||||||
(callbacks->warn)(callbacks,
|
(callbacks->warn)(callbacks,
|
||||||
"dns_load_master: %s:%d $TTL expects number\n",
|
"dns_master_load: %s:%d $TTL expects number\n",
|
||||||
master_file,
|
isc_lex_getsourcename(lex),
|
||||||
isc_lex_getsourceline(lex));
|
isc_lex_getsourceline(lex));
|
||||||
result = DNS_R_BADTTL;
|
result = DNS_R_BADTTL;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -309,8 +285,8 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
ttl = token.value.as_ulong;
|
ttl = token.value.as_ulong;
|
||||||
if (ttl > 0x7fffffffUL) {
|
if (ttl > 0x7fffffffUL) {
|
||||||
(callbacks->warn)(callbacks,
|
(callbacks->warn)(callbacks,
|
||||||
"dns_load_master: %s:%d $TTL %lu > MAXTLL, setting TTL to 0\n",
|
"dns_master_load: %s:%d $TTL %lu > MAXTLL, setting TTL to 0\n",
|
||||||
master_file,
|
isc_lex_getsourcename(lex),
|
||||||
isc_lex_getsourceline(lex),
|
isc_lex_getsourceline(lex),
|
||||||
ttl);
|
ttl);
|
||||||
ttl = 0;
|
ttl = 0;
|
||||||
@@ -324,9 +300,9 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
"$INCLUDE") == 0) {
|
"$INCLUDE") == 0) {
|
||||||
if (ttl_offset != 0) {
|
if (ttl_offset != 0) {
|
||||||
(callbacks->error)(callbacks,
|
(callbacks->error)(callbacks,
|
||||||
"dns_load_master: %s:%d: $INCLUDE "
|
"dns_master_load: %s:%d: $INCLUDE "
|
||||||
"may not be used with $DATE",
|
"may not be used with $DATE",
|
||||||
master_file,
|
isc_lex_getsourcename(lex),
|
||||||
isc_lex_getsourceline(lex));
|
isc_lex_getsourceline(lex));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@@ -342,15 +318,15 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
GETTOKEN(lex, 0, &token, ISC_TRUE);
|
GETTOKEN(lex, 0, &token, ISC_TRUE);
|
||||||
if (token.type == isc_tokentype_eol ||
|
if (token.type == isc_tokentype_eol ||
|
||||||
token.type == isc_tokentype_eof) {
|
token.type == isc_tokentype_eof) {
|
||||||
result = dns_master_load(include_file,
|
result = dns_master_loadfile(include_file,
|
||||||
top,
|
top,
|
||||||
&origin_name,
|
&origin_name,
|
||||||
zclass,
|
zclass,
|
||||||
age_ttl,
|
age_ttl,
|
||||||
soacount,
|
soacount,
|
||||||
nscount,
|
nscount,
|
||||||
callbacks,
|
callbacks,
|
||||||
mctx);
|
mctx);
|
||||||
if (result != DNS_R_SUCCESS)
|
if (result != DNS_R_SUCCESS)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
isc_lex_ungettoken(lex, &token);
|
isc_lex_ungettoken(lex, &token);
|
||||||
@@ -371,7 +347,7 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||||
"dns_master_load: %s:%d: "
|
"dns_master_load: %s:%d: "
|
||||||
"$DATE outside epoch",
|
"$DATE outside epoch",
|
||||||
master_file,
|
isc_lex_getsourcename(lex),
|
||||||
isc_lex_getsourceline(lex));
|
isc_lex_getsourceline(lex));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@@ -379,7 +355,7 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||||
"dns_master_load: %s:%d: "
|
"dns_master_load: %s:%d: "
|
||||||
"$DATE in future, using current date",
|
"$DATE in future, using current date",
|
||||||
master_file,
|
isc_lex_getsourcename(lex),
|
||||||
isc_lex_getsourceline(lex));
|
isc_lex_getsourceline(lex));
|
||||||
dump_time = current_time;
|
dump_time = current_time;
|
||||||
}
|
}
|
||||||
@@ -425,15 +401,15 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (finish_include) {
|
if (finish_include) {
|
||||||
result = dns_master_load(include_file,
|
result = dns_master_loadfile(include_file,
|
||||||
top,
|
top,
|
||||||
&new_name,
|
&new_name,
|
||||||
zclass,
|
zclass,
|
||||||
age_ttl,
|
age_ttl,
|
||||||
soacount,
|
soacount,
|
||||||
nscount,
|
nscount,
|
||||||
callbacks,
|
callbacks,
|
||||||
mctx);
|
mctx);
|
||||||
if (result != DNS_R_SUCCESS)
|
if (result != DNS_R_SUCCESS)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
finish_include = ISC_FALSE;
|
finish_include = ISC_FALSE;
|
||||||
@@ -508,7 +484,7 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
} else {
|
} else {
|
||||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||||
"%s:%d: isc_lex_gettoken() returned unexpeced token type (%d)\n",
|
"%s:%d: isc_lex_gettoken() returned unexpeced token type (%d)\n",
|
||||||
master_file,
|
isc_lex_getsourcename(lex),
|
||||||
isc_lex_getsourceline(lex),
|
isc_lex_getsourceline(lex),
|
||||||
token.type);
|
token.type);
|
||||||
result = DNS_R_UNEXPECTED;
|
result = DNS_R_UNEXPECTED;
|
||||||
@@ -539,8 +515,8 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
ttl = token.value.as_ulong;
|
ttl = token.value.as_ulong;
|
||||||
if (ttl > 0x7fffffffUL) {
|
if (ttl > 0x7fffffffUL) {
|
||||||
(callbacks->warn)(callbacks,
|
(callbacks->warn)(callbacks,
|
||||||
"dns_load_master: %s:%d TTL %lu > maxtll, setting ttl to 0\n",
|
"dns_master_load: %s:%d TTL %lu > maxtll, setting ttl to 0\n",
|
||||||
master_file,
|
isc_lex_getsourcename(lex),
|
||||||
isc_lex_getsourceline(lex),
|
isc_lex_getsourceline(lex),
|
||||||
ttl);
|
ttl);
|
||||||
ttl = 0;
|
ttl = 0;
|
||||||
@@ -556,7 +532,8 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
*/
|
*/
|
||||||
(*callbacks->error)(callbacks,
|
(*callbacks->error)(callbacks,
|
||||||
"%s: %s:%d no TTL specified\n",
|
"%s: %s:%d no TTL specified\n",
|
||||||
"dns_load_master", master_file,
|
"dns_master_load",
|
||||||
|
isc_lex_getsourcename(lex),
|
||||||
isc_lex_getsourceline(lex));
|
isc_lex_getsourceline(lex));
|
||||||
result = DNS_R_NOTTL;
|
result = DNS_R_NOTTL;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -565,7 +542,8 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
} else if (warn_1035) {
|
} else if (warn_1035) {
|
||||||
(*callbacks->warn)(callbacks,
|
(*callbacks->warn)(callbacks,
|
||||||
"%s: %s:%d using RFC 1035 TTL semantics\n",
|
"%s: %s:%d using RFC 1035 TTL semantics\n",
|
||||||
"dns_load_master", master_file,
|
"dns_master_load",
|
||||||
|
isc_lex_getsourcename(lex),
|
||||||
isc_lex_getsourceline(lex));
|
isc_lex_getsourceline(lex));
|
||||||
warn_1035 = ISC_FALSE;
|
warn_1035 = ISC_FALSE;
|
||||||
}
|
}
|
||||||
@@ -631,7 +609,8 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
len2 = region.length;
|
len2 = region.length;
|
||||||
(*callbacks->error)(callbacks,
|
(*callbacks->error)(callbacks,
|
||||||
"%s: %s:%d class (%*s) != zone class (%*s)\n",
|
"%s: %s:%d class (%*s) != zone class (%*s)\n",
|
||||||
"dns_load_master", master_file,
|
"dns_master_load",
|
||||||
|
isc_lex_getsourcename(lex),
|
||||||
isc_lex_getsourceline(lex),
|
isc_lex_getsourceline(lex),
|
||||||
len1, buf1, len2, buf2);
|
len1, buf1, len2, buf2);
|
||||||
result = DNS_R_BADCLASS;
|
result = DNS_R_BADCLASS;
|
||||||
@@ -700,7 +679,8 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
} else if (this->ttl != ttl) {
|
} else if (this->ttl != ttl) {
|
||||||
(*callbacks->warn)(callbacks,
|
(*callbacks->warn)(callbacks,
|
||||||
"%s: %s:%d: TTL set to prior TTL (%lu)\n",
|
"%s: %s:%d: TTL set to prior TTL (%lu)\n",
|
||||||
"dns_load_master", master_file,
|
"dns_master_load",
|
||||||
|
isc_lex_getsourcename(lex),
|
||||||
isc_lex_getsourceline(lex),
|
isc_lex_getsourceline(lex),
|
||||||
this->ttl);
|
this->ttl);
|
||||||
ttl = this->ttl;
|
ttl = this->ttl;
|
||||||
@@ -781,7 +761,7 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
error_cleanup:
|
error_cleanup:
|
||||||
(*callbacks->error)(callbacks, "dns_load_master: %s\n",
|
(*callbacks->error)(callbacks, "dns_master_load: %s\n",
|
||||||
dns_result_totext(result));
|
dns_result_totext(result));
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@@ -805,6 +785,81 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dns_result_t
|
||||||
|
dns_master_loadfile(char *master_file, dns_name_t *top, dns_name_t *origin,
|
||||||
|
dns_rdataclass_t zclass, isc_boolean_t age_ttl,
|
||||||
|
int *soacount, int *nscount, dns_rdatacallbacks_t *callbacks,
|
||||||
|
isc_mem_t *mctx)
|
||||||
|
{
|
||||||
|
isc_result_t result;
|
||||||
|
isc_lex_t *lex = NULL;
|
||||||
|
|
||||||
|
REQUIRE(master_file != NULL);
|
||||||
|
|
||||||
|
result = isc_lex_create(mctx, 2048, &lex);
|
||||||
|
if (result != ISC_R_SUCCESS)
|
||||||
|
return (result);
|
||||||
|
|
||||||
|
result = isc_lex_openfile(lex, master_file);
|
||||||
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
isc_lex_destroy(&lex);
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (load(lex, top, origin, zclass, age_ttl, soacount, nscount, callbacks,
|
||||||
|
mctx));
|
||||||
|
}
|
||||||
|
|
||||||
|
dns_result_t
|
||||||
|
dns_master_loadstream(FILE *stream, dns_name_t *top, dns_name_t *origin,
|
||||||
|
dns_rdataclass_t zclass, isc_boolean_t age_ttl,
|
||||||
|
int *soacount, int *nscount, dns_rdatacallbacks_t *callbacks,
|
||||||
|
isc_mem_t *mctx)
|
||||||
|
{
|
||||||
|
isc_result_t result;
|
||||||
|
isc_lex_t *lex = NULL;
|
||||||
|
|
||||||
|
REQUIRE(stream != NULL);
|
||||||
|
|
||||||
|
result = isc_lex_create(mctx, 2048, &lex);
|
||||||
|
if (result != ISC_R_SUCCESS)
|
||||||
|
return (result);
|
||||||
|
|
||||||
|
result = isc_lex_openstream(lex, stream);
|
||||||
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
isc_lex_destroy(&lex);
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (load(lex, top, origin, zclass, age_ttl, soacount, nscount, callbacks,
|
||||||
|
mctx));
|
||||||
|
}
|
||||||
|
|
||||||
|
dns_result_t
|
||||||
|
dns_master_loadbuffer(isc_buffer_t *buffer, dns_name_t *top, dns_name_t *origin,
|
||||||
|
dns_rdataclass_t zclass, isc_boolean_t age_ttl,
|
||||||
|
int *soacount, int *nscount, dns_rdatacallbacks_t *callbacks,
|
||||||
|
isc_mem_t *mctx)
|
||||||
|
{
|
||||||
|
isc_result_t result;
|
||||||
|
isc_lex_t *lex = NULL;
|
||||||
|
|
||||||
|
REQUIRE(buffer != NULL);
|
||||||
|
|
||||||
|
result = isc_lex_create(mctx, 2048, &lex);
|
||||||
|
if (result != ISC_R_SUCCESS)
|
||||||
|
return (result);
|
||||||
|
|
||||||
|
result = isc_lex_openbuffer(lex, buffer);
|
||||||
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
isc_lex_destroy(&lex);
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (load(lex, top, origin, zclass, age_ttl, soacount, nscount, callbacks,
|
||||||
|
mctx));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Grow the slab of dns_rdatalist_t structures.
|
* Grow the slab of dns_rdatalist_t structures.
|
||||||
* Re-link glue and current list.
|
* Re-link glue and current list.
|
||||||
|
Reference in New Issue
Block a user