From 489de2193d08f6a3090ede2ae80c25e2f5240e12 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Wed, 23 Dec 2020 19:52:32 -0300 Subject: [PATCH] fixing bug with new glue array --- tools/constants_test.go | 7 +++++++ tools/context.go | 4 +++- tools/pkcs11_signer_test.go | 6 ------ tools/rr_set.go | 8 ++------ 4 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 tools/constants_test.go diff --git a/tools/constants_test.go b/tools/constants_test.go new file mode 100644 index 0000000..16cc81e --- /dev/null +++ b/tools/constants_test.go @@ -0,0 +1,7 @@ +package tools_test + +// Using default softHSM configuration. Change it if necessary. +const p11Lib = "/usr/lib/softhsm/libsofthsm2.so" // Path used by Ubuntu Bionic Beaver +const p11Key = "1234" +const p11LabelRSA = "test-hsm-rsa" +const p11LabelECDSA = "test-hsm-ecdsa" diff --git a/tools/context.go b/tools/context.go index 9e0a806..aa4b145 100644 --- a/tools/context.go +++ b/tools/context.go @@ -51,7 +51,6 @@ func NewContext(config *ContextConfig, log *log.Logger) (ctx *Context, err error Config: config, Log: log, SignAlgorithm: algorithm, - Glue: make(map[string]struct{}), } if len(config.FilePath) > 0 { @@ -89,6 +88,9 @@ func (ctx *Context) ReadAndParseZone(updateSerial bool) error { if ctx.File == nil { return fmt.Errorf("no file defined on context") } + if ctx.Glue == nil { + ctx.Glue = make(map[string]struct{}) + } rrs := make(RRArray, 0) diff --git a/tools/pkcs11_signer_test.go b/tools/pkcs11_signer_test.go index 0d2f21a..f0b892d 100644 --- a/tools/pkcs11_signer_test.go +++ b/tools/pkcs11_signer_test.go @@ -9,12 +9,6 @@ import ( "github.com/niclabs/dns-tools/tools" ) -// Using default softHSM configuration. Change it if necessary. -const p11Lib = "/usr/lib/softhsm/libsofthsm2.so" // Path used by Ubuntu Bionic Beaver -const p11Key = "1234" -const p11LabelRSA = "test-hsm-rsa" -const p11LabelECDSA = "test-hsm-ecdsa" - func TestSession_PKCS11RSASign(t *testing.T) { ctx := &tools.Context{ Config: &tools.ContextConfig{ diff --git a/tools/rr_set.go b/tools/rr_set.go index b93a943..b41ab51 100644 --- a/tools/rr_set.go +++ b/tools/rr_set.go @@ -286,12 +286,8 @@ func (ctx *Context) addNSEC3Records() error { if typeMap[dns.TypeSOA] { typeMap[dns.TypeNSEC3PARAM] = true } - if !typeMap[dns.TypeDS] && !typeMap[dns.TypeDNSKEY] { - if ctx.Config.OptOut { - continue - } else { - ctx.Log.Printf("opt-out is not set and owner name %s has not a DS RR", rrSet[0].Header().Name) - } + if !typeMap[dns.TypeDS] && !typeMap[dns.TypeDNSKEY] && ctx.Config.OptOut { + continue } // Add current NSEC3 RR err := nsec3list.add(rrSet[0].Header().Name, param, typeMap)