Skip to content

Commit ce0baa8

Browse files
committed
avoid shadowing
1 parent adf6f3f commit ce0baa8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ldap/ldap.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,16 @@ func (l *Config) Clone() (cloned Config) {
9191
}
9292

9393
func (l *Config) connect(ldapAddr string) (ldapConn *ldap.Conn, err error) {
94-
tls := l.TLS
95-
if tls != nil && tls.ServerName == "" {
94+
tlsConfig := l.TLS
95+
if tlsConfig != nil && tlsConfig.ServerName == "" {
9696
// Set the server name to the LDAP server address.
9797
colonPos := strings.LastIndex(ldapAddr, ":")
9898
if colonPos == -1 {
9999
colonPos = len(ldapAddr)
100100
}
101101
host := ldapAddr[:colonPos]
102-
tls = l.TLS.Clone()
103-
tls.ServerName = host
102+
tlsConfig = l.TLS.Clone()
103+
tlsConfig.ServerName = host
104104
}
105105

106106
if l.ServerInsecure {
@@ -109,14 +109,14 @@ func (l *Config) connect(ldapAddr string) (ldapConn *ldap.Conn, err error) {
109109
if l.ServerStartTLS {
110110
ldapConn, err = ldap.Dial("tcp", ldapAddr)
111111
} else {
112-
ldapConn, err = ldap.DialTLS("tcp", ldapAddr, tls)
112+
ldapConn, err = ldap.DialTLS("tcp", ldapAddr, tlsConfig)
113113
}
114114
}
115115

116116
if ldapConn != nil {
117117
ldapConn.SetTimeout(30 * time.Second) // Change default timeout to 30 seconds.
118118
if l.ServerStartTLS {
119-
err = ldapConn.StartTLS(tls)
119+
err = ldapConn.StartTLS(tlsConfig)
120120
}
121121
}
122122

0 commit comments

Comments
 (0)