mirror of
https://github.com/Noratrieb/cluelessh.git
synced 2026-01-16 09:25:04 +01:00
clippy
This commit is contained in:
parent
7cc5a75fe2
commit
b3081cfeb9
5 changed files with 9 additions and 9 deletions
|
|
@ -490,7 +490,7 @@ impl ServerChannelsState {
|
||||||
/// Send a single data packet.
|
/// Send a single data packet.
|
||||||
/// The caller needs to ensure the windowing and packet size requirements are upheld.
|
/// The caller needs to ensure the windowing and packet size requirements are upheld.
|
||||||
fn send_data_packet(&mut self, channel_number: ChannelNumber, data: &[u8]) {
|
fn send_data_packet(&mut self, channel_number: ChannelNumber, data: &[u8]) {
|
||||||
assert!(data.len() > 0, "Trying to send empty data packet");
|
assert!(!data.is_empty(), "Trying to send empty data packet");
|
||||||
|
|
||||||
trace!(%channel_number, amount = %data.len(), "Sending channel data");
|
trace!(%channel_number, amount = %data.len(), "Sending channel data");
|
||||||
let channel = self.channel(channel_number).unwrap();
|
let channel = self.channel(channel_number).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -89,13 +89,13 @@ impl ClientConnection {
|
||||||
self.packet_transport.recv_bytes(bytes)?;
|
self.packet_transport.recv_bytes(bytes)?;
|
||||||
|
|
||||||
while let Some(packet) = self.packet_transport.recv_next_packet() {
|
while let Some(packet) = self.packet_transport.recv_next_packet() {
|
||||||
let packet_type = packet.payload.get(0).unwrap_or(&0xFF);
|
let packet_type = packet.payload.first().unwrap_or(&0xFF);
|
||||||
let packet_type_string = numbers::packet_type_to_string(*packet_type);
|
let packet_type_string = numbers::packet_type_to_string(*packet_type);
|
||||||
|
|
||||||
trace!(%packet_type, %packet_type_string, packet_len = %packet.payload.len(), "Received packet");
|
trace!(%packet_type, %packet_type_string, packet_len = %packet.payload.len(), "Received packet");
|
||||||
|
|
||||||
// Handle some packets ignoring the state.
|
// Handle some packets ignoring the state.
|
||||||
match packet.payload.get(0).copied() {
|
match packet.payload.first().copied() {
|
||||||
Some(numbers::SSH_MSG_DISCONNECT) => {
|
Some(numbers::SSH_MSG_DISCONNECT) => {
|
||||||
// <https://datatracker.ietf.org/doc/html/rfc4253#section-11.1>
|
// <https://datatracker.ietf.org/doc/html/rfc4253#section-11.1>
|
||||||
let mut disconnect = Parser::new(&packet.payload[1..]);
|
let mut disconnect = Parser::new(&packet.payload[1..]);
|
||||||
|
|
|
||||||
|
|
@ -228,7 +228,7 @@ pub struct AlgorithmNegotiation<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: AlgorithmName> AlgorithmNegotiation<T> {
|
impl<T: AlgorithmName> AlgorithmNegotiation<T> {
|
||||||
pub fn find<'a>(mut self, peer_supports: &str) -> Result<T> {
|
pub fn find(mut self, peer_supports: &str) -> Result<T> {
|
||||||
for client_alg in peer_supports.split(',') {
|
for client_alg in peer_supports.split(',') {
|
||||||
if let Some(alg) = self
|
if let Some(alg) = self
|
||||||
.supported
|
.supported
|
||||||
|
|
@ -455,7 +455,7 @@ fn derive_key(
|
||||||
|
|
||||||
for i in 0..(padded_key_size / sha2len) {
|
for i in 0..(padded_key_size / sha2len) {
|
||||||
let mut hash = <sha2::Sha256 as sha2::Digest>::new();
|
let mut hash = <sha2::Sha256 as sha2::Digest>::new();
|
||||||
encode_mpint_for_hash(&k, |data| hash.update(data));
|
encode_mpint_for_hash(k, |data| hash.update(data));
|
||||||
hash.update(h);
|
hash.update(h);
|
||||||
|
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ pub fn packet_type_to_string(packet_type: u8) -> &'static str {
|
||||||
98 => "SSH_MSG_CHANNEL_REQUEST",
|
98 => "SSH_MSG_CHANNEL_REQUEST",
|
||||||
99 => "SSH_MSG_CHANNEL_SUCCESS",
|
99 => "SSH_MSG_CHANNEL_SUCCESS",
|
||||||
100 => "SSH_MSG_CHANNEL_FAILURE",
|
100 => "SSH_MSG_CHANNEL_FAILURE",
|
||||||
_ => return "<unknown>",
|
_ => "<unknown>",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,13 +78,13 @@ impl ServerConnection {
|
||||||
self.packet_transport.recv_bytes(bytes)?;
|
self.packet_transport.recv_bytes(bytes)?;
|
||||||
|
|
||||||
while let Some(packet) = self.packet_transport.recv_next_packet() {
|
while let Some(packet) = self.packet_transport.recv_next_packet() {
|
||||||
let packet_type = packet.payload.get(0).unwrap_or(&0xFF);
|
let packet_type = packet.payload.first().unwrap_or(&0xFF);
|
||||||
let packet_type_string = numbers::packet_type_to_string(*packet_type);
|
let packet_type_string = numbers::packet_type_to_string(*packet_type);
|
||||||
|
|
||||||
trace!(%packet_type, %packet_type_string, packet_len = %packet.payload.len(), "Received packet");
|
trace!(%packet_type, %packet_type_string, packet_len = %packet.payload.len(), "Received packet");
|
||||||
|
|
||||||
// Handle some packets ignoring the state.
|
// Handle some packets ignoring the state.
|
||||||
match packet.payload.get(0).copied() {
|
match packet.payload.first().copied() {
|
||||||
Some(numbers::SSH_MSG_DISCONNECT) => {
|
Some(numbers::SSH_MSG_DISCONNECT) => {
|
||||||
// <https://datatracker.ietf.org/doc/html/rfc4253#section-11.1>
|
// <https://datatracker.ietf.org/doc/html/rfc4253#section-11.1>
|
||||||
let mut disconnect = Parser::new(&packet.payload[1..]);
|
let mut disconnect = Parser::new(&packet.payload[1..]);
|
||||||
|
|
@ -217,7 +217,7 @@ impl ServerConnection {
|
||||||
let pub_hostkey = server_host_key_algorithm.public_key();
|
let pub_hostkey = server_host_key_algorithm.public_key();
|
||||||
|
|
||||||
let hash = crypto::key_exchange_hash(
|
let hash = crypto::key_exchange_hash(
|
||||||
&client_identification,
|
client_identification,
|
||||||
SERVER_IDENTIFICATION,
|
SERVER_IDENTIFICATION,
|
||||||
client_kexinit,
|
client_kexinit,
|
||||||
server_kexinit,
|
server_kexinit,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue