diff --git a/crates/ironrdp-client/src/rdp.rs b/crates/ironrdp-client/src/rdp.rs index 6b131e92..c3f7341a 100644 --- a/crates/ironrdp-client/src/rdp.rs +++ b/crates/ironrdp-client/src/rdp.rs @@ -410,26 +410,6 @@ where debug!(message = ?rdcleanpath_res, "Received RDCleanPath PDU"); - // Check for negotiation failure data before consuming the PDU - if let Some(x224_data) = &rdcleanpath_res.x224_connection_pdu { - if let Some(_error) = &rdcleanpath_res.error { - // Try to decode as X.224 Connection Confirm to extract negotiation failure details. - if let Ok(x224_confirm) = ironrdp_core::decode::< - ironrdp::pdu::x224::X224, - >(x224_data.as_bytes()) - { - if let ironrdp::pdu::nego::ConnectionConfirm::Failure { code } = x224_confirm.0 { - // Convert to negotiation failure instead of generic RDCleanPath error. - let negotiation_failure = connector::NegotiationFailure::from(code); - return Err(connector::ConnectorError::new( - "RDP negotiation failed", - connector::ConnectorErrorKind::Negotiation(negotiation_failure), - )); - } - } - } - } - let (x224_connection_response, server_cert_chain) = match rdcleanpath_res .into_enum() .map_err(|e| connector::custom_err!("invalid RDCleanPath PDU", e))? @@ -445,7 +425,6 @@ where server_addr: _, } => (x224_connection_response, server_cert_chain), ironrdp_rdcleanpath::RDCleanPath::GeneralErr(error) => { - // Fallback to generic RDCleanPath error if no negotiation failure data found return Err(connector::custom_err!("received an RDCleanPath error", error)); } ironrdp_rdcleanpath::RDCleanPath::NegotiationErr { @@ -465,6 +444,7 @@ where )); } } + // Fallback to generic error if we can't decode the negotiation failure. return Err(connector::general_err!("received an RDCleanPath negotiation error")); } diff --git a/crates/ironrdp-rdcleanpath/src/lib.rs b/crates/ironrdp-rdcleanpath/src/lib.rs index 90a0f70e..daff4c1c 100644 --- a/crates/ironrdp-rdcleanpath/src/lib.rs +++ b/crates/ironrdp-rdcleanpath/src/lib.rs @@ -259,7 +259,7 @@ impl RDCleanPathPdu { } } - /// Create a negotiation error response that includes the server's X.224 negotiation response. + /// Creates a negotiation error response that includes the server's X.224 negotiation response. /// /// This allows clients to extract specific negotiation failure details /// (like "CredSSP required") from the server's original response. diff --git a/crates/ironrdp-web/src/session.rs b/crates/ironrdp-web/src/session.rs index fd79f5a8..92a50fc7 100644 --- a/crates/ironrdp-web/src/session.rs +++ b/crates/ironrdp-web/src/session.rs @@ -1112,6 +1112,7 @@ where .with_kind(IronErrorKind::NegotiationFailure)); } } + // Fallback to generic error if we can't decode the negotiation failure. return Err( IronError::from(anyhow::Error::msg("received an RDCleanPath negotiation error"))