Commit 4a0d5a42 authored by Thomas Gatzweiler's avatar Thomas Gatzweiler
Browse files

Clean up some warnings

parent 42ab772a
......@@ -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(())
......
extern crate ssh;
use std::fs::File;
use std::io::prelude::*;
use ssh::public_key;
......
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
};
......
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 {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment