* feat(windows): make installer firewall rules optional
Support FIREWALLRULES=0/1 in MSI and EXE installers, preserve the saved choice across maintenance and upgrades, and retain unconditional uninstall cleanup.
Persist MSI maintenance overrides with rollback and test EXE option resolution and command generation.
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(windows): keep firewall setup failures non-fatal
Restore infallible EXE script generation, warn and use the enabled default when option resolution fails, and continue after persistence errors. Use the existing non-blocking return policy for MSI firewall persistence and rollback actions.
Add regression coverage for invalid input and a failed registry command without changing valid FIREWALLRULES=0/1 behavior.
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(windows): support Y/N firewall installer options
Accept Y/y and N/n alongside 1 and 0 for FIREWALLRULES in MSI and EXE installers. Normalize MSI values before action conditions and registry writes to preserve canonical settings across upgrades.
Extend regression coverage for alias normalization and explicit overrides while retaining non-blocking failure handling.
Signed-off-by: fufesou <linlong1266@gmail.com>
* refactor(windows): simplify installer firewall option
Signed-off-by: fufesou <linlong1266@gmail.com>
* refactor(windows): retain legacy firewall installer flow
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(msi): default unknown firewall values to enabled
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(windows): accept case-insensitive firewall option names
Keep the MSI registry search consistent with existing options and document the direct machine-hive alternative.
Signed-off-by: fufesou <linlong1266@gmail.com>
---------
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(windows): stabilize privacy mode 2 initialization
First-time Amyuni setup can reset the display layout after the monitor
appears. Prepare it on a worker outside the privacy mutex and connection
loop, keeping remote input and video responsive during initialization.
Poll DXGI for five seconds without capture loss, with a 20-second deadline.
Log and retain the full wait when DXGI cannot be observed. Cancel pending
activation on disable, disconnect or permission revocation.
Validate active outputs before reporting success and detect subsequent
privacy loss in the display loop. Notify the authenticated owner directly
without depending on the connection manager.
Validation: default test build and two privacy-mode regression tests;
Flutter cargo check --tests; formatting and whitespace checks; successful
first-install hardware test with 12.1-second activation and manual exit.
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(windows): preserve privacy monitor cleanup and allow retries
Carry the monitor created during Amyuni preparation into privacy mode's
existing cleanup list so exiting removes one monitor instead of all managed
virtual monitors.
Wait cancellably for ongoing preparation when activation is retried, keeping
the connection responsive. Add a regression test for waiting and cancellation.
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(windows): skip privacy restoration when cancelling preparation
A cancelled preparation worker already owns cleanup. Acknowledge cancellation without restoring an inactive privacy layout, which could otherwise remove all managed virtual monitors before the worker finishes.
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(windows): roll back inactive privacy monitor preparation
Attempt to undo an accepted Amyuni monitor request when privacy preparation fails or is cancelled, even if active-display enumeration cannot see the requested monitor. Preserve non-forced removal for active outputs and report cleanup failures.
Signed-off-by: fufesou <linlong1266@gmail.com>
* chore(windows): trim privacy diagnostics and adjust polling
Remove temporary activation logs and move the preparation-lock test module after the other Amyuni items. Use a 300 ms polling interval for display stabilization and preparation-lock cancellation checks.
Signed-off-by: fufesou <linlong1266@gmail.com>
* perf(windows): probe privacy readiness without pixel readback
Check DXGI duplication access without copying or mapping desktop pixels during first-install privacy preparation. Reuse frame cleanup and preserve the existing stability window and normal capture path.
Log probe creation and recreation timing, and clarify which display flags are excluded from privacy validation.
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(windows): probe the prepared display during privacy initialization
Observe the newly created Amyuni output so the readiness probe does not contend with video capture for the same DXGI duplication interface.
Retry temporary DXGI unavailability within the existing initialization deadline while retaining the stability interval and explicit full-wait fallback.
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(windows): report privacy preparation cleanup failures
Preserve the single-monitor safety checks when cleaning up a prepared Amyuni display and propagate driver errors directly.
Leave ordinary monitor removal and best-effort bulk cleanup unchanged.
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(windows): retain privacy initialization wait across retries
Remember unfinished first-install observation after monitor creation or stability failures. Recheck it when reusing an existing Amyuni output, and clear it only after the existing observation policy completes.
Keep the state local to privacy preparation and serialize access with the existing preparation lock.
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(windows): validate privacy preparation and avoid display stalls
Keep initialization pending when its output disappears, and wait for an active output count decrease before completing preparation cleanup.
Skip privacy checks while activation or restoration holds the mutex, report poisoned locks, and log preparation errors with throttling.
Signed-off-by: fufesou <linlong1266@gmail.com>
---------
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(mobile): align the virtual mouse handle with the peer cursor
The handle origin was reported in window coordinates, while the mouse
mapping reads it as canvas-local: on mobile CanvasModel.topToEdge and
leftToEdge are 0, so nothing compensates for the safe area. The peer
cursor was therefore drawn one inset away from the handle arrow, and a
tap landed where that cursor was rather than under the arrow.
Subtract the same padding InputModel._pointerPositionForRemoteCanvas
applies, so both entry points hand over coordinates in one space.
* test(mobile): pin the virtual mouse cursor to the canvas
The handle origin has to reach the mouse mapping as a canvas coordinate,
otherwise the peer cursor draws one safe-area inset away from the handle
arrow. Reports the handle position through a nonzero inset, so a return to
window coordinates moves the point by that inset and fails here.
Signed-off-by: alonginwind <sunzl3721@gmail.com>
---------
Signed-off-by: alonginwind <sunzl3721@gmail.com>
* fix(wayland): preserve unmatched streams and validate display offset cache
- Keep unmatched streams in `sort_streams` instead of dropping them when no
monitor sits at `(0, 0)` (e.g. vertically offset multi-monitor layouts).
- Reject stale `wayland-pipewire-display-offset` entries whose offsets do not
match any current display origin, skip caching unresolved `(0, 0)` defaults,
and fall back to rotated/logical display dimensions in `try_fill_positions`.
- Replace global `HAS_POSITION_ATTR` with per-stream `has_position` and
per-session `positions_filled` tracking.
- Do not latch `PIPEWIRE_INITIALIZED` when `init_displays` yields no displays.
Fixes https://github.com/rustdesk/rustdesk/issues/17027
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(wayland): restrict fallback display matching to unique outputs
- Keep `try_fill_positions` exact physical-mode matching for multi-match
cursor disambiguation, and apply rotated/logical-size fallback only
when a single display matches uniquely (leaving ambiguous cases
unchanged and uncached).
- Inline the unmatched-stream preservation directly into `sort_streams`
without the generic `sort_by_display_order` wrapper.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(wayland): cache only resolved display offsets and drop the size fallback
- Remove `unique_fallback_origin`: a unique rotated output is already placed
by `reconciled_origin`, and matching a stream size against `logical_size`
could bind a region or virtual stream to a scaled output and cache it.
- Report from `fill_multi_matched_positions` whether every stream was told
apart, and do not cache the offsets when it was not (no embedded cursor
mode, or a probe failed).
- Require each cached offset to name a display of its own, so a cache holding
two streams on one output is rejected; mirrored outputs still pass.
- Import `serde_json` in the test module: on Linux scrap only gets it through
`hbb_common`.
- Leave `init_displays` as on master: once `sort_streams` keeps unmatched
streams the display list is no longer emptied, so the empty-list check
cannot fire, and the initialization-state change is a separate matter.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkkfvhEPKVg85ZHovfs
* chore(wayland): drop edits unrelated to the fix
- Remove the comment left over from HAS_POSITION_ATTR.
- Restore Vec::new() in sort_streams.
- Drop the empty-token check in validate_display_offset_cache: the cache
is never written without a token, and the token comparison already
rejects an empty current token.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkkfvhEPKVg85ZHovfs
* fix(wayland): narrow the #17027 fix to sort_streams
Revert the offset-cache, position-flag and disambiguation changes from
the earlier commits; only sort_streams changes now.
- sort_streams keeps a stream whose position names no display (the KDE
full-workspace stream at (0, 0) in #17027) and, as on master, still
drops a stream at an origin another stream already took. Keeping that
one too let a same-size stream left at another display's origin send
pointer input to that display.
- With the stream kept, the stale [[0, 0]] offset cache and the global
HAS_POSITION_ATTR no longer break #17027: a cached (0, 0) gives the
position recomputing would. Both stay as on master.
- The offset cache test goes with the validation it covered.
sort_streams takes PipeWireCapturable, which holds a D-Bus connection
and a fd, so it has no unit test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkkfvhEPKVg85ZHovfs
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
* Initialize libsodium before anything uses it
The client called sodium_init() only when the update signature check
or the trusted device token first ran. That call also chooses
libsodium's implementations: where a build has both, it moves Poly1305
from the default one to the SSE2 one, whose state is laid out
differently, so a secretbox or AEAD operation another thread was in
the middle of finished under the other implementation. In one thread,
a computation straddling the call gives a wrong tag. The call now runs
once at process start: first in global_init, which core_main begins
with, and at the top of the FFI initialize, which on mobile verifies a
signature before it reaches global_init.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
* Log a failed libsodium initialization and start anyway
As hbbs does: a client that does not start is worse than one that
runs with libsodium as it was before this change, and sodium_init()
fails only when it cannot lock its own mutex.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
* Initialize libsodium where Android starts the server
Started at boot, MainService calls startServer with no Flutter engine,
so initialize never ran: the server worked with libsodium uninitialized
until the UI opened, and that first sodium_init() could land while
sessions were running. startServer now makes the call first, before it
verifies the custom client's signature or spawns the server.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
---------
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
`move_relative_` halved each delta with `(v as f32 / 2.).ceil()`, which
maps -1 to 0 but +1 to 1. Single-unit moves left or up were dropped while
right or down were kept, so in relative-mouse mode the pointer drifted
toward the bottom-right.
Round half away from zero instead: positive deltas give the same values
as before and negative deltas now mirror them. The /2 scaling is kept.
Co-authored-by: Gabe Fletcher <gabe@detailinggrowth.com>
* fix(linux): keep the cursor visible over blank X11 cursors
Signed-off-by: luoming <ming.luo@uwa4d.com>
* fix(linux): test sign-extended X11 cursor pixels
- Drop the `count != 0` guard. With non-null pixels, a 0x0 image
gives an empty slice, which the predicate already reports as hidden.
- Assert the sign-extended opaque pixel that 64-bit Xlib actually
returns (`_XRead32` copies through `int *`), so a later signed
comparison such as `p >= 0x0100_0000` fails the test.
- Use the file's `c_long` import in the test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkkfvhEPKVg85ZHovfs
* fix(linux): restore the explicit empty cursor image check
Keep `count != 0` so an empty image is visibly treated as hidden,
without relying on the zero-length `from_raw_parts` rules.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkkfvhEPKVg85ZHovfs
---------
Signed-off-by: luoming <ming.luo@uwa4d.com>
Co-authored-by: luoming <ming.luo@uwa4d.com>
Co-authored-by: rustdesk <71636191+rustdesk@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(security): prevent privilege escalation via registry recovery (ZDI-CAN-34805)
Validate all registry recovery inputs before accessing HKEY_LOCAL_MACHINE:
- Path must start with the graphics drivers connectivity prefix
- Key name must be exactly "Recent"
- Subkey cannot contain path separators, dots, or null bytes
- Old and new values must match in type and length
Validation applies unconditionally to both force=false and force=true paths,
blocking arbitrary registry writes from low-privilege IPC clients.
Maintain existing recovery lifecycle and config persistence. Add three
regression tests covering the reported attack vector and data validation.
Reported-by: BoGeun Jang <TrendAI Zero Day Initiative>
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(windows): preserve registry recovery behavior
Restore historical type conversion and force behavior while retaining registry target validation. Replace format restrictions with a regression test for variable-length recovery records.
Signed-off-by: fufesou <linlong1266@gmail.com>
---------
Signed-off-by: fufesou <linlong1266@gmail.com>
* Sync the Android input service state to enable-keyboard from Kotlin
enable-keyboard mirrors whether InputService is running, but only the
Flutter UI updated it. When the service was turned on from system
settings while the UI was not running, the option stayed N and new
connections were denied keyboard permission until the app was opened.
InputService now reports its state directly, and MainService reports it
again once startServer has set the config directory.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* Stop the Android UI from resetting enable-keyboard on start
ServerModel set enable-keyboard to N on every mobile UI start and relied
on the input state message to set it back. Until that message arrived,
open connections lost keyboard permission. Android now keeps the option
in step with InputService natively, so keep the reset on iOS only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Android's input control and clipboard toggles call switch_permission_all,
which reaches every CM client. On a file-transfer, view-camera or
port-forward connection, the keyboard switch set keyboard = true and both
switches re-subscribed the clipboard service, so the host's clipboard
changes were sent to a peer that was not granted a remote session.
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* Subscribe clipboard services from permission switches only after authorization
Permission toggles in the accept window reach the connection before the
peer is authorized. The keyboard, clipboard and file switches subscribed
the clipboard services at once, so anything the host copied while the
window was open was sent to a peer that had not been accepted.
Subscribe only once authorized, as the audio switch does; on
authorization try_sub_monitor_services subscribes from the recorded
values.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* Say "until authorized" in the permission switch comment
The switch arrives after the login request, so "before login" was
inaccurate.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(fs): recognise compressed file extensions in any letter case
* fix(fs): compare extensions without allocating and trim the test
* test(fs): keep only the uppercase extension checks
---------
Co-authored-by: Ruslan Zaitsev <293677063+Dofam1nch1k@users.noreply.github.com>
* fix(lang): keep the ?key= and @public syntax in the ID field tooltips
es and hr translated ?key=, da translated @public, and the Catalan
id_input_tip held the text of a different string. Restore the literal
tokens and clear the Catalan entry so the English tooltip is shown.
* fix(lang): clear the Catalan web ID tooltip and require <id>@public in the test
---------
Co-authored-by: Ruslan Zaitsev <293677063+Dofam1nch1k@users.noreply.github.com>
Add docs/SECURITY-RU.md. In docs/README-RU.md: add the missing languages to the language bar, fix the Docker anchor in the navigation, name the Sciter library in the download instruction, add the libs/base entry to the file structure, and fix a typo.
Co-authored-by: Ruslan Zaitsev <293677063+Dofam1nch1k@users.noreply.github.com>
- Move the misuse disclaimer to the top and use a valid [!Caution] alert
([!Attention] is not a GitHub alert type and rendered as a plain quote)
- Drop the dead #serveurs-publics-libres link from the navigation bar
- Add the missing parts: FAQ and nightly build links, F-Droid and
Flathub badges (French versions), build guide link (French doc),
openSUSE section, Flutter/CI note, libs/base, libs/clipboard, flutter
- Update package lists, clone and submodule commands, and screenshots
to match README.md
- Refresh the language bar and the translation call to action
Signed-off-by: vinii34 <193139747+vinii34@users.noreply.github.com>
Co-authored-by: vinii34 <193139747+vinii34@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The only Norwegian table is nb (Bokmal), but systems also report Norwegian as no (the macrolanguage, e.g. no_NO) or nn (Nynorsk). resolve_lang returned no/nn, which match no table, so the UI fell back to English.
Co-authored-by: Ruslan Zaitsev <293677063+Dofam1nch1k@users.noreply.github.com>
Version: , ID already exists and End call are not keys in src/lang, so they stayed in English in every language. Use the existing Version, Already exists and Stop voice call keys instead, as the desktop settings page, the tag rename check and the controlled side already do.
Co-authored-by: Ruslan Zaitsev <293677063+Dofam1nch1k@users.noreply.github.com>
da, el, es, nl and uk wrote the app name as Rustdesk or RusDesk in nine entries. translate() replaces the exact string RustDesk with a custom client's name, so these spellings showed up unchanged in custom clients (for example the uk About dialog title). Adds a test that fails on master and passes with this change.
Co-authored-by: Ruslan Zaitsev <293677063+Dofam1nch1k@users.noreply.github.com>
Add docs/README-KA.md, translated from the current README.md, and link it from the language bar in README.md.
Co-authored-by: Ruslan Zaitsev <293677063+Dofam1nch1k@users.noreply.github.com>
* fix(lang): keep the {} placeholder in three translations
fa and nl dropped the {} in shortcut-must-include-modifiers and shortcut-key-not-supported, so the recording dialog lost the modifier list and the rejected key name. sc had a {} and an unrelated meaning in printer-os-requirement-tip, which is shown as plain text.
* test(lang): check fa, nl and sc against the placeholders of their English text
The existing placeholder test only looks at keys that contain {}. These three tables had mismatches against the en.rs text instead (strings whose {} is filled by Dart replaceAll). The test fails on master and passes with the translation fixes.
---------
Co-authored-by: Ruslan Zaitsev <293677063+Dofam1nch1k@users.noreply.github.com>
* fix(android): move the log toggle native into ffi.FFI
Custom clients move the Kotlin classes out of com.carriez.flutter_hbb.
DocumentLogs declared setEnabled as a native method, so its export
Java_com_carriez_flutter_1hbb_DocumentLogs_setEnabled did not link
there and the app crashed on start with UnsatisfiedLinkError. The
ffi package keeps its name, so declare the native in ffi.FFI like the
others and call it from DocumentLogs.
Fixesrustdesk/rustdesk-server-pro#1035
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* ci(android): fail when a JNI native is outside ffi.FFI
Only ffi.FFI survives the package rename custom clients do. Check in
the Android build that every Rust JNI export is Java_ffi_FFI_* and that
no Kotlin file but ffi.kt declares an external fun, and write the rule
down in AGENTS.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* ci(android): report every JNI rule violation and check class lookups
Run the checks independently so one CI round lists both the Rust and
the Kotlin offenders, and also fail on a Rust lookup of an app class by
name. Note in AGENTS.md that a Kotlin method Rust calls by name needs
@Keep to survive R8.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* clipboard: declare file sizes in the Windows file list
Pasting files from a Windows peer got slower with the number of files and
then stopped working, while the total size made no difference: one 32 MB
file pasted at once, 45 small files took seconds, and 50 small files
totalling 8.3 MB left the shell spinning and copied nothing.
The sender never set FD_FILESIZE, although it had already read the size and
filled nFileSizeLow/nFileSizeHigh. Without that flag the receiver cannot
trust those fields, so CliprdrStream_New() asks for the size of each file
with its own FILECONTENTS_SIZE request and blocks on the reply for up to
CLIPBOARD_RESPONSE_WAIT_TIMEOUT_SECS. Those streams are all built up front,
in the loop that answers the shell's request for the file group descriptor,
so the round trips run one after another inside IDataObject::GetData() and
the shell waits for every one of them before the paste can begin. The cost
is therefore per file, not per byte, which is what the reports describe.
The size is now declared, and only when it is known: GetFileSizeEx() replaces
GetFileSize(), whose INVALID_FILE_SIZE return cannot be told from a genuine
4GB-1 file without GetLastError(), and directories are skipped because the
handle opened with FILE_FLAG_BACKUP_SEMANTICS above is not a file handle.
A regular file whose size cannot be read is rejected instead of publishing an
ambiguous zero size. This is required because the Unix receiver currently
consumes the descriptor size fields regardless of FD_FILESIZE for
compatibility with older Windows senders.
Upstream FreeRDP, which this file comes from, sets FD_FILESIZE here. It has
been commented out in our copy since the file was first added in 6672087f7,
with no recorded reason; the "for compatibility" note above it was written
later, in 55005f812, about code that already looked this way. The Unix
receiver carries the other half of the same workaround in filetype.rs, where
the size is trusted whether or not the flag is set, explicitly "for
compatibility with Windows".
This is a sender-side fix: the paste gets faster once the machine the files
come from runs it, whichever version does the pasting.
Fixes#16238
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EZ49AbZJYfm8NTp5yDPMab
* clipboard: fail a size request for an entry that has no size
The descriptor now carries FD_FILESIZE only when the size was actually read,
which leaves both size fields at zero for an entry where it was not. The
non-stream FILECONTENTS_SIZE handler passed those fields straight back, so a
receiver asking about such an entry would be told it is empty and would write a
zero-length file without any error. The previous code returned whatever
GetFileSize() had left behind, which for a failure is INVALID_FILE_SIZE -- also
wrong, but wrong loudly.
Answer only when the descriptor has a size, and fail the request otherwise. The
receiver then fails the paste instead of completing it with an empty file, which
is the same class of outcome the old code produced for that entry.
The IStream_Stat path is unchanged; it already answers from the stream.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EZ49AbZJYfm8NTp5yDPMab
* clipboard: pass the file count at its C width on 32-bit Windows
HandleClipboardFiles is declared in cliprdr.h as
(UINT32 connID, size_t nFiles, WCHAR **fileNames), but the Rust size_t
alias came from bindgen output generated on x64: c_ulonglong. On i686 the
C caller passes a 4-byte nFiles while the Rust callee reads 8 bytes, so
n_files takes the fileNames pointer as its high half and file_names is read
from the stack slot past the arguments. The first dereference faults and
the process serving the files dies.
The callback fires once per paste, when the audit file is first read, so on
a 32-bit build a paste of files copied there crashes partway. On the
controlled side that process is the connection manager: the server logs
"ipc to connection manager exit: reset by the peer", closes the
connection, and the remaining files fail. 64-bit builds are not affected.
The callback came with #12730, so every 32-bit release since 1.4.2 has
this.
size_t is the only pointer-sized type in these bindings that crosses the
FFI boundary.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* clipboard: notify the audit at the first file of a list, not the last
wf_cliprdr_add_to_file_arrays() assigned first_file_index for every
regular file, so it ended up holding the last one, and HandleClipboardFiles
fired when the paste reached the last file rather than when it started. A
paste cancelled before its last file sent no audit record. The Unix owner
in serv_files.rs already takes the first regular file.
Keep the first assignment only. clear_file_array() resets the index to
(size_t)-1 before every list is built.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* Revert "clipboard: fail a size request for an entry that has no size"
This reverts commit aba7020834.
The check guarded a state the descriptor change already rules out: a
regular file whose size cannot be read is rejected when the list is built,
so only directories go out without FD_FILESIZE. No receiver asks a
directory for its size: Windows receivers skip directories in
CliprdrStream_New(), and the Unix receivers only send FILECONTENTS_RANGE.
Keep the existing FILECONTENTS_SIZE answer unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* clipboard: reject a file list entry whose attributes cannot be read
GetFileAttributesW() reports failure as INVALID_FILE_ATTRIBUTES, which is
0xFFFFFFFF and so has FILE_ATTRIBUTE_DIRECTORY set. The entry then skipped
the size read and went out as a directory with FD_ATTRIBUTES, and both the
Windows and the Unix receivers created an empty directory where the file
should be, without reporting an error.
Fail the descriptor, as for the other errors here, so the paste fails
instead of losing the file. After this only real directories go out
without FD_FILESIZE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* clipboard: start the audit at the first non-empty file
The audit fires on the first range read of first_file_index. Receivers
never read an empty file: the Windows stream returns S_FALSE once the
offset reaches the declared size, and the macOS and FUSE receivers create
empty files locally. A list that starts with an empty file therefore sent
no audit record at all, while its other files were copied.
Skip empty files when choosing the index. Every regular file in the list
now carries a size that was actually read, so the check is reliable. A
list with no non-empty file still sends no record, as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* clipboard: do not claim GetFileSize() fails on a directory handle
The comment said so without a check. What matters is that a directory
entry carries no size, whatever its handle would report.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* build(vcpkg): vendor the mfx-dispatch cstdint patch in the overlay port
## Problem
The `mfx-dispatch` overlay port downloads its patch from `github.com/<repo>/commit/<sha>.patch`. GitHub answers anonymous downloads of such URLs with HTTP 429 often enough to fail CI runs and local builds.
## Solution
The patch (`git format-patch --full-index` of `lu-zero/mfx_dispatch@d6241243`) is vendored as `res/vcpkg/mfx-dispatch/fix-missing-cstdint-import.patch` and applied from the port directory.
Signed-off-by: Milen Dzhambazov <savemetenminutes@gmail.com>
* build(vcpkg): preserve original mfx-dispatch patch checksum
---------
Signed-off-by: Milen Dzhambazov <savemetenminutes@gmail.com>
Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
default-net 0.14 casts AF_LINK sockaddrs to a sockaddr_dl struct without
#[repr(C)], so it reads sdl_nlen from past the end of the kernel record
and get_interfaces() panics on some Macs, which aborts RustDesk at launch
(#16950). 0.22 reads the record by byte offset.
Depend on the rustdesk-0.22 branch of rustdesk-org/netdev rather than
crates.io: it is v0.22.0 plus fixes for the panics and memory bugs 0.22
still has on the get_interfaces() path (short link addresses, a double
free and lossy names on Windows, non-UTF-8 names on Unix), and it no
longer looks up the gateway on macOS. netdev, the renamed upstream,
needs Rust 1.85 from 0.38 on. lan.rs is unchanged.
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(macos): turn privacy mode off before locking at session end
Most closes call on_close(.., true) from inside the connection loop,
which locks the screen before the loop turns privacy mode off. On macOS
the lock is a Ctrl+Cmd+Q queued on the main queue, and privacy mode's
event tap is torn down on that same queue right after it, so the screen
did not lock and the displays came back on unlocked.
On macOS a connection that owns privacy mode now turns it off before
locking. The macOS lock_screen() also checks that the screen locked
(CGSSessionScreenIsLocked) and presses the shortcut once more if not.
Fixes#15875
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(macos): check the lock once more after the last wait
The retry loop ended its last wait without checking, so a lock that
landed in the final 100 ms pressed the shortcut again or logged a false
"Failed to lock the screen". Wait in platform::wait_locked(), which also
checks at the deadline, and keep the first press as it is on master.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refact(macos): keep on_close a one-line hook for the turn-off before locking
Move the ownership check and the turn-off into privacy_mode::macos, so
the shared Connection::on_close only calls it, and log a failed turn-off.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(macos): turn privacy mode off on the main queue
The blackout monitor, the display reconfiguration callback and the
deferred shutdown lock g_privacyModeMutex on the main thread, while the
turn-off held that mutex and waited for the main queue to tear the event
tap down, so the two could deadlock. The turn-off now runs before the
lock at session end, where a deadlock would also keep the lock from
being requested.
Called off the main thread with privacy mode on, MacSetPrivacyMode(false)
now runs the whole turn-off on the main queue. With privacy mode off it
returns as before, without touching the main queue.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(macos): leave lock_screen() as on master
Review asked to keep this PR to the ordering fix. Drop the second
press in lock_screen() and the wait_locked() helper it used, so
ordinary macOS lock requests behave as on master again. Privacy mode
is still turned off before the lock at session end.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(flutter): keep CM side panels on the current Windows monitor
Set the final physical position and size together when toggling CM chat or
file panels. This avoids an intermediate resize crossing into a monitor
with a different DPI before the position is applied.
Limit the change to the Windows CM path and add a positioning regression test.
* fix(flutter): fall back when the CM window screen is unavailable
getWindowInfo() could throw before the side-panel toggle reset its guard,
which locked the chat and file buttons and dropped the incoming message
that opened the panel. A failure now takes the previous setSizeAlignment
path, which also makes the existing no-screen fallback reachable.
The test now starts from the reported setup, the window at the right
edge of a 100% monitor, and checks that each toggle is a single
setBounds, since a resize followed by a move is what crossed monitors.
The 150% case keeps covering the scaled size.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* test(flutter): cover CM window info fallback
* Revert "test(flutter): cover CM window info fallback"
This reverts commit 9204e6a021.
---------
Co-authored-by: rustdesk <71636191+rustdesk@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix: block sensitive heartbeat strategy options
Filter 25 sensitive server, trust, authentication, access-control,
deployment and local service settings before merging heartbeat strategy
options. Preserve the existing HTTP protocol, all 27 current server
policy options, and other unblocked options for version compatibility.
Strategy responses remain unauthenticated.
Add regression coverage for blocked writes and clears, including registry
recovery data, and preservation of existing and future policy options.
Tests: cargo test --lib hbbs_http::sync::strategy_tests --locked (2 passed)
* fix: log rejected strategy options and strengthen regression tests
* fix: block trusted-device expiration in strategy updates
A strategy setting it to 0 would make trusted devices skip 2FA forever.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: block websocket port in heartbeat strategies
* fix: preserve security policy controls in heartbeat strategies
Allow the connection-window and scope-violation policy controls.
Keep enable-trusted-devices blocked because disabling it clears existing
trusted-device grants, which re-enabling does not restore.
* fix: acknowledge heartbeat strategies after application errors
Skipping modified_at after an application error allows the server to
deliver the same strategy version repeatedly. Authentication options
(2FA, trusted-device enablement and expiration) are already blocked,
and the authentication-update path applies unrelated options first.
Keep reporting application errors, but continue processing modified_at
so the failed version is acknowledged. Log "strategy updated" only on
success. Acknowledgement does not guarantee full application; retrying
a failed strategy requires publishing a new version.
Validation: cargo test --lib hbbs_http::sync::strategy_tests --locked
(2 passed; filter coverage only, no live heartbeat verification).
* Revert "fix: acknowledge heartbeat strategies after application errors"
This reverts commit a03d235236.
* test: fix future strategy option spelling
---------
Co-authored-by: rustdesk <71636191+rustdesk@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
sciter-rs ORs flags together and transmutes the result back into a
fieldless enum (SCITER_CREATE_WINDOW_FLAGS in WindowBuilder::main_window,
EVENT_GROUPS in default_events, and raw event codes from the engine).
Newer rustc checks enum construction when debug assertions are on, so a
debug build of the Sciter UI aborts on startup with "trying to construct
an enum from an invalid value 0x84". Release builds never had the check.
Turn debug assertions off for sciter-rs in the dev profile only. CI's
Rust 1.75 accepts the override and has no such check, so it is a no-op
there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(linux): serve a greetd Wayland login screen over DRM
greetd starts its greeter with no XDG_SESSION_TYPE, so pam_systemd records
the session as Type=tty and the display server reads as x11. is_gdm_user only
knows gdm and sddm, so the DRM login-screen path never engaged at
cosmic-greeter and the greeter's --server captured over X11: a black stream.
Recognize a seat0 session with Class=greeter and Type=tty whose user has a
Wayland socket in /run/user/<uid> as a Wayland login screen, in
is_login_screen_wayland and in Desktop::is_login_wayland, so it takes the path
built for GDM and SDDM greeters. The compositor creates its socket after logind
registers the session, so a greeter first seen without one is asked again on
each refresh. drm builds only; console greeters (tuigreet, agreety) have no
socket and keep their current behavior.
Fixes#16891.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* fix(linux): drop the previous session's compositor env at a greetd greeter
Going straight from a user session to a greetd greeter kept that session's
WAYLAND_DISPLAY and bus address in Desktop, and the greeter --server was
started with them: an endpoint it is handed is never searched past, so the
compositor layout lookup failed and the uinput range fell back to the DRM
union. Clear every compositor variable when a greetd greeter is adopted.
Leave a forced display server alone, as IS_X11 and is_x11_for_drm already
do, and log a failing loginctl instead of taking it for "not a greeter" in
silence.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* fix(linux): take a greetd greeter for Wayland only from its socket
Type=tty names no display server, and the protocol fallback reads the
service's own XDG_SESSION_TYPE, not the session's. A service that inherited
XDG_SESSION_TYPE=wayland therefore made is_login_wayland() answer yes for a
tty greeter that was never adopted, skipping the socket check and a forced
display server. Start a tty greeter from x11 so only
adopt_wayland_tty_greeter can make it Wayland.
Also log an unexpected error reading the runtime directory; a directory
that does not exist yet stays a silent "no socket".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* fix(linux): adopt a greetd greeter when Wayland is forced
adopt_wayland_tty_greeter skipped any forced display server, so with
RUSTDESK_FORCED_DISPLAY_SERVER=wayland the greeter stayed on the x11 path
it now starts from, while its --server was told Wayland. Only a server
forced to x11 is the operator overruling the socket; one forced to Wayland
agrees with it, so adopt the greeter and clear the previous session's
compositor variables as for an unforced one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* fix(linux): keep a greetd greeter off the Wayland login gate when x11 is forced
With RUSTDESK_FORCED_DISPLAY_SERVER=x11, adopt_wayland_tty_greeter leaves a
greetd greeter on the x11 path, but is_login_screen_wayland() still took it
for a Wayland login screen. The login gate in connection.rs then refused the
connection while the DRM verdict was not Available, where master accepted it.
The tty-greeter branch now checks the same override; the GDM/SDDM test is
unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>