Skip to content

Commit 13a210f

Browse files
authored
Merge pull request #580 from Litrop/master
Clone tlsCfg with ServerName because ServerName is needed by StartTLS
2 parents f5def9c + 6401870 commit 13a210f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/auth/ldap/ldap.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ func (a *Auth) newConn() (*ldap.Conn, error) {
147147
return nil, fmt.Errorf("auth.ldap: invalid server URL: %w", err)
148148
}
149149
hostname := parsedURL.Host
150+
a.tlsCfg.ServerName = strings.Split(hostname, ":")[0]
150151
tlsCfg = a.tlsCfg.Clone()
151-
a.tlsCfg.ServerName = hostname
152152

153153
conn, err = ldap.DialURL(u, ldap.DialWithDialer(a.dialer), ldap.DialWithTLSConfig(tlsCfg))
154154
if err != nil {

0 commit comments

Comments
 (0)