fix(ironrdp-pdu): tolerate unknown security header flags in BasicSecurityHeader#1458
Conversation
…rityHeader Use from_bits_truncate() instead of from_bits() when decoding BasicSecurityHeader flags. Some servers (e.g., Windows Server 2019 with RDS licensing / RD Connection Broker) send security header flag combinations that include bits not defined in the current bitflags enum. The strict from_bits() rejected these as invalid, causing connection failure during the UpgradeLicense license exchange phase. This matches FreeRDP behavior which masks for known flags without rejecting the PDU when unrecognized bits are present. Closes Devolutions#1457
|
Thanks for chasing this down, Anton Isaiev (@totoshko88), and for the detailed repro writeup. I traced the decode path against current master and I think the fix is landing in the wrong spot, so let me lay out what I found before it goes further. The PR's premise is that the server sets flag bits not defined in So comes from let security_header = BasicSecurityHeader::decode(src)?; // succeeds
if !security_header.flags.contains(BasicSecurityHeaderFlags::LICENSE_PKT) {
return Err(invalid_field_err!("securityHeaderFlags", "invalid security header flags"));
}And Could you grab a hex dump of the failing PDU, the first ~8 bytes at the point
Happy to help land whichever it turns out to be. Enterprise RDS/Broker interop is exactly the kind of gap worth closing. |
Summary
Use
from_bits_truncate()instead offrom_bits()when decodingBasicSecurityHeaderflags. Some servers (e.g., Windows Server 2019 with RDS licensing / RD Connection Broker) send security header flag combinations that include bits not defined in the current bitflags enum. The strictfrom_bits()rejected these as invalid, causing connection failure during theUpgradeLicenselicense exchange phase.This matches FreeRDP behavior which masks for known flags without rejecting the PDU when unrecognized bits are present.
What was tested
cargo xtask check tests -v)cargo xtask check lints -v)Closes #1457