Adds a new CLI flag to control the initial RDP “desktop scale factor” sent during connection setup, enabling display scaling (useful for HiDPI/4K setups) similarly to FreeRDP’s scaling option.
Add wire-format types for RemoteFX Progressive Codec (MS-RDPRFX
Progressive Extension) and the computational primitives required for progressive refinement.
Fixes a crash when the server sends Auto-Detect Request PDUs during an
active session. After #1176 added ShareDataPdu::AutoDetectReq routing,
these PDUs decode correctly but hit the catch-all error path in the x224
processor: "unhandled PDU: Auto-Detect Request PDU".
The core rule is: a method belongs in the base API (UserInteraction /
Session / SessionBuilder) if the web component itself needs to call it
for transparent behaviour, or if the feature is universal across all
remote protocol backends. Protocol-specific concepts must go through the
extension mechanism instead.
Wires missing bitmap pixel formats (8/15/24bpp) into the session rendering
pipeline so bitmap updates at those depths are rendered instead of being
dropped, and adds fast-path palette update parsing to support 8bpp indexed
color sessions.
Generalizes `RdpServer::run_connection` to accept arbitrary Tokio `AsyncRead + AsyncWrite` streams instead of a concrete `TcpStream`, enabling non-TCP transports (e.g., Unix sockets, VSOCK, in-process streams) to reuse the same server connection logic.
Co-authored-by: lamco-office <office@lamco.io>
Co-authored-by: Benoît Cortier <3809077+CBenoit@users.noreply.github.com>
Sometimes Windows Server re-sends `SNDC_FORMATS` during Ready state
(e.g., after mute/unmute in remote browser). Previously this hit the
wildcard branch, entering Stop and permanently killing audio.
Add an `AudioFormat` arm in Ready state to close the current stream and
restart negotiation.
Introduces `ironrdp-str`, a new crate providing lazily-validated string
types covering all RDP UTF-16LE field shapes:
- `FixedString<N>`: fixed-size fields (e.g. `clientName`, `fileName`),
zero-padded on encode, trailing-null stripped on decode.
- `PrefixedString<P, N>`: length-prefixed fields with configurable
`LengthPrefix` (`CchU16`, `CchU32`, `CbU16`) and `NullTerminatorPolicy`
(`NullCounted`, `NullUncounted`, `NoNull`) type parameters.
- `UnframedString`: externally-lengthed fields whose length comes from a
sibling field in the containing message.
- `MultiSzString`: `MULTI_SZ` string lists (e.g. `HardwareIds` in
MS-RDPEUSB §2.2.4.2), with a `u32 cch` prefix counting all null
terminators including the final sentinel.
**Key design invariant**: wire bytes are stored as `Vec<u16>` and never
eagerly converted to Rust strings, enabling single-allocation decode and
zero-cost decode→encode passthrough for proxy use cases. Conversion is
deferred to explicit `to_native()` / `to_native_lossy()` calls.
Uses `bytemuck` for zero-copy LE→u16 reinterpretation on little-endian
targets; falls back to per-element byte-swap on big-endian.
The MSRV is the oldest stable Rust release that is at least 6 months
old, bounded by the Rust version available in Debian stable-backports
and Fedora stable.
- Bump pinned toolchain from 1.88.0 to 1.89.0 in rust-toolchain.toml
- Migrate all workspace crates from edition 2021 to edition 2024
- Run `cargo fix --edition` to auto-migrate source code for edition 2024
compatibility (unsafe in unsafe fn, tail expr drop order, etc.)
- Replace all `expr_2021` macro fragment specifiers with `expr` now that
the workspace is fully on edition 2024
- Remove `keyword_idents_2024` lint (now enforced by the edition itself)
- Remove removed `clippy::string_to_string` lint (covered by
implicit_clone)
- Fix new clippy lints from 1.93.0: `manual_is_multiple_of`,
`useless_let_if_seq`, `manual_map`, `derivable_impls`,
`redundant_imports`, `unused_crate_dependencies` (but didn’t bump MSRV)
- Drop `core::future::Future` unnecessary qualifications (Future is now
in the Rust 2024 prelude)
- Remove direct `bytes` deps from ironrdp-futures and ironrdp-tokio
(re-exported by ironrdp-async)
When the client and server have no common security protocol, the
acceptor now sends a proper `RDP_NEG_FAILURE` PDU before returning an
error, instead of dropping the TCP connection.
from_bits_truncate silently discards unknown bits, which breaks the
encode/decode round-trip property. This matters for fuzzing because a
PDU that decodes and re-encodes should produce identical bytes.
from_bits_retain preserves all bits, including those not yet defined in
our bitflags types, so the round-trip property holds.
CreateDisposition values (FILE_SUPERSEDE through FILE_OVERWRITE_IF) are
mutually exclusive integers 0 through 5, not combinable bit flags.
Modeling them with the bitflags macro causes subtle correctness issues.
After a desktop resize, an RDP server can send a burst of bitmap updates
for the old resolution before its rendering pipeline has fully
transitioned to the new one. These updates reference coordinates beyond
the current image buffer in `DecodedImage`, causing index-out-of-bounds
panics in the `apply_*` methods. On the server side, the same stale
bitmaps can reach the encoder with dimensions exceeding the negotiated
desktop size, panicking in `NoneHandler::handle()`.
This commit adds bounds checks at two levels:
- `DecodedImage::rect_fits()` guard at the entry of each `apply_*`
method, returning an empty rectangle when the update doesn't fit
- Encoder-level guard in `EncoderIter::next()` that drops
`BitmapUpdate`s exceeding the current desktop size
Some servers (XRDP, older Windows) send a Deactivate All PDU without
the sourceDescriptor field. The decode previously required at least 3
bytes, which caused a hard failure during deactivation-reactivation
sequences with these servers.
Treat the sourceDescriptor as optional: if the remaining data is
shorter than the fixed part size, return successfully without
reading the field. FreeRDP handles this the same way.
Ref: #314
The client was hardcoded to respond with CapsVersion::V1 regardless
of what the server requested. Servers that require V2 or V3 (such
as XRDP) would reject the channel with "Dynamic Virtual Channel
version 1 is not supported."
Echo the server's requested version in the capabilities response
instead. This correctly handles V1, V2, and V3 depending on what
the server advertises. When a Create arrives before Capabilities
(fallback path), default to V2 as the most broadly compatible
version.
Also bump the server-side capabilities request from V1 to V2 to
advertise priority charge support.
Add CapabilitiesRequestPdu::version() accessor to expose the
server's requested version from the parsed PDU.
Ref: #314
Uncompressed bitmap data has rows padded to 4-byte boundaries per
[MS-RDPBCGR] 2.2.9.1.1.3.1.2.2, but the bitmap apply functions
expect tightly packed pixel data. Strip the per-row padding before
passing raw bitmap data to the apply functions.
This fixes garbled bitmap rendering when connecting to servers that
send uncompressed bitmaps with non-aligned row widths, such as XRDP
at 16 bpp.
Ref: #314
Add RDCleanPathDetails struct to provide detailed error information for
RDCleanPath errors, including HTTP status codes, WSA error codes, and
TLS alert codes.
Allows the web client to distinguish between different types of network
errors (say, WSAEACCES/10013) instead of showing a generic RDCleanpath
error message.
Replace linear scan with a BTreeMap<TypeId, u32> for consistency with
StaticChannelSet and the client-side DynamicChannelSet. Also removes the
ChannelState::Opened guard that was inconsistent with similar lookup
functions, and renames the method from get_dvc_channel_id_by_type to
get_channel_id_by_type to match the SVC naming convention (the type is
named DrdynvcServer, so this is redundant)
The hardcoded `max_request_size` of 16,777,215 in the server's
MultifragmentUpdate capability causes mstsc to reject the connection (it
likely tries to allocate that buffer upfront). FreeRDP hit the same
problem and adjusted their value in FreeRDP/FreeRDP#1313.
This adds a configurable `max_request_size` field to `RdpServerOptions`
with a default of 8 MB (matching what `ironrdp-connector` already uses
on the client side) and exposes it through the builder via
`with_max_request_size()`.
Reference: [MS-RDPBCGR
2.2.7.2.7](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/01717954-716a-424d-af35-28fb2b86df89)
(TS_MULTIFRAGMENTUPDATE_CAPABILITYSET)
Closes#318
---------
Co-authored-by: lamco-office <office@lamco.io>
`CredsspSequence::init` now skips `ClientMode::Negotiate` when `kerberos_config` is `None` and uses `ClientMode::Ntlm` directly, avoiding macOS DNS SRV KDC auto-discovery timeouts (`_kerberos._tcp.*`) that could add ~6s per connection. Behavior is unchanged when `kerberos_config` is `Some` (still uses Negotiate).