Binding BIND

I downloaded BIND 8.2.3 [1] and in poking around the source code, found the offending code [2] that prevented the parsing of DNS zone files in a certain format. It was a one line modification to fix the problem:

bind/src/bin/named/db_load.c:1594

#ifndef BIND_UPDATE
static
#endif
int
getnonblank(FILE *fp, const char *src, int multiline) {
        int c;

        **multiline = 1;  /* hack to fix --spc */**
        while ((c = getc(fp)) != EOF) {
                if (isspace(c)) {
                        if (c == '\n') {
                                if (multiline)
                                        lineno++;
                                else
                                        goto eol;
                        }
                        continue;
                }
                if (c == ';') {
                        while ((c = getc(fp)) != EOF && c != '\n')
                                ;
                        if (c == '\n') {
                                if (multiline)
                                        lineno++;
                                else
                                        goto eol;
                        }
                        continue;
                }
                return (c);
        }
        ns_info(ns_log_db, "%s:%d: unexpected EOF", src, lineno);
        return (EOF);
 eol:
        ns_error(ns_log_db, "%s:%d: unexpected end of line", src, lineno);
        /* don't ungetc(c, fp); as the caller will do this. */
        return(c);
}

Sigh.

[1] http://www.isc.org/products/BIND/bind8.html

[2] /boston/2001/01/30.3

Gemini Mention this post

Contact the author