mirror of
https://gitlab.redox-os.org/CoffeeCode/redox-ssh.git
synced 2025-12-28 13:22:19 +01:00
Fix sequence counting bug
This commit is contained in:
parent
4a0d5a42df
commit
3f23c15783
2 changed files with 10 additions and 15 deletions
|
|
@ -86,7 +86,7 @@ impl<'a> Connection {
|
|||
trace!("Packet {} received: {:?}", self.seq.0, packet);
|
||||
self.process(packet)?;
|
||||
|
||||
self.seq.0.wrapping_add(1);
|
||||
self.seq.0 = self.seq.0.wrapping_add(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ impl<'a> Connection {
|
|||
packet.write_to(&mut self.stream)?;
|
||||
}
|
||||
|
||||
self.seq.1.wrapping_add(1);
|
||||
self.seq.1 = self.seq.1.wrapping_add(1);
|
||||
|
||||
if let Some((_, ref mut mac)) = self.mac {
|
||||
let mut sig = vec![0; mac.size()];
|
||||
|
|
|
|||
|
|
@ -21,27 +21,22 @@ impl Server {
|
|||
}
|
||||
|
||||
pub fn run(&self) -> io::Result<()> {
|
||||
let listener = TcpListener::bind(
|
||||
(&*self.config.host, self.config.port),
|
||||
).expect(&*format!(
|
||||
"sshd: failed to bind to {}:{}",
|
||||
self.config.as_ref().host,
|
||||
self.config.as_ref().port
|
||||
));
|
||||
let listener =
|
||||
TcpListener::bind((&*self.config.host, self.config.port))?;
|
||||
|
||||
loop {
|
||||
let (mut stream, addr) = listener.accept().expect(&*format!(
|
||||
"sshd: failed to establish incoming connection"
|
||||
));
|
||||
let (mut stream, addr) = listener.accept()?;
|
||||
|
||||
println!("Incoming connection from {}", addr);
|
||||
debug!("Incoming connection from {}", addr);
|
||||
|
||||
let mut read_stream = stream.try_clone()?;
|
||||
|
||||
let mut connection = Connection::new(
|
||||
ConnectionType::Server(self.config.clone()),
|
||||
Box::new(stream.try_clone().unwrap()),
|
||||
Box::new(stream),
|
||||
);
|
||||
|
||||
let result = connection.run(&mut stream);
|
||||
let result = connection.run(&mut read_stream);
|
||||
if let Some(error) = result.err() {
|
||||
println!("sshd: {}", error)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue