Don't store wildcards in the known hosts file

This commit is contained in:
adnano
2020-09-27 15:03:46 -04:00
parent 0343248952
commit e01d59f8f6
4 changed files with 14 additions and 10 deletions

View File

@@ -48,11 +48,11 @@ var DefaultClient *Client
func init() {
DefaultClient = &Client{
TrustCertificate: func(cert *x509.Certificate, knownHosts *KnownHosts) error {
TrustCertificate: func(req *Request, cert *x509.Certificate, knownHosts *KnownHosts) error {
// Load the hosts only once. This is so that the hosts don't have to be loaded
// for those using their own clients.
setupDefaultClientOnce.Do(setupDefaultClient)
return knownHosts.Lookup(cert)
return knownHosts.Lookup(req.Hostname(), cert)
},
}
}