Skip to content

Commit c842ed3

Browse files
committed
Update bb8-async-ssh2-lite
1 parent 39b9a24 commit c842ed3

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

bb8-async-ssh2-lite/demo/src/tokio_tcp_stream.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
RUST_BACKTRACE=1 RUST_LOG=trace cargo run -p bb8-async-ssh2-lite-demo --bin bb8_asl_demo_tokio_tcp_stream -- 127.0.0.1:22 root
2+
RUST_BACKTRACE=1 RUST_LOG=trace cargo run -p bb8-async-ssh2-lite-demo --bin bb8_asl_demo_tokio_tcp_stream -- 127.0.0.1:22 root '~/.ssh/id_rsa'
33
*/
44

55
use std::env;
@@ -11,12 +11,17 @@ use futures_util::{future::join_all, AsyncReadExt as _};
1111
async fn main() -> Result<(), Box<dyn std::error::Error>> {
1212
let socket_addr = env::args().nth(1).ok_or("socket_addr missing")?.parse()?;
1313
let username = env::args().nth(2).ok_or("username missing")?;
14+
let privatekey = env::args().nth(3).ok_or("privatekey missing")?.parse()?;
1415

1516
let mgr = AsyncSessionManagerWithTokioTcpStream::new(
1617
socket_addr,
1718
None,
1819
username,
19-
AsyncSessionUserauthType::Agent,
20+
AsyncSessionUserauthType::PubkeyFile {
21+
pubkey: None,
22+
privatekey,
23+
passphrase: None,
24+
},
2025
);
2126

2227
let pool = bb8::Pool::builder().build(mgr).await?;

bb8-async-ssh2-lite/src/impl_tokio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl AsyncSessionManagerWithTokioTcpStream {
2222
userauth_type: AsyncSessionUserauthType,
2323
) -> Self {
2424
Self {
25-
socket_addr: socket_addr.into(),
25+
socket_addr,
2626
configuration: configuration.into(),
2727
username: username.as_ref().into(),
2828
userauth_type,
@@ -79,7 +79,7 @@ impl bb8::ManageConnection for AsyncSessionManagerWithTokioTcpStream {
7979
}
8080
}
8181

82-
if session.authenticated() {
82+
if !session.authenticated() {
8383
return Err(AsyncSessionManagerError::AssertAuthenticated);
8484
}
8585

0 commit comments

Comments
 (0)