Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/ironrdp-client/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ impl Config {
license_cache: None,
no_server_pointer: args.no_server_pointer,
autologon: args.autologon,
no_audio_playback: false,
request_data: None,
pointer_software_rendering: true,
performance_flags: PerformanceFlags::default(),
Expand Down
5 changes: 4 additions & 1 deletion crates/ironrdp-connector/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,6 @@ fn create_client_info_pdu(config: &Config, routing_addr: &SocketAddr) -> rdp::Cl
| ClientInfoFlags::DISABLE_CTRL_ALT_DEL
| ClientInfoFlags::LOGON_NOTIFY
| ClientInfoFlags::LOGON_ERRORS
| ClientInfoFlags::NO_AUDIO_PLAYBACK
| ClientInfoFlags::VIDEO_DISABLE
| ClientInfoFlags::ENABLE_WINDOWS_KEY
| ClientInfoFlags::MAXIMIZE_SHELL;
Expand All @@ -742,6 +741,10 @@ fn create_client_info_pdu(config: &Config, routing_addr: &SocketAddr) -> rdp::Cl
flags |= ClientInfoFlags::PASSWORD_IS_SC_PIN;
}

if config.no_audio_playback {
flags |= ClientInfoFlags::NO_AUDIO_PLAYBACK;
}

let client_info = ClientInfo {
credentials: Credentials {
username: config.credentials.username().unwrap_or("").to_owned(),
Expand Down
3 changes: 3 additions & 0 deletions crates/ironrdp-connector/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ pub struct Config {
pub request_data: Option<NegoRequestData>,
/// If true, the INFO_AUTOLOGON flag is set in the [`ClientInfoPdu`](ironrdp_pdu::rdp::ClientInfoPdu)
pub autologon: bool,
/// If true, the INFO_NOAUDIOPLAYBACK flag is set in the [`ClientInfoPdu`](ironrdp_pdu::rdp::ClientInfoPdu)
pub no_audio_playback: bool,

pub license_cache: Option<Arc<dyn LicenseCache>>,

// FIXME(@CBenoit): these are client-only options, not part of the connector.
Expand Down
1 change: 1 addition & 0 deletions crates/ironrdp-rdpsnd/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ impl SvcProcessor for Rdpsnd {
pdu::ServerAudioOutputPdu::Close => {
self.handler.close();
}
pdu::ServerAudioOutputPdu::Training(pdu) => return Ok(self.training_confirm(&pdu)?.into()),
_ => {
error!("Invalid PDU");
self.state = RdpsndState::Stop;
Expand Down
19 changes: 16 additions & 3 deletions crates/ironrdp-rdpsnd/src/pdu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,12 @@ impl Encode for TrainingPdu {
ensure_size!(in: dst, size: self.size());

dst.write_u16(self.timestamp);
dst.write_u16(cast_length!("TrainingPdu::wPackSize", self.data.len())?);
let len = if self.data.is_empty() {
0
} else {
self.size() + ServerAudioOutputPdu::FIXED_PART_SIZE
};
dst.write_u16(cast_length!("TrainingPdu::wPackSize", len)?);
dst.write_slice(&self.data);

Ok(())
Expand All @@ -622,8 +627,16 @@ impl<'de> Decode<'de> for TrainingPdu {

let timestamp = src.read_u16();
let len = src.read_u16() as usize;
ensure_size!(in: src, size: len);
let data = src.read_slice(len).into();
let data = if len != 0 {
if len < Self::FIXED_PART_SIZE + ServerAudioOutputPdu::FIXED_PART_SIZE {
return Err(invalid_field_err!("TrainingPdu::wPackSize", "too small"));
}
let len = len - Self::FIXED_PART_SIZE - ServerAudioOutputPdu::FIXED_PART_SIZE;
ensure_size!(in: src, size: len);
src.read_slice(len).into()
} else {
Vec::new()
};

Ok(Self { timestamp, data })
}
Expand Down
2 changes: 1 addition & 1 deletion crates/ironrdp-testsuite-core/tests/rdpsnd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ encode_decode_test! {
data: vec![0x42],
}),
[
0x06, 0x00, 0x05, 0x00, 0xda, 0x89, 0x01, 0x00, 0x42
0x06, 0x00, 0x05, 0x00, 0xda, 0x89, 0x09, 0x00, 0x42
];
training_confirm: pdu::ClientAudioOutputPdu::TrainingConfirm(pdu::TrainingConfirmPdu {
timestamp: 0x89da,
Expand Down
1 change: 1 addition & 0 deletions crates/ironrdp-testsuite-extra/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ fn default_client_config() -> connector::Config {
hardware_id: None,
request_data: None,
autologon: false,
no_audio_playback: false,
license_cache: None,
no_server_pointer: true,
pointer_software_rendering: true,
Expand Down
1 change: 1 addition & 0 deletions crates/ironrdp-web/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@ fn build_config(
platform: ironrdp::pdu::rdp::capability_sets::MajorPlatformType::UNSPECIFIED,
no_server_pointer: false,
autologon: false,
no_audio_playback: true,
request_data: None,
pointer_software_rendering: false,
performance_flags: PerformanceFlags::default(),
Expand Down
1 change: 1 addition & 0 deletions crates/ironrdp/examples/screenshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ fn build_config(username: String, password: String, domain: Option<String>) -> c
no_server_pointer: true,
request_data: None,
autologon: false,
no_audio_playback: true,
pointer_software_rendering: true,
performance_flags: PerformanceFlags::default(),
desktop_scale_factor: 0,
Expand Down
2 changes: 2 additions & 0 deletions ffi/src/connector/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub mod ffi {
pub platform: Option<MajorPlatformType>,
pub no_server_pointer: Option<bool>,
pub autologon: Option<bool>,
pub no_audio_playback: Option<bool>,
pub pointer_software_rendering: Option<bool>,
pub performance_flags: Option<ironrdp::pdu::rdp::client_info::PerformanceFlags>,
}
Expand Down Expand Up @@ -192,6 +193,7 @@ pub mod ffi {

no_server_pointer: self.no_server_pointer.unwrap_or(false),
autologon: self.autologon.unwrap_or(false),
no_audio_playback: self.no_audio_playback.unwrap_or(false),
request_data: None,
pointer_software_rendering: self.pointer_software_rendering.unwrap_or(false),
performance_flags: self.performance_flags.ok_or("performance flag is missing")?,
Expand Down