316. [bug] EOF mid line should be a error.

315.   [bug]           Handle non-empty blanks lines.
This commit is contained in:
Mark Andrews 2000-07-09 12:52:34 +00:00
parent ddc12c6129
commit d1e971ba02
2 changed files with 43 additions and 11 deletions

View file

@ -1,3 +1,7 @@
316. [bug] EOF mid line should be a error.
315. [bug] Handle non-empty blanks lines.
314. [func] Inet controls named.conf statement can now have
any non-negative number of keys specified.

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: master.c,v 1.55 2000/06/29 15:55:19 marka Exp $ */
/* $Id: master.c,v 1.56 2000/07/09 12:52:34 marka Exp $ */
#include <config.h>
@ -186,6 +186,7 @@ load(isc_lex_t *lex, dns_name_t *top, dns_name_t *origin,
isc_boolean_t finish_origin = ISC_FALSE;
isc_boolean_t finish_include = ISC_FALSE;
isc_boolean_t read_till_eol = ISC_FALSE;
isc_boolean_t initialws;
char *include_file = NULL;
isc_token_t token;
isc_result_t result = ISC_R_UNEXPECTED;
@ -253,9 +254,18 @@ load(isc_lex_t *lex, dns_name_t *top, dns_name_t *origin,
memset(name_in_use, 0, NBUFS * sizeof(isc_boolean_t));
do {
initialws = ISC_FALSE;
GETTOKEN(lex, ISC_LEXOPT_INITIALWS, &token, ISC_TRUE);
if (token.type == isc_tokentype_eof) {
if (read_till_eol) {
(*callbacks->error)(callbacks,
"dns_master_load: %s:%lu: unexpected end of file",
isc_lex_getsourcename(lex),
isc_lex_getsourceline(lex));
result = ISC_R_UNEXPECTEDEND;
goto cleanup;
}
done = ISC_TRUE;
continue;
}
@ -269,18 +279,10 @@ load(isc_lex_t *lex, dns_name_t *top, dns_name_t *origin,
continue;
if (token.type == isc_tokentype_initialws) {
if (!current_known) {
(*callbacks->error)(callbacks,
"%s: %s:%lu: No current owner name",
"dns_master_load",
isc_lex_getsourcename(lex),
isc_lex_getsourceline(lex));
result = DNS_R_NOOWNER;
goto cleanup;
}
/*
* Still working on the same name.
*/
initialws = ISC_TRUE;
} else if (token.type == isc_tokentype_string) {
/*
@ -545,7 +547,33 @@ load(isc_lex_t *lex, dns_name_t *top, dns_name_t *origin,
type = 0;
rdclass = 0;
GETTOKEN(lex, 0, &token, ISC_FALSE);
GETTOKEN(lex, 0, &token, initialws);
if (initialws) {
if (token.type == isc_tokentype_eol) {
read_till_eol = ISC_FALSE;
continue; /* blank line */
}
if (token.type == isc_tokentype_eof) {
(*callbacks->error)(callbacks,
"dns_master_load: %s:%lu: unexpected end of file",
isc_lex_getsourcename(lex),
isc_lex_getsourceline(lex));
result = ISC_R_UNEXPECTEDEND;
goto cleanup;
}
if (!current_known) {
(*callbacks->error)(callbacks,
"%s: %s:%lu: No current owner name",
"dns_master_load",
isc_lex_getsourcename(lex),
isc_lex_getsourceline(lex));
result = DNS_R_NOOWNER;
goto cleanup;
}
}
if (dns_rdataclass_fromtext(&rdclass,
&token.value.as_textregion)