mirror of
https://gitlab.redox-os.org/CoffeeCode/redox-ssh.git
synced 2025-12-28 15:02:18 +01:00
Clean up some warnings
This commit is contained in:
parent
42ab772a72
commit
4a0d5a42df
6 changed files with 15 additions and 17 deletions
|
|
@ -215,9 +215,10 @@ impl FromStr for MacAlgorithm {
|
|||
use self::MacAlgorithm::*;
|
||||
match s
|
||||
{
|
||||
"hmac-sha1" => Ok(MacAlgorithm::HMAC_SHA1),
|
||||
"hmac-sha2-256" => Ok(MacAlgorithm::HMAC_SHA2_256),
|
||||
"hmac-sha2-512" => Ok(MacAlgorithm::HMAC_SHA2_512),
|
||||
"hmac-sha1" => Ok(HMAC_SHA1),
|
||||
"hmac-sha2-256" => Ok(HMAC_SHA2_256),
|
||||
"hmac-sha2-512" => Ok(HMAC_SHA2_512),
|
||||
"none" => Ok(MacAlgorithm::None),
|
||||
_ => {
|
||||
debug!("Unknown mac algorithm: {}", s);
|
||||
Err(())
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
extern crate ssh;
|
||||
use std::fs::File;
|
||||
use std::io::prelude::*;
|
||||
|
||||
use ssh::public_key;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
use std::borrow::BorrowMut;
|
||||
use std::io::{self, BufRead, BufReader, Read, Write};
|
||||
use std::sync::Arc;
|
||||
|
||||
|
|
@ -20,7 +19,6 @@ enum ConnectionState {
|
|||
#[derive(Clone)]
|
||||
pub enum ConnectionType {
|
||||
Server(Arc<ServerConfig>),
|
||||
Client,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
|
|
@ -88,7 +86,7 @@ impl<'a> Connection {
|
|||
trace!("Packet {} received: {:?}", self.seq.0, packet);
|
||||
self.process(packet)?;
|
||||
|
||||
self.seq.0 += 1;
|
||||
self.seq.0.wrapping_add(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +107,7 @@ impl<'a> Connection {
|
|||
packet.write_to(&mut self.stream)?;
|
||||
}
|
||||
|
||||
self.seq.1 += 1;
|
||||
self.seq.1.wrapping_add(1);
|
||||
|
||||
if let Some((_, ref mut mac)) = self.mac {
|
||||
let mut sig = vec![0; mac.size()];
|
||||
|
|
@ -322,7 +320,7 @@ impl<'a> Connection {
|
|||
|
||||
if want_reply {
|
||||
let mut res = Packet::new(MessageType::ChannelSuccess);
|
||||
res.with_writer(&|w| w.write_uint32(0));
|
||||
res.with_writer(&|w| w.write_uint32(0))?;
|
||||
self.send(res)?;
|
||||
}
|
||||
|
||||
|
|
@ -340,7 +338,7 @@ impl<'a> Connection {
|
|||
Ok(())
|
||||
})?;
|
||||
|
||||
self.send(res);
|
||||
self.send(res)?;
|
||||
|
||||
debug!(
|
||||
"Channel {} Data ({} bytes): {:?}",
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ impl KeyExchange for Curve25519 {
|
|||
buf.write_mpint(BigInt::from_bytes_be(
|
||||
Sign::Plus,
|
||||
&curve25519::curve25519(&server_secret, &client_public),
|
||||
));
|
||||
)).ok();
|
||||
buf
|
||||
};
|
||||
|
||||
|
|
@ -106,10 +106,10 @@ impl KeyExchange for Curve25519 {
|
|||
];
|
||||
|
||||
for item in items.iter() {
|
||||
buf.write_bytes(item);
|
||||
buf.write_bytes(item).ok();
|
||||
}
|
||||
|
||||
buf.write_raw_bytes(&shared_secret);
|
||||
buf.write_raw_bytes(&shared_secret).ok();
|
||||
|
||||
buf
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
mod curve25519;
|
||||
mod dh_group_sha1;
|
||||
// mod dh_group_sha1;
|
||||
|
||||
pub use self::curve25519::Curve25519;
|
||||
pub use self::dh_group_sha1::DhGroupSha1;
|
||||
// pub use self::dh_group_sha1::DhGroupSha1;
|
||||
|
||||
use connection::Connection;
|
||||
use packet::Packet;
|
||||
|
|
|
|||
|
|
@ -103,8 +103,8 @@ impl KeyPair for Ed25519KeyPair {
|
|||
if let Some(private_key) = self.private {
|
||||
let mut result = Vec::new();
|
||||
let sig = ed25519::signature(data, &private_key);
|
||||
result.write_string("ssh-ed25519").or(Err(()));
|
||||
result.write_bytes(&sig).or(Err(()));
|
||||
result.write_string("ssh-ed25519").or(Err(()))?;
|
||||
result.write_bytes(&sig).or(Err(()))?;
|
||||
Ok(result)
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue