mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-09-26 18:04:24 +00:00
Fix some LDAP CA bundle handling
- Make PINNIPED_TEST_LDAP_LDAPS_CA_BUNDLE optional for integration tests - When there is no CA bundle provided, be careful to use nil instead of an empty bundle, because nil means to use the OS defaults
This commit is contained in:
@@ -124,8 +124,9 @@ func (p *Provider) dial(ctx context.Context) (Conn, error) {
|
||||
// Unfortunately, the go-ldap library does not seem to support dialing with a context.Context,
|
||||
// so we implement it ourselves, heavily inspired by ldap.DialURL.
|
||||
func (p *Provider) dialTLS(ctx context.Context, hostAndPort string) (Conn, error) {
|
||||
rootCAs := x509.NewCertPool()
|
||||
var rootCAs *x509.CertPool
|
||||
if p.c.CABundle != nil {
|
||||
rootCAs = x509.NewCertPool()
|
||||
if !rootCAs.AppendCertsFromPEM(p.c.CABundle) {
|
||||
return nil, ldap.NewError(ldap.ErrorNetwork, fmt.Errorf("could not parse CA bundle"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user