Skip to content

Commit

Permalink
fix: resolved host from configuration wasn't used
Browse files Browse the repository at this point in the history
  • Loading branch information
veeso committed Jul 9, 2024
1 parent 69c6d14 commit 4d867c4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/ssh/commons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ pub fn connect(opts: &SshOpts) -> RemoteResult<Session> {
return Err(RemoteError::new_ex(RemoteErrorType::ProtocolError, err));
}
// Authenticate with password or key
match opts
.key_storage
.as_ref()
.and_then(|x| x.resolve(ssh_config.host.as_str(), ssh_config.username.as_str()))
{
match opts.key_storage.as_ref().and_then(|x| {
x.resolve(ssh_config.host.as_str(), ssh_config.username.as_str())
.or(x.resolve(
ssh_config.resolved_host.as_str(),
ssh_config.username.as_str(),
))
}) {
Some(rsa_key) => {
session_auth_with_rsakey(
&mut session,
Expand Down

0 comments on commit 4d867c4

Please sign in to comment.