From 864cd080523fcbafd5a79f69922e4ebe2dd5885f Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 15 May 2023 10:34:16 +1000 Subject: [PATCH] Properly process extra nameserver lines in resolv.conf The whole line needs to be read rather than just the token "nameserver" otherwise the next line in resolv.conf is not properly processed. --- lib/dns/resconf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/dns/resconf.c b/lib/dns/resconf.c index 17163405e0..db042798e8 100644 --- a/lib/dns/resconf.c +++ b/lib/dns/resconf.c @@ -288,10 +288,6 @@ resconf_parsenameserver(irs_resconf_t *conf, FILE *fp) { int cp; isc_result_t result; - if (conf->numns == RESCONFMAXNAMESERVERS) { - return (ISC_R_SUCCESS); - } - cp = getword(fp, word, sizeof(word)); if (strlen(word) == 0U) { return (ISC_R_UNEXPECTEDEND); /* Nothing on line. */ @@ -303,6 +299,10 @@ resconf_parsenameserver(irs_resconf_t *conf, FILE *fp) { return (ISC_R_UNEXPECTEDTOKEN); /* Extra junk on line. */ } + if (conf->numns == RESCONFMAXNAMESERVERS) { + return (ISC_R_SUCCESS); + } + result = add_server(conf->mctx, word, &conf->nameservers); if (result != ISC_R_SUCCESS) { return (result);