diff --git a/crates/core/src/bc/model.rs b/crates/core/src/bc/model.rs index 54b5cb6..d65650d 100644 --- a/crates/core/src/bc/model.rs +++ b/crates/core/src/bc/model.rs @@ -128,6 +128,8 @@ pub enum LegacyMsg { /// Password for a legacy login password: String, }, + /// Sent to upgrade to modern and not exposed the MD5 username/password + LoginUpgrade, /// Any other type of legacy message will be collected here UnknownMsg, } diff --git a/crates/core/src/bc/ser.rs b/crates/core/src/bc/ser.rs index 60d24d8..9860834 100644 --- a/crates/core/src/bc/ser.rs +++ b/crates/core/src/bc/ser.rs @@ -130,6 +130,10 @@ fn bc_legacy(legacy: &'_ LegacyMsg) -> impl SerializeFn + '_ { slice(&[0u8; 1772][..]), ))(out) } + LoginUpgrade => { + // Write nothing as it is header only + slice(&[])(out) + } UnknownMsg => { panic!("Cannot serialize an unknown message!"); } diff --git a/crates/core/src/bc_protocol/connection/udpsource.rs b/crates/core/src/bc_protocol/connection/udpsource.rs index 166c44f..0b56d43 100644 --- a/crates/core/src/bc_protocol/connection/udpsource.rs +++ b/crates/core/src/bc_protocol/connection/udpsource.rs @@ -282,7 +282,9 @@ impl UdpPayloadSource { self.send_buffer.push_back(BcUdp::Data(resend.clone())); } } - if self.ack_interval.poll_tick(cx).is_ready() && self.packets_want > 0 { + if self.ack_interval.poll_tick(cx).is_ready() + // && self.packets_want > 0 + { let ack = BcUdp::Ack(self.build_send_ack()); self.send_buffer.push_back(ack); self.state = State::Flushing; diff --git a/crates/core/src/bc_protocol/login.rs b/crates/core/src/bc_protocol/login.rs index 96d8e56..50dbaa3 100644 --- a/crates/core/src/bc_protocol/login.rs +++ b/crates/core/src/bc_protocol/login.rs @@ -1,4 +1,4 @@ -use super::{md5_string, BcCamera, Error, Result, Truncate, ZeroLast}; +use super::{md5_string, BcCamera, Error, Result, Truncate}; use crate::bc::{model::*, xml::*}; use std::sync::atomic::Ordering; @@ -48,12 +48,12 @@ impl BcCamera { // Note: I suspect there may be a buffer overflow opportunity in the firmware since in the // Baichuan library, these strings are capped at 32 bytes with a null terminator. This // could also be a mistake in the library, the effect being it only compares 31 chars, not 32. - let md5_username = md5_string(&credentials.username, ZeroLast); - let md5_password = credentials - .password - .as_ref() - .map(|p| md5_string(p, ZeroLast)) - .unwrap_or_else(|| EMPTY_LEGACY_PASSWORD.to_owned()); + // let md5_username = md5_string(&credentials.username, ZeroLast); + // let md5_password = credentials + // .password + // .as_ref() + // .map(|p| md5_string(p, ZeroLast)) + // .unwrap_or_else(|| EMPTY_LEGACY_PASSWORD.to_owned()); let enc_byte = match max_encryption { MaxEncryption::None => 0xdc00, @@ -69,10 +69,7 @@ impl BcCamera { response_code: enc_byte, class: 0x6514, }, - body: BcBody::LegacyMsg(LegacyMsg::LoginMsg { - username: md5_username, - password: md5_password, - }), + body: BcBody::LegacyMsg(LegacyMsg::LoginUpgrade), }; sub_login.send(legacy_login).await?;