fix(session): scope RDM jump host discovery to the current Windows session#1839
fix(session): scope RDM jump host discovery to the current Windows session#1839Richard Markiewicz (thenextman) wants to merge 1 commit into
Conversation
Let maintainers know that an action is required on their side
|
There was a problem hiding this comment.
Pull request overview
This PR fixes RDM (Remote Desktop Manager) “jump host” discovery to only consider RDM instances running in the current Windows session, preventing cross-session collisions when the same user has multiple concurrent sessions.
Changes:
- Scope RDM process enumeration to the current Windows session via
process_id_to_session. - Replace the PID hint
NamedTempFileapproach with a deterministic per-session PID hint file in the user temp directory. - Add stale PID hint cleanup when the hint no longer resolves to a live RDM instance in the current session.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d291e54 to
46fc7c6
Compare
46fc7c6 to
62dd95d
Compare
When jumping a connection through a remote host via the Devolutions Agent, the second concurrent jump by the same user failed with "Devolutions agent is not available on the jump host", but only when the jump host allows multiple simultaneous logins per user (i.e. Restrict each user to a single session is disabled). The first jump always worked; subsequent ones were session-dependent.
Root cause was in devolutions-session (dvc/rdm.rs). The agent and the jump-host RDM rendezvous over a named pipe / ready event whose names are built from {session_id}-{pid}.
find_rdm_pid()located the RDM instance with a machine-wide process snapshot matched only on executable path, but no session filter. So in a second session it returned an RDM PID belonging to a different session, and the resulting names mixed the current session id with a foreign PID and never matched what any RDM instance had registered → timeout → "agent not available."Two secondary defects compounded it:
Resolution
All changes are internal to devolutions-session — the pipe/event naming contract with RDM is unchanged, so mixed agent/RDM versions interoperate and no RDM-side change is needed.
find_rdm_pid()now resolves the current Windows session and skips any process not in it (process_id_to_session(pid)== current_session), so only an in-session RDM can ever be selected. This also inherently validates the hinted PID.std::fs::read_to_string/std::fs::write, restoring the intended same-instance re-attach (relevant for multi-instance mode).NotFound) is treated as "no hint" rather than a warning; only real I/O/parse errors warn.Risk / compatibility
Low. The fix only narrows which candidate RDM process is chosen — attaching to a different-session RDM never worked, so no behaviour is regressed. No protocol or RDM-side changes; the only migration artifact is a now-unused old-format hint file in temp, which is harmless and self-clears.
Issue: DGW-402