Skip to content

fix(server): send a zero pduSource in Monitor Layout - #2230

Merged
Marc-André Moreau (mamoreau-devolutions) merged 2 commits into
Devolutions:masterfrom
se-wo:fix/server-monitor-layout-pdu-source
Oct 27, 2026
Merged

Marc-André Moreau (mamoreau-devolutions) merged 2 commits into
Devolutions:masterfrom
se-wo:fix/server-monitor-layout-pdu-source

Conversation

@se-wo

@se-wo se-wo commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

MS-RDPBCGR 2.2.12.1 requires the pduSource field of the Monitor Layout PDU to be zero, but the acceptor wrapped it with the I/O channel ID like the finalization PDUs. The acceptor now passes zero for this PDU only; the share data helper takes the pduSource it writes instead of naming it after the I/O channel.

@se-wo

se-wo commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Lines changed:

Added Removed
Production (ironrdp-acceptor) 4 3
Tests (ironrdp-testsuite-core) 31 0

Note

Human-tuned, LLM-assisted content.

@github-actions github-actions Bot added kind/protocol Affects RDP or related protocol behavior risk/medium Behavioral change that does not substantially alter a core public API size/S Size: up to 199 counted lines and 5 files; exceeds XS in either measure labels Oct 25, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Minimal, spec-correct fix: the acceptor now sends the Monitor Layout PDU with pduSource = 0 per MS-RDPBCGR 2.2.12.1 instead of the I/O channel ID, and wrap_share_data's parameter is renamed to pdu_source since the value is no longer always the I/O channel. The zero override applies only to the Share Control Header; the outer MCS Send Data Indication still targets the I/O channel. Other call sites are unchanged: the existing Set Error Info call already passed 0, and the finalization PDUs (synchronize/cooperate/control/font map) correctly retain the I/O channel ID. The new wire-level test drives the real acceptor through multitransport setup to MonitorLayoutSend, decodes the emitted MCS Send Data Indication with existing helpers, and asserts pdu_source == 0, so it would fail on pre-fix code. All five specialists reported valid with no findings; independent inspection found no correctness, protocol, or maintainability issues.

@github-actions github-actions Bot added ai-reviewed/1 One automated review completed needs-review A human reviewer is the current next actor labels Oct 25, 2026
@github-actions github-actions Bot removed the needs-review A human reviewer is the current next actor label Oct 26, 2026
@github-actions github-actions Bot added the needs-author-action The pull request author is the current next actor label Oct 26, 2026
@mamoreau-devolutions

Copy link
Copy Markdown
Contributor

Diff line counts:

Added Removed
Production (ironrdp-acceptor) 4 3
Tests (ironrdp-testsuite-core, ironrdp-testsuite-extra) 37 3
Other 0 0

Note

LLM-assisted content (no human feedback).

@github-actions github-actions Bot removed the needs-author-action The pull request author is the current next actor label Oct 26, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR correctly sends pduSource=0 for the server Monitor Layout PDU per MS-RDPBCGR 2.2.12.1, with a minimal wrap_share_data parameter rename that keeps the four finalization call sites passing the I/O channel; the new wire-level regression test matches the acceptor's real state transitions and gating on SUPPORT_MONITOR_LAYOUT_PDU. The production fix and test are sound. Two low-severity notes are published: the e2e.rs GfxContext hunk is a compile-required adaptation to a GfxServerFactory trait change absent from this PR's file list (stacked-work scope concern), and the test can use Option::get_or_insert_default(). The speculative spec-section doubt about the oracle pin is rejected because the section citation is corroborated by pre-existing in-repo references.

  1. [skeptical] e2e.rs GfxContext adaptation compiles against a trait change outside this PR's file list — low 🟡 ❓ — crates/ironrdp-testsuite-extra/tests/e2e.rs
    WindowGfxFactory::build_gfx_handler now takes a GfxContext that is threaded through build_server_with_handle. This is compile-required, not optional: ironrdp-server/src/gfx.rs (absent from changed-files.txt) already defines GfxContext and requires build_gfx_handler(&self, ctx: GfxContext), and the untouched TestGfxFactory (e2e.rs:1957) already conforms. The hunk must stay, but its provenance cannot be resolved from the evidence: either the PR stacks on an unmerged GfxServerFactory signature change belonging to a separate PR, or the changed-file list is incomplete relative to the branch. Since the PR body mentions only the zero-pduSource fix, the author should justify the hunk in the description or move it to the PR that owns the trait change. Impact limited to review accuracy and test maintenance.

