]> 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>
Tue, 16 May 2023 02:04:55 +0000 (02:04 +0000)
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

index 17163405e094c4090f23a560070388ca464ae55e..db042798e8b498535e5b18406d673c8504afdc1a 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);