* 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>
* fix: add hover behavior to request approval submenus
* fix: use a single hover highlight in legacy popup menus
* fix: avoid duplicate menu tab stops and submenu hover flicker
* fix: skip duplicate focus stops in switch and radio menus
* fix: allow diagonal pointer movement into submenus
* drm: stop repeating an unchanged frame after 3 beats
A still screen sent one identical frame per second for ever (REPEAT_EVERY).
Each of those counts as a real frame in video_service and restarts
static_refresh, so its budget never ran out and the encoder kept re-encoding
the cached frame, about 26 times a second with h264_vaapi. x11 and pipewire
drop a repeat for good.
Send at most MAX_REPEATS (3) repeats after the last new picture. A hardware
encoder switches after 3 failed encodes, so those cover the failed-encode
case the beat is for. A new picture starts the count over.
* drm: notice a new subscriber while the screen is still
Once a still screen has used up its repeats and the static refresh
budget, the WouldBlock arm no longer reaches handle_one_frame or a
static refresh encode, where a subscriber added without a refresh
(the mobile display switch) is noticed. That client got no picture
until the screen changed.
Run the same new-subscriber check at the top of the WouldBlock arm.
* drm: switch for any new subscriber on a still screen
In the WouldBlock arm nothing is sent after the check, so also switch
when the last active subscriber has left and a new one is pending:
the snapshot would promote it with no frame ever following. Log the
expected event at trace level.
* drm: switch for a new subscriber once the encoder has run
Nothing is sent in the WouldBlock arm, so the switch is needed only
when the encoder already produced frames, even if the subscribers
that got them are gone: otherwise the new one gets no keyframe until
the screen changes. A fresh encoder needs no switch. Log the expected
event at trace level.
* drm: leave the new subscriber check in video_service as it was
This reverts the video_service.rs changes of fd872773b, de139dc97 and
ea73ed51f. A subscriber added without a refresh to a still screen is not
specific to drm, so it does not belong in this change.
Give the Start service caller one second to arrange its replacement and exit before retrying main IPC startup. Keep this workaround in the server startup thread and preserve the existing termination path when the retry fails.
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(windows): guard staged installer directories during handoff
Create restrictive staging directories and retain non-delete-sharing handles while CMD consumes packages, scripts and shortcuts. Adapt output paths and cleanup, and add a directory-replacement regression.
Validated with 11 focused Windows tests. Directory protection remains tied to the lifetime of the creating process.
Signed-off-by: fufesou <linlong1266@gmail.com>
* test(windows): streamline installer directory guard tests
Keep installer-file tests in their original inline module and remove the duplicate CMD-copy check from the directory replacement regression. Preserve directory protection and existing handoff coverage.
Validation: Windows library test compilation, four focused tests, rustfmt and git diff --check.
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(windows): use plain rd for empty staging directories
Remove the inapplicable /q switch from non-recursive staging-directory cleanup. Keep recursive deletion confined to the runner directory.
Validated with Windows library test compilation, four focused tests and isolated CMD probes for owner termination, nonempty staging directories and exit-code preservation.
Signed-off-by: fufesou <linlong1266@gmail.com>
* test(windows): pin installer staging directory permissions
Check effective ordinary-owner directory rights independently of the sharing guard. Clarify guard lifetime and the Rust and CMD cleanup responsibilities.
Validation: Windows library test compilation, four focused tests, rustfmt and git diff --check.
Signed-off-by: fufesou <linlong1266@gmail.com>
---------
Signed-off-by: fufesou <linlong1266@gmail.com>
get_audio_input() searched HOST.devices(), which lists input and output
devices together, and took the first device whose name matched. CoreAudio
gives a USB microphone with a headphone jack two devices with the same
name, and the output one can come first. RustDesk then picked the output
device, default_input_config() failed with StreamTypeNotSupported, and the
voice call sent no audio from the macOS side ("Failed to get default input
format" every second).
Search HOST.input_devices() instead, so only devices that support input
can match the configured or default input name.
Signed-off-by: xpehter <32315536+xpehter@users.noreply.github.com>
* fix(windows): drop the named-pipe handoff that F-Secure blocks
Since #16562 the elevated cmd.exe waited on
`set /p RUSTDESK_HANDOFF=<"\\.\pipe\rustdesk-install-<uuid>"` until the
unelevated parent released the staged files' DELETE handles. F-Secure's
behavior detection closes that cmd's end of the pipe, so installation and
Stop service fail with "The pipe is being closed. (0x800700E8)"
(ERROR_NO_DATA) and the BAT never runs (#16840, #16842).
The handles exist only to delete the staged files when UAC is cancelled.
Tampering is prevented by the DACL set at creation, which grants the
unelevated owner read/execute only, and that is unchanged. Release the
handles before launching cmd and run the BAT directly. A cancelled UAC
prompt now leaves the staged BAT and shortcut in the protected directory.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* docs(windows): correct the handoff comments after dropping the pipe
The cleanup handle is no longer held through the UAC prompt, and the files
stay protected by their DACLs together with the parent directory's
permissions, not by the DACL alone. Describe the F-Secure failure as what
was observed: cmd's end of the pipe closed before the release signal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* fix(windows): stage installer inputs in guarded directories
Create private staging directories atomically with restrictive ACLs and retained handles that forbid delete sharing. Reuse the existing handle-based cleanup and cover BAT, shortcut and verified-update inputs with Windows regression tests.
Known limitation: terminating the RustDesk caller before CMD exits still releases the directory guards and can leave staging directories behind.
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(windows): clean up staging directories after batch execution
Remove each batch's own empty staging directories after its files, including when uninstall has terminated the Rust owner. Preserve the installer exit code and cover standalone batch cleanup with a regression test.
Signed-off-by: fufesou <linlong1266@gmail.com>
* test(windows): create protected output directory in handoff test
Exercise the production directory constructor under the retained staging-directory guard while preserving the existing elevated and unelevated assertions.
Signed-off-by: fufesou <linlong1266@gmail.com>
* test(windows): avoid protected installer fixture leftovers
Retain the production directory ACL check with native fixture cleanup. Remove the replacement and handoff tests that leave protected files after unelevated runs.
Signed-off-by: fufesou <linlong1266@gmail.com>
* revert(windows): restore installer handoff to 8ea7251e3
Restore the tracked tree to 8ea7251e35.
Remove the later guarded staging directories and cleanup/test changes,
while retaining the original direct CMD launch without a named pipe.
Reverted changes:
- 6f71c7d3a0
- a188f7b8f1
- d7fb4aff5f
- 6ace789b13
Signed-off-by: fufesou <linlong1266@gmail.com>
---------
Signed-off-by: fufesou <linlong1266@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: fufesou <linlong1266@gmail.com>
The Windows clipboard setter empties the clipboard and writes each format
in order, stopping at the first one that fails. With the marker written
last, a failure after an earlier format succeeded could leave unmarked
content on the clipboard. RustDesk could then read it back as a fresh local
copy and return it, causing the controller to empty its clipboard again.
For applications such as Excel, that destroys the application's copy state.
Write the marker first on Windows so a partial write stays identifiable
as RustDesk-owned. Other platforms keep appending it, so their payload
order is unchanged.
This covers a format failure before the marker is written, not a marker
that is written but later missing or unreadable.
Refs #16291
* fix(server): ignore spaces around IP whitelist entries
* fix(server): parse the IP and ID whitelists the same way, and fail closed
Both checks now read their option through one parser that accepts the
separators the settings dialogs accept (commas, semicolons, whitespace) and
drops empty entries. The IP whitelist split only at commas, so an entry
with a space around it, or a list from custom client settings separated by
semicolons or newlines, matched no address and locked the listed ones out.
A list is off only when the option is empty or holds only commas, which is
how the dialogs store a cleared list. Any other value without entries, such
as a lone space, now blocks every peer for the ID whitelist too, where it
used to let everyone in.
* fix(flutter): skip empty entries in the IP whitelist dialog
A leading or trailing comma gave an empty entry that the dialog rejected
as an invalid IP. Drop empty entries before the check, as the ID whitelist
dialog already does.
* fix(flutter): reject whitelist input that holds only separators
Dropping empty entries made the IP dialog save `,` or `;` as a cleared
whitelist, which turned the restriction off; before, that input failed
the IP check, and the server reads the same text as a list that allows
no one. Both dialogs now split through whitelistInputEntries, which
returns null for separator-only input, and show "Invalid IP" or "Invalid
ID" for it. Empty input and the Clear button still clear the whitelist.
* fix(flutter): keep a whitelist that lets no one in when its dialog is saved unchanged
A stored whitelist such as " , " is on but names no entry, so the server
lets no one in. Its dialog shows it as blank lines, and OK pressed
without an edit trimmed those to an empty field and saved a cleared
whitelist, lifting the restriction.
Both dialogs now take the shown text from whitelistDialogText and, when
the field is unchanged and whitelistLetsNoOneIn says the stored value
lets no one in, close without saving. Clearing the field and the Clear
button still clear the whitelist. The tests cover the load, unchanged
OK and save path for both cleared values (',' and '').
* style(flutter): drop a doubled blank line in whitelist_input.dart
* fix(ui): keep a whitelist that lets no one in when the Sciter dialog is saved unchanged
The Sciter IP whitelist dialog shows " , " as blank lines, trimmed the
submitted text before comparing it with what it showed, and so saved an
unchanged deny-all whitelist as a cleared one. The submitted text is now
compared first, as the Flutter dialogs do.
* test(flutter): name the round-trip test after the helper it checks
* fix(server): narrow the change to ignoring spaces around IP whitelist entries
As the review suggests, only the original fix stays: IP whitelist
entries are trimmed, so "192.168.1.0/24, 10.0.0.1" admits 10.0.0.1.
The ID whitelist keeps master's parsing and its "empty means allow"
behavior. The Flutter dialogs and the Sciter UI are back to master,
and the shared parse_whitelist and the dialog helpers are gone. The
trim lives in ip_whitelist_entries so that one regression test can pin
it. A whitespace-only IP whitelist still blocks everyone, as on master.
* Refactor IP whitelist entries handling and comments
Updated comments for clarity and adjusted whitespace handling in IP whitelist entries.
---------
Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
sysinfo's Cpu::frequency() is in MHz: on Linux it is scaling_cur_freq
(kHz) divided by 1000, or the "cpu MHz" line of /proc/cpuinfo, and on
macOS its documentation says MHz. get_sysinfo divided it by 1024 before
printing GHz, so a CPU at 2885 MHz showed as 2.82GHz instead of 2.89GHz
in the device info sent to the server.
Require a dedicated child success exit code so an unmatched test filter cannot pass the GUI startup regression. Replace the ACE type binding with a local constant and drop the unused SystemServices feature.
Signed-off-by: fufesou <linlong1266@gmail.com>
* Only relay to addresses this peer offered, and bound relay uuids
A RequestRelay forwarded by the rendezvous server carries the relay
address and uuid the requester filled in, and the controlled peer
dialed that address as given. A genuine controller only echoes the
relay this peer put in its own PunchHoleSent or LocalAddr, so remember
those (plus the relay this peer would pick by itself) and drop any
request that names something else, before resolving or connecting.
Relay uuids are opaque pairing keys that arrive from the network and
are sent on to the relay, so both the controlled side (RequestRelay)
and the controller (RelayResponse) now refuse ones that are empty,
longer than 128 bytes, or carry anything but ASCII alphanumerics, '-'
and '_'. This matches the check hbbs applies before forwarding.
Known limits: a WebRTC-failure fallback that follows a peer-initiated
relay whose address hbbs rewrote for the LAN is refused; a refused
request gets no reply, so the controller sees its relay attempts time
out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkh9Gd5dwGW8vL9JNV8
* Expire reported relays after ten minutes
A relay dropped from the configuration or no longer offered by the
rendezvous server stops being an accepted RequestRelay destination once
its last report is ten minutes old. Reporting it again restarts the
clock. The list is shared by all mediators, so it is not cleared when
one starts.
The comment now says where the entries come from and that the list only
bounds where a request can send this peer; it does not authenticate the
request.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkh9Gd5dwGW8vL9JNV8
* Test relay expiry through the relay request check
The expiry tests only called the cache helpers, so a request check that
stopped honouring the expiry would still pass them. check_relay_request
now takes the time like the helpers do, and the request test asserts an
expired relay is refused and accepted again once re-reported. Passing a
later time instead of recording an earlier one avoids Instant underflow
on Windows hosts up for less than ten minutes.
Also formats this PR's own relay check and expiry tests with rustfmt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkh9Gd5dwGW8vL9JNV8
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(lang): pick Hebrew and Indonesian from legacy Android locale codes
The Android service translates its notifications and floating window
menu with Locale.getDefault().toString(). Android's Locale reports
Hebrew and Indonesian with their legacy ISO 639 codes, iw_IL and in_ID,
unless both the device and the app's target SDK are Android 15 or
later. resolve_lang took "iw" and "in" as language codes, found no
table, and fell back to English.
Map "iw" to "he" and "in" to "id", next to the Kazakh and Georgian
mappings.
* fix(lang): say which Android versions report the legacy codes
* fix(ipc): authenticate Windows named pipe servers
Restrict main and service pipe instance creation and authenticate the
connected server before exchanging IPC data. Open clients with data access
that excludes FILE_CREATE_PIPE_INSTANCE.
Require SYSTEM ownership for service channels. For main IPC, also accept a
same-user server with a restricted DACL, matching session and executable,
and sufficient elevation. This includes the UI hosting main IPC while the
service is unavailable, without relying on installation or service config.
Elevated clients reject non-elevated servers, and SYSTEM clients reject
user-owned pipes. New clients reject old permissive listeners until those
processes restart on the fixed version.
Add native Windows regression tests for instance-creation permissions,
DACL rejection before application data, and normal client communication.
Signed-off-by: fufesou <linlong1266@gmail.com>
* refactor(ipc): clarify Windows pipe security policy
Signed-off-by: fufesou <linlong1266@gmail.com>
* test(ipc): bound the Windows server rejection test
Signed-off-by: fufesou <linlong1266@gmail.com>
* test(ipc): bound the complete Windows client communication test
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(windows): keep portable GUI alive on IPC startup failure
Only attempt GUI fallback hosting when the main IPC pipe is absent. Bind its listener before marking hosting active or starting rendezvous, and return on bind failure without terminating the GUI.
Preserve IPC authentication and explicit server-process behavior. Cover rejected listeners, bind collisions, and standalone IPC communication with Windows regression tests.
Signed-off-by: fufesou <linlong1266@gmail.com>
* refactor(windows): simplify portable IPC startup fallback
Rely on exclusive listener creation instead of a separate pipe-presence probe. Keep GUI bind failures recoverable and require a successful bind before starting host services.
Retain the subprocess regression for bind-failure process survival, removing redundant GUI tests and their helper parameters and delay.
Signed-off-by: fufesou <linlong1266@gmail.com>
---------
Signed-off-by: fufesou <linlong1266@gmail.com>
* fix(port-forward): keep the KCP handle alive and send a close reason
A port forward whose connection was won by a UDP punch (KCP) died right
after login. `Client::start` returns, next to the stream, the KCP handle
that drives the stream's UDP I/O, and both login functions dropped it on
return, so the stream failed with "stream closed" on first use. The handle
now goes with the stream to whichever task owns it: the raw pipe's task,
`run_legacy`'s task, or `tunnel_loop`.
Closing such a stream needs care as well. KCP's FIN is sent by the
handle's own tasks and dies with the handle, so the peer would hold the
connection until its own timeout. A KCP tunnel closed from this side now
sends a close reason first, as the remote session does. The port-forward
window's io_loop passes Close on to every mapping and waits 100ms before
its runtime is dropped, so the tunnels get to send it; a login that
receives the Close now ends instead of swallowing it.
Known limits: the raw pipe (a peer without mux) cannot carry a close
reason after `set_raw`, and exits during login send none.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(port-forward): say what the close-reason send bound covers
The bound on sending the close reason keeps that step inside the window's
wait, but a data send already in flight in another arm of `tunnel_loop` is
not bounded by it and holds the close until it returns. The comment said
the whole close fit; say which part does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>