tobez / validns

DNS and DNSSEC zone file validator
Other
77 stars 26 forks source link

Couple of issues with zone syntax parsing #34

Open MarkMartinec opened 10 years ago

MarkMartinec commented 10 years ago

Trying to validate our zones before signing, found one zone which causes multiple reported errors by validns (version 0.7, also the current github master), but is reported as correct by named-checkzone (and bind 9.9.4), as well as by ldns-verify-zone (apart from one bug in that validator). Also the bind loads and serves that zone correctly.

The issue is mainly about parsing labels containing special characters like UTF-8 and spaces. As far as I can tell these are correctly quoted according to RFC 1035 zone file format. The two "name server domain name is not valid" errors are especially weird.

This is the result of running validns on that file, no command line options:

db-test:13: name server domain name is not valid
db-test:14: a dot within a label is not currently supported
db-test:15: name server domain name is not valid
db-test:18: record name is not valid
db-test:19: cannot assume previous name for it is not known
db-test:20: a dot within a label is not currently supported
db-test:21: cannot assume previous name for it is not known
db-test:22: record name is not valid
db-test:23: cannot assume previous name for it is not known
db-test:28: record name expected
db-test:29: record name expected
db-test:30: record name is not valid

And here is the zone file db-test (I hope the 8-bit bytes will be preserved in the following quotation):

$ORIGIN ijs.si.
$TTL 3600
@   86400   IN  SOA niobe.ijs.si. hostmaster.ijs.si. (
              2013110961 28800 3600 2419200 3600 )
            NS  niobe.ijs.si.
niobe                   A       193.2.4.24
niobe                   AAAA    2001:1470:ff80::24
www         A   193.2.4.17
www         AAAA    2001:1470:ff80::80:1
nabiralnik      A   193.2.4.16
nabiralnik      AAAA    2001:1470:ff80::80:16

_http._tcp  PTR 01\ Institut\ \"Jožef\ Stefan\"._http._tcp
        PTR 02\ Koledar\.prireditev._http._tcp
        PTR 03\ WLAN\ @\ IJS,\ Eduroam._http._tcp
        PTR 04\ Web\ access\ to\ IJS\ mailboxes._http._tcp

01\ Institut\ \"Jožef\ Stefan\"._http._tcp SRV 0 0 80 www
        TXT "path=/"
02\ Koledar\.prireditev._http._tcp      SRV 0 0 80 www
        TXT "path=/ijsw/Koledar_prireditev"
03\ WLAN\ @\ IJS,\ Eduroam._http._tcp       SRV 0 0 80 www
        TXT "path=/ijsw/Brez%C5%BEi%C4%8Dno_omre%C5%BEje"
04\ Web\ access\ to\ IJS\ mailboxes._http._tcp  SRV 0 0 80 nabiralnik
        TXT "path=/"

test-lat1   TXT  "ma\241ana en M\252nchen"
"ma\241ana" TXT  "ma\241ana en M\252nchen"
"la manyana"    TXT  "ma\241ana en M\252nchen"
la-mañana  TXT  "ma\241ana en M\252nchen"
tobez commented 10 years ago

Mark,

On Tue, Nov 12, 2013 at 05:35:14AM -0800, Mark Martinec wrote:

Trying to validate our zones before signing, found one zone which causes multiple reported errors by validns (version 0.7, also the current github master), but is reported as correct by named-checkzone (and bind 9.9.4), as well as by ldns-verify-zone (apart from one bug in that validator). Also the bind loads and serves that zone correctly.

The issue is mainly about parsing labels containing special characters like UTF-8 and spaces. As far as I can tell these are correctly quoted according to RFC 1035 zone file format. The two "name server domain name is not valid" errors are especially weird.

Thanks for reporting this.

The "name server domain name is not valid" is weird because in the source code, the error message for PTRs was copied from the error message for NSes, so it is just a typo and should say "domain name is not valid" or "PTR domain name is not valid".

Anyway. These are all easily fixable, with a single exception, and will be fixed soon.

The exception is "a dot within a label is not currently supported". To fix this will require substantial changes to the internal representation of label, so it might take some time.

Cheers,

\Anton.

Our society can survive even a large amount of irrational regulation. -- John McCarthy