From 4c4783ee66558bad6d91b1c12925721aca484866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0pa=C4=8Dek?= Date: Mon, 22 Jul 2024 19:05:02 +0200 Subject: [PATCH] Upgrade dependencies --- Cargo.toml | 14 +++--- examples/client.rs | 114 +++++++++++++++++++++++---------------------- 2 files changed, 66 insertions(+), 62 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 67ac11e..0bce6cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ path = "tests/keys/main.rs" [dependencies] aes = "0.8" aes-gcm = "0.10" -base64 = "0.21" +base64 = "0.22" bcrypt-pbkdf = "0.10" bytes = "1.1" cbc = "0.1" @@ -34,7 +34,7 @@ chacha20 = "0.9" ctr = "0.9" derivative = "2.2" ecdsa = {version = "0.16", features = ["signing", "verifying", "digest"]} -ed25519-dalek = {version = "^2.0.0-rc", features = ["pkcs8"]} +ed25519-dalek = {version = "^2.1", features = ["pkcs8"]} futures-core = "0.3" hex-literal = "0.4" hmac = "0.12" @@ -43,14 +43,14 @@ num-bigint-dig = {version = "0.8", features = ["rand"]} p256 = "0.13" p384 = "0.13" parking_lot = "0.12" -pem = "2.0" +pem = "3.0" pin-project = "1.0" pkcs8 = {version = "0.10", features = ["encryption"]} poly1305 = "0.8" rand = {version = "0.8", features = ["getrandom"]} rand_chacha = "0.3" regex = {version = "1.6", features = ["std"], default-features = false} -regex-syntax = {version = "0.7", features = [], default-features = false} +regex-syntax = {version = "0.8", features = [], default-features = false} rsa = {version = "0.9"} sha-1 = {version = "0.10", features = ["oid"]} sha2 = {version = "0.10", features = ["oid"]} @@ -61,15 +61,15 @@ x25519-dalek = "^2.0.0-rc" [dev-dependencies] anyhow = "1" -bollard = "0.14" +bollard = "0.16" clap = "4.1" colored = "2.0" enclose = "1.1" -env_logger = "0.10" +env_logger = "0.11" futures = "0.3" home = "0.5" regex = {version = "1.6"} -rustix = {version = "0.37", features = ["termios"]} +rustix = {version = "0.38", features = ["termios"]} tokio = {version = "1", features = ["full"]} [features] diff --git a/examples/client.rs b/examples/client.rs index e8632df..48de357 100644 --- a/examples/client.rs +++ b/examples/client.rs @@ -734,8 +734,8 @@ async fn ask_for_password(prompt: &str) -> Result { let stdin_raw = unsafe { rustix::fd::BorrowedFd::borrow_raw(stdin.as_raw_fd()) }; let orig_tio = termios::tcgetattr(stdin_raw)?; - let mut tio = orig_tio; - tio.c_lflag &= !termios::ECHO; + let mut tio = orig_tio.clone(); + tio.local_modes.remove(termios::LocalModes::ECHO); termios::tcsetattr(stdin_raw, termios::OptionalActions::Drain, &tio)?; let mut password = Vec::new(); @@ -762,16 +762,20 @@ fn enter_raw_mode() -> Result { let stdin_raw = unsafe { rustix::fd::BorrowedFd::borrow_raw(stdin.as_raw_fd()) }; let orig_tio = termios::tcgetattr(stdin_raw)?; - let mut tio = orig_tio; + let mut tio = orig_tio.clone(); - tio.c_iflag |= termios::IGNPAR; - tio.c_iflag &= !(termios::ISTRIP | termios::INLCR | termios::IGNCR | termios::ICRNL - | termios::IXON | termios::IXANY | termios::IXOFF | termios::IUCLC); - tio.c_lflag &= !(termios::ISIG | termios::ICANON | termios::ECHO | termios::ECHOE - | termios::ECHOK | termios::ECHONL | termios::IEXTEN); - tio.c_oflag &= !termios::OPOST; - tio.c_cc[termios::VMIN] = 1; - tio.c_cc[termios::VTIME] = 0; + tio.input_modes.insert(termios::InputModes::IGNPAR); + tio.input_modes.remove(termios::InputModes::ISTRIP | termios::InputModes::INLCR | + termios::InputModes::IGNCR | termios::InputModes::ICRNL | termios::InputModes::IXON | + termios::InputModes::IXANY | termios::InputModes::IXOFF | termios::InputModes::IUCLC, + ); + tio.local_modes.remove(termios::LocalModes::ISIG | termios::LocalModes::ICANON | + termios::LocalModes::ECHO | termios::LocalModes::ECHOE | termios::LocalModes::ECHOK | + termios::LocalModes::ECHONL | termios::LocalModes::IEXTEN, + ); + tio.output_modes.remove(termios::OutputModes::OPOST); + tio.special_codes[termios::SpecialCodeIndex::VMIN] = 1; + tio.special_codes[termios::SpecialCodeIndex::VTIME] = 0; log::debug!("entering terminal raw mode"); termios::tcsetattr(stdin_raw, termios::OptionalActions::Drain, &tio)?; @@ -813,7 +817,7 @@ fn get_pty_request() -> Result { macro_rules! tty_char { ($name:ident, $op:ident) => { - let value = tio.c_cc[termios::$name]; + let value = tio.special_codes[termios::SpecialCodeIndex::$name]; let value = if value == 0 { 255 } else { value as u32 }; req.modes.add(makiko::codes::terminal_mode::$op, value); }; @@ -823,13 +827,13 @@ fn get_pty_request() -> Result { } macro_rules! tty_mode { - ($name:ident, $field:ident, $op:ident) => { - let value = (tio.$field & termios::$name) != 0; + ($mode:expr, $field:ident, $op:ident) => { + let value = tio.$field.contains($mode); let value = value as u32; req.modes.add(makiko::codes::terminal_mode::$op, value); }; - ($name:ident, $field:ident) => { - tty_mode!($name, $field, $name) + ($enum:ident :: $name:ident, $field:ident) => { + tty_mode!(termios::$enum::$name, $field, $name) }; } @@ -848,45 +852,45 @@ fn get_pty_request() -> Result { tty_char!(VLNEXT); tty_char!(VDISCARD); - tty_mode!(IGNPAR, c_iflag); - tty_mode!(PARMRK, c_iflag); - tty_mode!(INPCK, c_iflag); - tty_mode!(ISTRIP, c_iflag); - tty_mode!(INLCR, c_iflag); - tty_mode!(IGNCR, c_iflag); - tty_mode!(ICRNL, c_iflag); - tty_mode!(IUCLC, c_iflag); - tty_mode!(IXON, c_iflag); - tty_mode!(IXANY, c_iflag); - tty_mode!(IXOFF, c_iflag); - tty_mode!(IMAXBEL, c_iflag); - tty_mode!(IUTF8, c_iflag); - - tty_mode!(ISIG, c_lflag); - tty_mode!(ICANON, c_lflag); - tty_mode!(XCASE, c_lflag); - tty_mode!(ECHO, c_lflag); - tty_mode!(ECHOE, c_lflag); - tty_mode!(ECHOK, c_lflag); - tty_mode!(ECHONL, c_lflag); - tty_mode!(NOFLSH, c_lflag); - tty_mode!(TOSTOP, c_lflag); - tty_mode!(IEXTEN, c_lflag); - tty_mode!(ECHOCTL, c_lflag); - tty_mode!(ECHOKE, c_lflag); - tty_mode!(PENDIN, c_lflag); - - tty_mode!(OPOST, c_oflag); - tty_mode!(OLCUC, c_oflag); - tty_mode!(ONLCR, c_oflag); - tty_mode!(OCRNL, c_oflag); - tty_mode!(ONOCR, c_oflag); - tty_mode!(ONLRET, c_oflag); - - tty_mode!(CS7, c_cflag); - tty_mode!(CS8, c_cflag); - tty_mode!(PARENB, c_cflag); - tty_mode!(PARODD, c_cflag); + tty_mode!(InputModes::IGNPAR, input_modes); + tty_mode!(InputModes::PARMRK, input_modes); + tty_mode!(InputModes::INPCK, input_modes); + tty_mode!(InputModes::ISTRIP, input_modes); + tty_mode!(InputModes::INLCR, input_modes); + tty_mode!(InputModes::IGNCR, input_modes); + tty_mode!(InputModes::ICRNL, input_modes); + tty_mode!(InputModes::IUCLC, input_modes); + tty_mode!(InputModes::IXON, input_modes); + tty_mode!(InputModes::IXANY, input_modes); + tty_mode!(InputModes::IXOFF, input_modes); + tty_mode!(InputModes::IMAXBEL, input_modes); + tty_mode!(InputModes::IUTF8, input_modes); + + tty_mode!(LocalModes::ISIG, local_modes); + tty_mode!(LocalModes::ICANON, local_modes); + tty_mode!(LocalModes::XCASE, local_modes); + tty_mode!(LocalModes::ECHO, local_modes); + tty_mode!(LocalModes::ECHOE, local_modes); + tty_mode!(LocalModes::ECHOK, local_modes); + tty_mode!(LocalModes::ECHONL, local_modes); + tty_mode!(LocalModes::NOFLSH, local_modes); + tty_mode!(LocalModes::TOSTOP, local_modes); + tty_mode!(LocalModes::IEXTEN, local_modes); + tty_mode!(LocalModes::ECHOCTL, local_modes); + tty_mode!(LocalModes::ECHOKE, local_modes); + tty_mode!(LocalModes::PENDIN, local_modes); + + tty_mode!(OutputModes::OPOST, output_modes); + tty_mode!(OutputModes::OLCUC, output_modes); + tty_mode!(OutputModes::ONLCR, output_modes); + tty_mode!(OutputModes::OCRNL, output_modes); + tty_mode!(OutputModes::ONOCR, output_modes); + tty_mode!(OutputModes::ONLRET, output_modes); + + tty_mode!(ControlModes::CS7, control_modes); + tty_mode!(ControlModes::CS8, control_modes); + tty_mode!(ControlModes::PARENB, control_modes); + tty_mode!(ControlModes::PARODD, control_modes); Ok(req) }