Skip to content

Commit

Permalink
all: fix another panic in cert parsing (#21)
Browse files Browse the repository at this point in the history
Fixes #20.
  • Loading branch information
ainar-g authored Apr 13, 2023
1 parent 6ca80e7 commit d84a81e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ func (c *Client) DialStamp(stamp dnsstamps.ServerStamp) (*ResolverInfo, error) {
if err != nil {
return nil, err
}

resolverInfo.SharedKey = sharedKey

return resolverInfo, nil
}

Expand Down Expand Up @@ -251,7 +253,10 @@ func (c *Client) fetchCert(stamp dnsstamps.ServerStamp) (cert *Cert, err error)
cert, err = parseCert(stamp, currentCert, providerName, strings.Join(txt.Txt, ""))
if err != nil {
log.Debug("[%s] bad cert: %s", providerName, err)

continue
} else if cert == nil {
// The certificate has been skipped due to Serial or EsVersion.
continue
}

Expand All @@ -262,7 +267,7 @@ func (c *Client) fetchCert(stamp dnsstamps.ServerStamp) (cert *Cert, err error)
if foundValid {
return currentCert, nil
} else if err == nil {
err = errors.Error("no valid txt records")
err = fmt.Errorf("no valid txt records for provider %q", providerName)
}

return nil, err
Expand Down

0 comments on commit d84a81e

Please sign in to comment.