]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Properly process extra nameserver lines in resolv.conf
authorMark Andrews <marka@isc.org>
Mon, 15 May 2023 00:34:16 +0000 (10:34 +1000)
committerMark Andrews <marka@isc.org>
Wed, 17 May 2023 22:52:17 +0000 (08:52 +1000)
The whole line needs to be read rather than just the token "nameserver"
otherwise the next line in resolv.conf is not properly processed.

(cherry picked from commit 864cd080523fcbafd5a79f69922e4ebe2dd5885f)

lib/irs/resconf.c

index 096064bef9bf08089119c65fb45d6c8e4b45eaa0..f3b7be5dbef6b7a931700f86a0247c9d7e77ea62 100644 (file)
@@ -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);