forked from toolshed/abra
chore: bump deps
This commit is contained in:
38
vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go
generated
vendored
38
vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go
generated
vendored
@ -302,8 +302,8 @@ func (k *KnownKey) String() string {
|
||||
// applications can offer an interactive prompt to the user.
|
||||
type KeyError struct {
|
||||
// Want holds the accepted host keys. For each key algorithm,
|
||||
// there can be one hostkey. If Want is empty, the host is
|
||||
// unknown. If Want is non-empty, there was a mismatch, which
|
||||
// there can be multiple hostkeys. If Want is empty, the host
|
||||
// is unknown. If Want is non-empty, there was a mismatch, which
|
||||
// can signify a MITM attack.
|
||||
Want []KnownKey
|
||||
}
|
||||
@ -358,34 +358,20 @@ func (db *hostKeyDB) checkAddr(a addr, remoteKey ssh.PublicKey) error {
|
||||
// is just a key for the IP address, but not for the
|
||||
// hostname?
|
||||
|
||||
// Algorithm => key.
|
||||
knownKeys := map[string]KnownKey{}
|
||||
keyErr := &KeyError{}
|
||||
|
||||
for _, l := range db.lines {
|
||||
if l.match(a) {
|
||||
typ := l.knownKey.Key.Type()
|
||||
if _, ok := knownKeys[typ]; !ok {
|
||||
knownKeys[typ] = l.knownKey
|
||||
}
|
||||
if !l.match(a) {
|
||||
continue
|
||||
}
|
||||
|
||||
keyErr.Want = append(keyErr.Want, l.knownKey)
|
||||
if keyEq(l.knownKey.Key, remoteKey) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
keyErr := &KeyError{}
|
||||
for _, v := range knownKeys {
|
||||
keyErr.Want = append(keyErr.Want, v)
|
||||
}
|
||||
|
||||
// Unknown remote host.
|
||||
if len(knownKeys) == 0 {
|
||||
return keyErr
|
||||
}
|
||||
|
||||
// If the remote host starts using a different, unknown key type, we
|
||||
// also interpret that as a mismatch.
|
||||
if known, ok := knownKeys[remoteKey.Type()]; !ok || !keyEq(known.Key, remoteKey) {
|
||||
return keyErr
|
||||
}
|
||||
|
||||
return nil
|
||||
return keyErr
|
||||
}
|
||||
|
||||
// The Read function parses file contents.
|
||||
|
Reference in New Issue
Block a user