From 277bec352e9917c9dc437b50fb0fc9defd431ae3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?H=C3=A5kan=20Lindqvist?= Date: Sat, 28 May 2016 19:17:57 +0200 Subject: [PATCH] Validate names with address records to be valid hostnames in pdnsutil check-zone --- pdns/pdnsutil.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index 1283930d54..0136acede5 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -564,6 +564,17 @@ int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, const vect } } + if(rr.qtype.getCode() == QType::A || rr.qtype.getCode() == QType::AAAA) + { + Regex hostnameRegex=Regex("^(([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?)\\.)+$"); + if (!hostnameRegex.match(rr.qname.toString())) + { + cout<<"[Error] A or AAAA record found at '"<