Fix known host expires check
This commit is contained in:
parent
eaa034204a
commit
be55224f89
|
@ -34,7 +34,7 @@ The way this is implemented in this package is like so:
|
||||||
|
|
||||||
1. Client makes a request with `NewRequest`. The client then sends the request
|
1. Client makes a request with `NewRequest`. The client then sends the request
|
||||||
with `Send(*Request) (*Response, error)`. The client can optionally verify
|
with `Send(*Request) (*Response, error)`. The client can optionally verify
|
||||||
the server certificates with `VerifyCertificate(*x509.Certificate, *Request)`
|
the server certificate with `VerifyCertificate(*x509.Certificate, *Request)`
|
||||||
2. Server recieves the request and constructs a response.
|
2. Server recieves the request and constructs a response.
|
||||||
The server calls the `Serve(*ResponseWriter, *Request)` method on the
|
The server calls the `Serve(*ResponseWriter, *Request)` method on the
|
||||||
`Handler` field. The handler writes the response. The server then closes
|
`Handler` field. The handler writes the response. The server then closes
|
||||||
|
|
2
tofu.go
2
tofu.go
|
@ -26,7 +26,7 @@ func (k KnownHosts) Has(hostname string, cert *x509.Certificate) bool {
|
||||||
now := time.Now().Unix()
|
now := time.Now().Unix()
|
||||||
fingerprint := Fingerprint(cert)
|
fingerprint := Fingerprint(cert)
|
||||||
for i := range k {
|
for i := range k {
|
||||||
if k[i].Expires < now && k[i].Hostname == hostname && k[i].Fingerprint == fingerprint {
|
if k[i].Expires > now && k[i].Hostname == hostname && k[i].Fingerprint == fingerprint {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user