Merge branch '110-libirs-do-not-ignore-resolv.conf-syntax-errors' into 'master'

libirs: Do not ignore resolv.conf syntax errors

Closes #110

See merge request isc-projects/bind9!78
This commit is contained in:
Michał Kępień
2018-03-06 03:22:37 -05:00
5 changed files with 39 additions and 5 deletions

View File

@@ -1,4 +1,8 @@
4904. [bug] Temporarily revert change #4859. [GL #124]
4905. [bug] irs_resconf_load() ignored resolv.conf syntax errors
when "domain" or "search" options were present in that
file. [GL #110]
4904. [bug] Temporarily revert change #4859. [GL #124]
4903. [bug] "check-mx fail;" did not prevent MX records containing
IP addresses from being added to a zone by a dynamic

View File

@@ -503,6 +503,7 @@ irs_resconf_load(isc_mem_t *mctx, const char *filename, irs_resconf_t **confp)
conf->mctx = mctx;
ISC_LIST_INIT(conf->nameservers);
ISC_LIST_INIT(conf->searchlist);
conf->numns = 0;
conf->domainname = NULL;
conf->searchnxt = 0;
@@ -557,6 +558,10 @@ irs_resconf_load(isc_mem_t *mctx, const char *filename, irs_resconf_t **confp)
}
}
if (ret != ISC_R_SUCCESS) {
goto error;
}
/* If we don't find a nameserver fall back to localhost */
if (conf->numns == 0U) {
INSIST(ISC_LIST_EMPTY(conf->nameservers));
@@ -570,7 +575,6 @@ irs_resconf_load(isc_mem_t *mctx, const char *filename, irs_resconf_t **confp)
* Construct unified search list from domain or configured
* search list
*/
ISC_LIST_INIT(conf->searchlist);
if (conf->domainname != NULL) {
ret = add_search(conf, conf->domainname);
} else if (conf->searchnxt > 0) {
@@ -581,6 +585,7 @@ irs_resconf_load(isc_mem_t *mctx, const char *filename, irs_resconf_t **confp)
}
}
error:
conf->magic = IRS_RESCONF_MAGIC;
if (ret != ISC_R_SUCCESS)

View File

@@ -56,9 +56,6 @@ ATF_TC_BODY(irs_resconf_load, tc) {
isc_result_t checkres;
} tests[] = {
{
"testdata/sortlist-v4.conf", ISC_R_SUCCESS,
NULL, ISC_R_SUCCESS
}, {
"testdata/domain.conf", ISC_R_SUCCESS,
NULL, ISC_R_SUCCESS
}, {
@@ -82,6 +79,12 @@ ATF_TC_BODY(irs_resconf_load, tc) {
}, {
"testdata/options.conf", ISC_R_SUCCESS,
NULL, ISC_R_SUCCESS
}, {
"testdata/options-bad-ndots.conf", ISC_R_RANGE,
NULL, ISC_R_SUCCESS
}, {
"testdata/options-empty.conf", ISC_R_UNEXPECTEDEND,
NULL, ISC_R_SUCCESS
}, {
"testdata/port.conf", ISC_R_SUCCESS,
NULL, ISC_R_SUCCESS

View File

@@ -0,0 +1,11 @@
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
search example.com example.net
options ndots:256

View File

@@ -0,0 +1,11 @@
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
domain example.com
options