forked from TrueCloudLab/certificates
Allow nil engines
This commit is contained in:
parent
2a15e3eee1
commit
8b54e25f64
2 changed files with 8 additions and 1 deletions
|
@ -65,7 +65,7 @@ func New(chain ...*x509.Certificate) *Engine {
|
|||
// Validate checks the given names with the name constraints defined in the
|
||||
// service.
|
||||
func (s *Engine) Validate(dnsNames []string, ipAddresses []net.IP, emailAddresses []string, uris []*url.URL) error {
|
||||
if !s.hasNameConstraints {
|
||||
if s == nil || !s.hasNameConstraints {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -222,3 +222,10 @@ func Test_service_Validate(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_service_Validate_nil(t *testing.T) {
|
||||
var s *Engine
|
||||
if err := s.Validate([]string{"www.example.com"}, nil, nil, nil); err != nil {
|
||||
t.Errorf("service.Validate() error = %v, wantErr false", err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue