mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
tls.Dial needs it for certificate verification.
This commit is contained in:
parent
ddfa82e990
commit
ca89f12be6
@ -11,6 +11,7 @@ import (
|
|||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -130,10 +131,16 @@ func authStatic(username string, password string, configUser string, configPassw
|
|||||||
|
|
||||||
func authLDAP(username string, password string, cfg config.LDAPConfiguration) bool {
|
func authLDAP(username string, password string, cfg config.LDAPConfiguration) bool {
|
||||||
address := cfg.Address
|
address := cfg.Address
|
||||||
|
hostname, _, err := net.SplitHostPort(address)
|
||||||
|
if err != nil {
|
||||||
|
hostname = address
|
||||||
|
}
|
||||||
var connection *ldap.Conn
|
var connection *ldap.Conn
|
||||||
var err error
|
|
||||||
if cfg.Transport == config.LDAPTransportTLS {
|
if cfg.Transport == config.LDAPTransportTLS {
|
||||||
connection, err = ldap.DialTLS("tcp", address, &tls.Config{InsecureSkipVerify: cfg.InsecureSkipVerify})
|
connection, err = ldap.DialTLS("tcp", address, &tls.Config{
|
||||||
|
ServerName: hostname,
|
||||||
|
InsecureSkipVerify: cfg.InsecureSkipVerify,
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
connection, err = ldap.Dial("tcp", address)
|
connection, err = ldap.Dial("tcp", address)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user