From 092d7745b47c1a19a6533514ff7a05387b5c5bf9 Mon Sep 17 00:00:00 2001 From: Jens Erat Date: Thu, 28 Feb 2019 07:32:07 +0100 Subject: [PATCH] Ignore empty lines when parsing private keys (#911) When migrating zones to CoreDNS, it did not accept private key files the former bind setup gracefully accepted. It turned out they had a trailing newline for whateveer reason. The dns library should handle them gracefully, too. --- dnssec_keyscan.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dnssec_keyscan.go b/dnssec_keyscan.go index 5e654223..26f812a0 100644 --- a/dnssec_keyscan.go +++ b/dnssec_keyscan.go @@ -322,6 +322,11 @@ func (kl *klexer) Next() (lex, bool) { commt = false } + if kl.key && str.Len() == 0 { + // ignore empty lines + break + } + kl.key = true l.value = zValue