Skip to content

Commit

Permalink
fix(connector): better errors for MCS channel confirm
Browse files Browse the repository at this point in the history
  • Loading branch information
CBenoit committed Dec 8, 2023
1 parent bd8df6d commit e47f6e4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
28 changes: 23 additions & 5 deletions crates/ironrdp-connector/src/channel_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,29 @@ impl Sequence for ChannelConnectionSequence {

debug!(message = ?channel_join_confirm, "Received");

if channel_join_confirm.initiator_id != user_channel_id
|| channel_join_confirm.channel_id != channel_join_confirm.requested_channel_id
|| channel_join_confirm.channel_id != channel_id
{
return Err(general_err!("received bad MCS Channel Join Confirm"));
if channel_join_confirm.initiator_id != user_channel_id {
warn!(
channel_join_confirm.initiator_id,
user_channel_id, "Inconsistent initiator ID for MCS Channel Join Confirm",
)
}

if channel_id != channel_join_confirm.requested_channel_id {
return Err(reason_err!(
"ChannelJoinConfirm",
"unexpected requested_channel_id in MCS Channel Join Confirm: received {}, got {}",
channel_id,
channel_join_confirm.requested_channel_id,
));
}

if channel_id != channel_join_confirm.channel_id {
return Err(reason_err!(
"ChannelJoinConfirm",
"unexpected channel_id in MCS Channel Join Confirm: received {}, got {}",
channel_id,
channel_join_confirm.channel_id,
));
}

let next_index = index.checked_add(1).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions crates/ironrdp-connector/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,13 @@ impl Sequence for ClientConnector {

debug!(?static_channel_ids, io_channel_id);

let joined: Vec<_> = self
let zipped: Vec<_> = self
.static_channels
.type_ids()
.zip(static_channel_ids.iter().copied())
.collect();

joined.into_iter().for_each(|(channel, channel_id)| {
zipped.into_iter().for_each(|(channel, channel_id)| {
self.static_channels.attach_channel_id(channel, channel_id);
});

Expand Down

0 comments on commit e47f6e4

Please sign in to comment.