Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Mar 11, 2022
1 parent ec3caf2 commit 5949fcf
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 23 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ A full implementation of the SSH 2 protocol, both server-side and client-side.

Thrussh is completely asynchronous, and can be combined with other protocols using [Tokio](//tokio.rs).

## Panics
## Safety

`deny(clippy::panic)` except for:
* `deny(clippy::unwrap_used)`
* `deny(clippy::expect_used)`
* `deny(clippy::indexing_slicing)`
* `deny(clippy::panic)`
* Exceptions are checked manually

### Panics

* When the Rust allocator fails to allocate memory during a CryptoVec being resized.

## Unsafe code
### Unsafe code

* `cryptovec` uses `unsafe` for faster copying, initialization and binding to native API.
* `russh-libsodium` uses `unsafe` for `libsodium` bindings.
Expand Down
2 changes: 1 addition & 1 deletion cryptovec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ impl CryptoVec {
/// Create a `CryptoVec` from a slice
///
/// ```
/// CryptoVec::from_slice(b"test");
/// russh_cryptovec::CryptoVec::from_slice(b"test");
/// ```
pub fn from_slice(s: &[u8]) -> CryptoVec {
let mut v = CryptoVec::new();
Expand Down
1 change: 1 addition & 0 deletions files/id_ed25519.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK2pr+Bfus1hvPof4Wb/plZCzSbqadHH0u+/f4ODtKnE [email protected]
15 changes: 0 additions & 15 deletions shell.nix

This file was deleted.

2 changes: 1 addition & 1 deletion thrussh-keys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const KEYTYPE_RSA: &[u8] = b"ssh-rsa";
/// Load a public key from a file. Ed25519 and RSA keys are supported.
///
/// ```
/// thrussh_keys::load_public_key("/home/pe/.ssh/id_ed25519.pub").unwrap();
/// thrussh_keys::load_public_key("../files/id_ed25519.pub").unwrap();
/// ```
pub fn load_public_key<P: AsRef<Path>>(path: P) -> Result<key::PublicKey, Error> {
let mut pubkey = String::new();
Expand Down
3 changes: 0 additions & 3 deletions thrussh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,6 @@ mod test_compress {
let _ = env_logger::try_init();

let client_key = thrussh_keys::key::KeyPair::generate_ed25519().unwrap();
let client_pubkey = Arc::new(client_key.clone_public_key());
let mut config = server::Config::default();
config.preferred = Preferred::COMPRESSED;
config.connection_timeout = None; // Some(std::time::Duration::from_secs(3));
Expand All @@ -681,7 +680,6 @@ mod test_compress {
.push(thrussh_keys::key::KeyPair::generate_ed25519().unwrap());
let config = Arc::new(config);
let mut sh = Server {
client_pubkey,
clients: Arc::new(Mutex::new(HashMap::new())),
id: 0,
};
Expand Down Expand Up @@ -721,7 +719,6 @@ mod test_compress {

#[derive(Clone)]
struct Server {
client_pubkey: Arc<thrussh_keys::key::PublicKey>,
clients: Arc<Mutex<HashMap<(usize, ChannelId), super::server::Handle>>>,
id: usize,
}
Expand Down

0 comments on commit 5949fcf

Please sign in to comment.