Skip to content

Commit b5b8c9c

Browse files
committed
ssh key storage MUST return pathbuf
1 parent ec4df69 commit b5b8c9c

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
# Changelog
22

33
- [Changelog](#changelog)
4+
- [0.1.2](#012)
45
- [0.1.1](#011)
56
- [0.1.0](#010)
67

78
---
89

10+
## 0.1.2
11+
12+
Released on 30/08/2022
13+
14+
- SshKeyStorage trait MUST return `PathBuf` instead of `Path`
15+
916
## 0.1.1
1017

1118
Released on 20/07/2022

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ license = "MIT"
1111
name = "remotefs-ssh"
1212
readme = "README.md"
1313
repository = "https://github.com/veeso/remotefs-rs-ssh"
14-
version = "0.1.1"
14+
version = "0.1.2"
1515

1616
[dependencies]
1717
chrono = "^0.4.19"
1818
lazy_static = "^1.4.0"
1919
log = "^0.4.14"
2020
regex = "^1.5.0"
2121
remotefs = "^0.2.0"
22-
ssh2-config = "^0.1.1"
22+
ssh2-config = "^0.1.3"
2323
ssh2 = "^0.9.0"
2424

2525
[dev-dependencies]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<p align="center">~ Remotefs SSH client ~</p>
1212

1313
<p align="center">Developed by <a href="https://veeso.github.io/" target="_blank">@veeso</a></p>
14-
<p align="center">Current version: 0.1.1 (20/07/2022)</p>
14+
<p align="center">Current version: 0.1.2 (30/08/2022)</p>
1515

1616
<p align="center">
1717
<a href="https://opensource.org/licenses/MIT"

src/mock/ssh.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ RorU9FCmS/654wAAABFyb290QDhjNTBmZDRjMzQ1YQECAw==
7474
}
7575

7676
impl SshKeyStorage for MockSshKeyStorage {
77-
fn resolve(&self, host: &str, username: &str) -> Option<&std::path::Path> {
77+
fn resolve(&self, host: &str, username: &str) -> Option<std::path::PathBuf> {
7878
match (host, username) {
79-
("127.0.0.1", "sftp") => Some(self.key.path()),
79+
("127.0.0.1", "sftp") => Some(self.key.path().to_path_buf()),
8080
_ => None,
8181
}
8282
}

src/ssh/commons.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub fn connect(opts: &SshOpts) -> RemoteResult<Session> {
112112
session_auth_with_rsakey(
113113
&mut session,
114114
&ssh_config.username,
115-
rsa_key,
115+
rsa_key.as_path(),
116116
opts.password.as_deref(),
117117
ssh_config.params.identity_file.as_deref(),
118118
)?;

src/ssh/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use stream::{SftpReadStream, SftpWriteStream};
4646
/// This trait must be implemented in order to use ssh keys for authentication for sftp/scp.
4747
pub trait SshKeyStorage {
4848
/// Return RSA key path from host and username
49-
fn resolve(&self, host: &str, username: &str) -> Option<&Path>;
49+
fn resolve(&self, host: &str, username: &str) -> Option<PathBuf>;
5050
}
5151

5252
// -- key method

0 commit comments

Comments
 (0)