diff --git a/build.assets/Makefile b/build.assets/Makefile index 412e6bb4df6..dc1a59ce592 100644 --- a/build.assets/Makefile +++ b/build.assets/Makefile @@ -24,16 +24,16 @@ ARCH ?= amd64 BUILDBOX_VERSION ?= teleport11 # NOTE: Windows Drone scripts hardcode $GOLANG_VERSION rather than drawing it -# from here at build time, so any changes here must be reflected in +# from here at build time, so any changes here must be reflected in # `dronegen/windows.go` GOLANG_VERSION ?= go1.18.3 # NOTE: Windows Drone scripts hardcode $NODE_VERSION rather than drawing it -# from here at build time, so any changes here must be reflected in +# from here at build time, so any changes here must be reflected in # `dronegen/windows.go` NODE_VERSION ?= 16.13.2 -RUST_VERSION ?= 1.58.1 # don't bump this without checking GLIBC compatibility +RUST_VERSION ?= 1.63.0 # don't bump this without checking GLIBC compatibility BORINGCRYPTO_RUNTIME=$(GOLANG_VERSION)b7 LIBBPF_VERSION ?= 0.7.0-teleport diff --git a/lib/srv/desktop/rdp/rdpclient/src/lib.rs b/lib/srv/desktop/rdp/rdpclient/src/lib.rs index efd3123e32f..7673385b70a 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/lib.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/lib.rs @@ -352,10 +352,10 @@ fn connect_rdp_inner( } Err(_) => { // TODO(isaiah): change TryError to TeleportError for a generic error caused by Teleport specific code. - return Err(RdpError::TryError(format!( + Err(RdpError::TryError(format!( "path contained characters that couldn't be converted to a C string: {:?}", req.path - ))); + ))) } } }); @@ -386,10 +386,10 @@ fn connect_rdp_inner( } Err(_) => { // TODO(isaiah): change TryError to TeleportError for a generic error caused by Teleport specific code. - return Err(RdpError::TryError(format!( + Err(RdpError::TryError(format!( "path contained characters that couldn't be converted to a C string: {:?}", req.path - ))); + ))) } } }); @@ -419,10 +419,10 @@ fn connect_rdp_inner( } Err(_) => { // TODO(isaiah): change TryError to TeleportError for a generic error caused by Teleport specific code. - return Err(RdpError::TryError(format!( + Err(RdpError::TryError(format!( "path contained characters that couldn't be converted to a C string: {:?}", req.path - ))); + ))) } } }); @@ -451,10 +451,10 @@ fn connect_rdp_inner( } Err(_) => { // TODO(isaiah): change TryError to TeleportError for a generic error caused by Teleport specific code. - return Err(RdpError::TryError(format!( + Err(RdpError::TryError(format!( "path contained characters that couldn't be converted to a C string: {:?}", req.path - ))); + ))) } } }); @@ -484,12 +484,10 @@ fn connect_rdp_inner( } Ok(()) } - Err(_) => { - return Err(RdpError::TryError(format!( - "path contained characters that couldn't be converted to a C string: {:?}", - req.path - ))); - } + Err(_) => Err(RdpError::TryError(format!( + "path contained characters that couldn't be converted to a C string: {:?}", + req.path + ))), } }); @@ -519,12 +517,10 @@ fn connect_rdp_inner( } Ok(()) } - Err(_) => { - return Err(RdpError::TryError(format!( - "path contained characters that couldn't be converted to a C string: {:?}", - req.path - ))); - } + Err(_) => Err(RdpError::TryError(format!( + "path contained characters that couldn't be converted to a C string: {:?}", + req.path + ))), } }); @@ -552,19 +548,15 @@ fn connect_rdp_inner( } Ok(()) } - Err(_) => { - return Err(RdpError::TryError(format!( - "new_path contained characters that couldn't be converted to a C string: {:?}", - req.new_path - ))); - } + Err(_) => Err(RdpError::TryError(format!( + "new_path contained characters that couldn't be converted to a C string: {:?}", + req.new_path + ))), }, - Err(_) => { - return Err(RdpError::TryError(format!( - "original_path contained characters that couldn't be converted to a C string: {:?}", - req.original_path - ))); - } + Err(_) => Err(RdpError::TryError(format!( + "original_path contained characters that couldn't be converted to a C string: {:?}", + req.original_path + ))), } }); @@ -1391,7 +1383,7 @@ unsafe fn from_go_array(data: *mut T, len: u32) -> Vec { } #[repr(C)] -#[derive(Copy, Clone, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum CGOErrCode { ErrCodeSuccess = 0, ErrCodeFailure = 1, @@ -1549,14 +1541,14 @@ impl From for FileSystemObject { } #[repr(C)] -#[derive(Copy, Clone, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum FileType { File = 0, Directory = 1, } #[repr(C)] -#[derive(Copy, Clone, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum TdpErrCode { /// nil (no error, operation succeeded) Nil = 0, diff --git a/lib/srv/desktop/rdp/rdpclient/src/piv.rs b/lib/srv/desktop/rdp/rdpclient/src/piv.rs index 3943cc5c359..5b6d1dbf607 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/piv.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/piv.rs @@ -22,6 +22,7 @@ use rdp::model::error::*; use rsa::pkcs1::DecodeRsaPrivateKey; use rsa::{BigUint, PublicKeyParts, RsaPrivateKey}; use std::convert::TryFrom; +use std::fmt::Write as _; use std::io::{Cursor, Read}; use uuid::Uuid; @@ -138,12 +139,12 @@ impl Card { } fn handle_verify(&mut self, cmd: Command) -> RdpResult { - return if cmd.data() == self.pin.as_bytes() { + if cmd.data() == self.pin.as_bytes() { Ok(Response::new(Status::Success)) } else { warn!("PIN mismatch, want {}, got {:?}", self.pin, cmd.data()); Ok(Response::new(Status::VerificationFailed)) - }; + } } fn handle_get_data(&mut self, cmd: Command) -> RdpResult { @@ -420,7 +421,8 @@ fn hex_data(cmd: &Command) -> String { fn to_hex(bytes: &[u8]) -> String { let mut s = String::new(); for b in bytes { - s.push_str(&format!("{:02X}", b)); + // https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string + let _ = write!(s, "{:02X}", b); } s } diff --git a/lib/srv/desktop/rdp/rdpclient/src/rdpdr/consts.rs b/lib/srv/desktop/rdp/rdpclient/src/rdpdr/consts.rs index 9905ef81db3..946a5cba264 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/rdpdr/consts.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/rdpdr/consts.rs @@ -79,7 +79,7 @@ pub enum DeviceType { } /// https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpefs/a087ffa8-d0d5-4874-ac7b-0494f63e2d5d -#[derive(Debug, FromPrimitive, ToPrimitive, PartialEq, Clone)] +#[derive(Debug, FromPrimitive, ToPrimitive, PartialEq, Eq, Clone)] #[allow(non_camel_case_types)] pub enum MajorFunction { IRP_MJ_CREATE = 0x00000000, @@ -106,7 +106,7 @@ pub enum MinorFunction { /// Windows defines an absolutely massive list of potential NTSTATUS values. /// This enum includes the basic ones we support for communicating with the windows machine. /// https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55 -#[derive(ToPrimitive, Debug, PartialEq)] +#[derive(ToPrimitive, Debug, PartialEq, Eq)] #[repr(u32)] #[allow(non_camel_case_types)] #[allow(dead_code)] @@ -125,7 +125,7 @@ pub enum NTSTATUS { /// 2.4 File Information Classes [MS-FSCC] /// https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/4718fc40-e539-4014-8e33-b675af74e3e1 -#[derive(FromPrimitive, Debug, PartialEq, Clone)] +#[derive(FromPrimitive, Debug, PartialEq, Eq, Clone)] #[repr(u32)] #[allow(clippy::enum_variant_names)] pub enum FileInformationClassLevel { @@ -180,7 +180,7 @@ pub enum FileInformationClassLevel { /// 2.5 File System Information Classes [MS-FSCC] /// https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/ee12042a-9352-46e3-9f67-c094b75fe6c3 -#[derive(FromPrimitive, Debug, PartialEq)] +#[derive(FromPrimitive, Debug, PartialEq, Eq)] #[repr(u32)] #[allow(clippy::enum_variant_names)] pub enum FileSystemInformationClassLevel { diff --git a/lib/srv/desktop/rdp/rdpclient/src/rdpdr/mod.rs b/lib/srv/desktop/rdp/rdpclient/src/rdpdr/mod.rs index 20fbc1ce4af..b302966455e 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/rdpdr/mod.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/rdpdr/mod.rs @@ -2509,12 +2509,10 @@ impl FileInformationClass { FileAllocationInformation::decode(payload)?, )) } - _ => { - return Err(invalid_data_error(&format!( - "decode invalid FileInformationClassLevel: {:?}", - file_information_class_level - ))) - } + _ => Err(invalid_data_error(&format!( + "decode invalid FileInformationClassLevel: {:?}", + file_information_class_level + ))), } }