@@ -395,19 +395,19 @@ fn check_ssh_known_hosts_loaded(
395
395
KnownHostLineType :: Key => {
396
396
if key_matches {
397
397
accepted_known_host_found = true ;
398
+ } else {
399
+ // The host and key type matched, but the key itself did not.
400
+ // This indicates the key has changed.
401
+ // This is only reported as an error if no subsequent lines have a
402
+ // correct key.
403
+ latent_errors. push ( KnownHostError :: HostKeyHasChanged {
404
+ hostname : host. to_string ( ) ,
405
+ key_type : remote_key_type,
406
+ old_known_host : known_host. clone ( ) ,
407
+ remote_host_key : remote_host_key_encoded. clone ( ) ,
408
+ remote_fingerprint : remote_fingerprint. clone ( ) ,
409
+ } ) ;
398
410
}
399
-
400
- // The host and key type matched, but the key itself did not.
401
- // This indicates the key has changed.
402
- // This is only reported as an error if no subsequent lines have a
403
- // correct key.
404
- latent_errors. push ( KnownHostError :: HostKeyHasChanged {
405
- hostname : host. to_string ( ) ,
406
- key_type : remote_key_type,
407
- old_known_host : known_host. clone ( ) ,
408
- remote_host_key : remote_host_key_encoded. clone ( ) ,
409
- remote_fingerprint : remote_fingerprint. clone ( ) ,
410
- } ) ;
411
411
}
412
412
KnownHostLineType :: Revoked => {
413
413
if key_matches {
0 commit comments