mirror of
https://github.com/minio/minio.git
synced 2025-04-03 19:30:29 -04:00
parent
67001e3ce9
commit
3a0e7347ca
@ -386,7 +386,9 @@ func (l *Config) Connect() (ldapConn *ldap.Conn, err error) {
|
|||||||
return nil, errors.New("LDAP is not configured")
|
return nil, errors.New("LDAP is not configured")
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, _, err = net.SplitHostPort(l.ServerAddr); err != nil {
|
serverHost, _, err := net.SplitHostPort(l.ServerAddr)
|
||||||
|
if err != nil {
|
||||||
|
serverHost = l.ServerAddr
|
||||||
// User default LDAP port if none specified "636"
|
// User default LDAP port if none specified "636"
|
||||||
l.ServerAddr = net.JoinHostPort(l.ServerAddr, "636")
|
l.ServerAddr = net.JoinHostPort(l.ServerAddr, "636")
|
||||||
}
|
}
|
||||||
@ -395,22 +397,22 @@ func (l *Config) Connect() (ldapConn *ldap.Conn, err error) {
|
|||||||
return ldap.Dial("tcp", l.ServerAddr)
|
return ldap.Dial("tcp", l.ServerAddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tlsConfig := &tls.Config{
|
||||||
|
InsecureSkipVerify: l.tlsSkipVerify,
|
||||||
|
RootCAs: l.rootCAs,
|
||||||
|
ServerName: serverHost,
|
||||||
|
}
|
||||||
|
|
||||||
if l.serverStartTLS {
|
if l.serverStartTLS {
|
||||||
conn, err := ldap.Dial("tcp", l.ServerAddr)
|
conn, err := ldap.Dial("tcp", l.ServerAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
err = conn.StartTLS(&tls.Config{
|
err = conn.StartTLS(tlsConfig)
|
||||||
InsecureSkipVerify: l.tlsSkipVerify,
|
|
||||||
RootCAs: l.rootCAs,
|
|
||||||
})
|
|
||||||
return conn, err
|
return conn, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return ldap.DialTLS("tcp", l.ServerAddr, &tls.Config{
|
return ldap.DialTLS("tcp", l.ServerAddr, tlsConfig)
|
||||||
InsecureSkipVerify: l.tlsSkipVerify,
|
|
||||||
RootCAs: l.rootCAs,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetExpiryDuration - return parsed expiry duration.
|
// GetExpiryDuration - return parsed expiry duration.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user