Skip to content

Commit

Permalink
Merge pull request #61 from chanderlud/main
Browse files Browse the repository at this point in the history
  • Loading branch information
Miyoshi-Ryota authored Jun 10, 2024
2 parents 10cf660 + 3171dec commit 7ff5ff8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ authors = ["Miyoshi-Ryota <[email protected]>"]
openssl = ["russh/openssl"]

[dependencies]
russh = "0.40.2"
russh-keys = "0.40.1"
russh-sftp = "2.0.0-beta.4"
russh = "0.43"
russh-keys = "0.43"
russh-sftp = "2.0.1"
thiserror = "1.0"
async-trait = "0.1.61"
async-trait = "0.1"
tokio = { version = "1", features = ["fs"] }

[dev-dependencies]
14 changes: 7 additions & 7 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,22 +414,22 @@ impl Handler for ClientHandler {
type Error = crate::Error;

async fn check_server_key(
self,
&mut self,
server_public_key: &russh_keys::key::PublicKey,
) -> Result<(Self, bool), Self::Error> {
) -> Result<bool, Self::Error> {
match &self.server_check {
ServerCheckMethod::NoCheck => Ok((self, true)),
ServerCheckMethod::NoCheck => Ok(true),
ServerCheckMethod::PublicKey(key) => {
let pk = russh_keys::parse_public_key_base64(key)
.map_err(|_| crate::Error::ServerCheckFailed)?;

Ok((self, pk == *server_public_key))
Ok(pk == *server_public_key)
}
ServerCheckMethod::PublicKeyFile(key_file_name) => {
let pk = russh_keys::load_public_key(key_file_name)
.map_err(|_| crate::Error::ServerCheckFailed)?;

Ok((self, pk == *server_public_key))
Ok(pk == *server_public_key)
}
ServerCheckMethod::KnownHostsFile(known_hosts_path) => {
let result = russh_keys::check_known_hosts_path(
Expand All @@ -440,7 +440,7 @@ impl Handler for ClientHandler {
)
.map_err(|_| crate::Error::ServerCheckFailed)?;

Ok((self, result))
Ok(result)
}
ServerCheckMethod::DefaultKnownHostsFile => {
let result = russh_keys::check_known_hosts(
Expand All @@ -450,7 +450,7 @@ impl Handler for ClientHandler {
)
.map_err(|_| crate::Error::ServerCheckFailed)?;

Ok((self, result))
Ok(result)
}
}
}
Expand Down

0 comments on commit 7ff5ff8

Please sign in to comment.