Push a commit after addressing these findings. If no code change is needed, you may resolve inline threads and comment @github-actions review-ready to request human review.

.core
.optional_data
.early_capability_flags
.get_or_insert_with(ClientEarlyCapabilityFlags::empty)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[code-compressor] Use Option::get_or_insert_default() instead of get_or_insert_with(ClientEarlyCapabilityFlags::empty) — low 🟡 — The new test inserts SUPPORT_MONITOR_LAYOUT_PDU via .get_or_insert_with(ClientEarlyCapabilityFlags::empty). ClientEarlyCapabilityFlags is a bitflags 2.x generated type (ironrdp-pdu/src/gcc/core_data/client.rs:641-660) and the workspace pins bitflags 2.13.2 (Cargo.lock), which implements Default for generated flag types as the empty set, so .get_or_insert_default() is behavior-identical and shorter. Cosmetic test-only compression; no correctness impact.

@github-actions github-actions Bot added ai-reviewed/2 Two automated reviews completed needs-author-action The pull request author is the current next actor and removed ai-reviewed/1 One automated review completed labels Oct 26, 2026
Claude (claude) and others added 2 commits October 26, 2026 21:41
MS-RDPBCGR 2.2.12.1 requires the pduSource field of the Monitor Layout
PDU to be zero, but the acceptor wrapped it with the I/O channel ID like
the finalization PDUs. The acceptor now passes zero for this PDU only;
the share data helper takes the pduSource it writes instead of naming
it after the I/O channel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HiUSiVs8uTugihV2ozizRY
Keep the finalization error regression test separate from the Monitor Layout regression test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot removed the needs-author-action The pull request author is the current next actor label Oct 27, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified PR #2230: the acceptor now sends a zero pduSource in the Monitor Layout PDU per MS-RDPBCGR 2.2.12.1, with wrap_share_data renamed to take an explicit pdu_source. Confirmed both call sites: Monitor Layout passes 0 and the access-denied path already passed 0, so no other behavior changes. The added wire-decode regression test asserts pduSource == 0 and follows the repository's test conventions. The change is correct, minimal, and well-tested. The only validated finding is a low-severity rust-style nit: the touched wrap_share_data signature still lacks a doc comment even though STYLE.md's Documentation section marks undocumented items as BAD, and the renamed pdu_source parameter now carries a per-PDU contract (0 for Monitor Layout per 2.2.12.1, I/O channel ID for other share data) that deserves a reference-style spec link. Accepted that nit unchanged as a non-blocking follow-up candidate.

Push a commit after addressing these findings. If no code change is needed, you may resolve inline threads and comment @github-actions review-ready to request human review.

}

pub(crate) fn wrap_share_data(pdu: rdp::headers::ShareDataPdu, io_channel_id: u16) -> rdp::headers::ShareControlHeader {
pub(crate) fn wrap_share_data(pdu: rdp::headers::ShareDataPdu, pdu_source: u16) -> rdp::headers::ShareControlHeader {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rust-style] Touched wrap_share_data signature has no doc comment — low 🟡 — STYLE.md 'Documentation > Doc comments should link to reference documents' flags an item without a doc comment as BAD. The PR rewrote the signature, renaming io_channel_id to pdu_source precisely because the value is now caller-dependent (0 for the Monitor Layout PDU per MS-RDPBCGR 2.2.12.1, I/O channel ID for other share data PDUs). A doc comment on the touched signature stating that contract with a reference-style spec link would satisfy the style rule; non-blocking nit suitable for a follow-up.

@github-actions github-actions Bot added ai-reviewed/3 Final automated review completed needs-author-action The pull request author is the current next actor and removed ai-reviewed/2 Two automated reviews completed labels Oct 27, 2026
@mamoreau-devolutions
Marc-André Moreau (mamoreau-devolutions) merged commit 3ca12ee into Devolutions:master Oct 27, 2026
45 checks passed

This branch was previously deployed

1 inactive deployment
llm-providers — 3542b2ec Deployed Oct 27, 2026 by mamoreau-devolutions via Classify pull request #8858
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-reviewed/3 Final automated review completed kind/protocol Affects RDP or related protocol behavior risk/medium Behavioral change that does not substantially alter a core public API size/S Size: up to 199 counted lines and 5 files; exceeds XS in either measure

Development

Successfully merging this pull request may close these issues.

3 participants