Compare commits

..
Author SHA1 Message Date
rustdeskandClaude Opus 5.5 6cbe36e7e5 fix(windows): ship app icons with a frame for every shell size
The Flutter runner's app_icon.ico had a single 48 px frame, so Explorer,
shortcuts and the taskbar scaled it up at larger icon views and display
scales. Regenerate it from res/icon.png, which the old frame was made
from, with 16, 20, 24, 32, 40, 48, 64, 96, 128 and 256 px frames.

res/icon.ico (the downloadable portable exe, the MSI and the Sciter
build) stopped at 128 px. Add a 256 px frame and keep its other frames
byte for byte.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkig1bcC5Xrr1uwX47b
2026-12-04 17:21:29 +08:00
81 changed files with 87 additions and 856 deletions

No files matched your search

@@ -38,7 +38,6 @@ set -euo pipefail
readonly NO_MATCHES=0
readonly SINGLE_MATCH=1
readonly THEME_MATCHES=2
readonly CONNECTION_PAGE=flutter/lib/desktop/pages/connection_page.dart
has_exact_count() {
local -r expected_count="$1"
@@ -94,10 +93,6 @@ validate_patch_inputs() {
echo "Flutter 3.44 source patch input is missing or unreadable: flutter/lib/common/widgets/dialog.dart" >&2
return 1
fi
if [[ ! -f "$CONNECTION_PAGE" || ! -r "$CONNECTION_PAGE" ]]; then
echo "Flutter 3.44 source patch input is missing or unreadable: $CONNECTION_PAGE" >&2
return 1
fi
}
# The lock diff reverses only once applied, so a restored pubspec.lock is not taken as patched.
@@ -123,8 +118,7 @@ is_complete_patch_state() {
'scrollbarTheme: scrollbarThemeDark,' 'backgroundColor: Color(0xFF18191E),' \
flutter/lib/common.dart &&
has_exact_count "$SINGLE_MATCH" 'selectAllOnFocus: isDesktop ? false : null,' \
flutter/lib/common/widgets/dialog.dart &&
has_exact_count "$SINGLE_MATCH" 'selectAllOnFocus: isDesktop ? false : null,' "$CONNECTION_PAGE"
flutter/lib/common/widgets/dialog.dart
}
is_unpatched_state() {
@@ -140,9 +134,7 @@ is_unpatched_state() {
has_exact_count "$NO_MATCHES" 'google_fonts: ^8.1.0' flutter/pubspec.yaml &&
has_exact_count "$SINGLE_MATCH" 'inputFormatters: inputFormatters,' \
flutter/lib/common/widgets/dialog.dart &&
has_exact_count "$NO_MATCHES" 'selectAllOnFocus' flutter/lib/common/widgets/dialog.dart &&
has_exact_count "$SINGLE_MATCH" 'controller: fieldTextEditingController,' "$CONNECTION_PAGE" &&
has_exact_count "$NO_MATCHES" 'selectAllOnFocus' "$CONNECTION_PAGE"
has_exact_count "$NO_MATCHES" 'selectAllOnFocus' flutter/lib/common/widgets/dialog.dart
}
if ! validate_patch_inputs; then
@@ -152,7 +144,7 @@ fi
if is_complete_patch_state && has_lock_patch; then
echo "Flutter 3.44 source patches already applied."
git --no-pager diff -- flutter/lib/common.dart flutter/pubspec.yaml \
flutter/lib/common/widgets/dialog.dart "$CONNECTION_PAGE"
flutter/lib/common/widgets/dialog.dart
exit 0
fi
@@ -178,10 +170,6 @@ sed -i 's/google_fonts: \^6.2.1/google_fonts: ^8.1.0/' flutter/pubspec.yaml
# DialogTextField keeps the caret when a desktop field regains focus (see the header):
sed -i 's/inputFormatters: inputFormatters,/inputFormatters: inputFormatters,\
selectAllOnFocus: isDesktop ? false : null,/' flutter/lib/common/widgets/dialog.dart
# Refreshing suggestions rewrites the remote ID and invalidates its selection.
# Flutter 3.44 then applies the focus selection policy even while the field stays focused.
sed -i 's/controller: fieldTextEditingController,/controller: fieldTextEditingController,\
selectAllOnFocus: isDesktop ? false : null,/' "$CONNECTION_PAGE"
# Fail loudly if any expected substitution did not produce the complete state.
if ! is_complete_patch_state; then
@@ -190,4 +178,4 @@ if ! is_complete_patch_state; then
fi
git --no-pager diff -- flutter/lib/common.dart flutter/pubspec.yaml \
flutter/lib/common/widgets/dialog.dart "$CONNECTION_PAGE"
flutter/lib/common/widgets/dialog.dart
@@ -12,7 +12,7 @@
#
# Idempotent. To undo the source changes locally:
# git checkout -- flutter/lib/common.dart flutter/lib/common/widgets/dialog.dart \
# flutter/lib/desktop/pages/connection_page.dart flutter/pubspec.yaml flutter/pubspec.lock
# flutter/pubspec.yaml flutter/pubspec.lock
set -euo pipefail
flutter --version | grep -q "Flutter 3\.44\." || {
+1 -1
View File
@@ -66,7 +66,7 @@ env:
VCPKG_COMMIT_ID: "9e593bb18ea69cc5095e012465dcd675a822ed0d"
VCPKG_CMAKE_VERSION: "4.3.0"
ARMV7_VCPKG_COMMIT_ID: "6f29f12e82a8293156836ad81cc9bf5af41fe836" # 2025.01.13, got "/opt/artifacts/vcpkg/vcpkg: No such file or directory" with latest version
VERSION: "1.5.4"
VERSION: "1.5.3"
NDK_VERSION: "r28c"
#signing keys env variable checks
ANDROID_SIGNING_KEY: "${{ secrets.ANDROID_SIGNING_KEY }}"
+1 -1
View File
@@ -17,7 +17,7 @@ env:
TAG_NAME: "nightly"
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
VCPKG_COMMIT_ID: "9e593bb18ea69cc5095e012465dcd675a822ed0d"
VERSION: "1.5.4"
VERSION: "1.5.3"
NDK_VERSION: "r26d"
#signing keys env variable checks
ANDROID_SIGNING_KEY: "${{ secrets.ANDROID_SIGNING_KEY }}"
-1
View File
@@ -60,4 +60,3 @@ flutter/web/
/third_party/libdrmtap/
# Local git worktrees
.worktrees/
flutter/*.sh
Generated
+2 -2
View File
@@ -7061,7 +7061,7 @@ dependencies = [
[[package]]
name = "rustdesk"
version = "1.5.4"
version = "1.5.3"
dependencies = [
"android-wakelock",
"android_logger",
@@ -7178,7 +7178,7 @@ dependencies = [
[[package]]
name = "rustdesk-portable-packer"
version = "1.5.4"
version = "1.5.3"
dependencies = [
"brotli",
"dirs 5.0.1",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "rustdesk"
version = "1.5.4"
version = "1.5.3"
authors = ["rustdesk <info@rustdesk.com>"]
edition = "2021"
build= "build.rs"
+1 -1
View File
@@ -18,7 +18,7 @@ AppDir:
id: rustdesk
name: rustdesk
icon: rustdesk
version: 1.5.4
version: 1.5.3
exec: usr/share/rustdesk/rustdesk
exec_args: $@
apt:
+1 -1
View File
@@ -18,7 +18,7 @@ AppDir:
id: rustdesk
name: rustdesk
icon: rustdesk
version: 1.5.4
version: 1.5.3
exec: usr/share/rustdesk/rustdesk
exec_args: $@
apt:
+22 -31
View File
@@ -566,13 +566,12 @@ class _RemotePageState extends State<RemotePage> with WidgetsBindingObserver {
}
return Container(
color: MyTheme.canvasColor,
child: withKeyHelpTools(
inputModel.isPhysicalMouse.value
? getBodyForMobile()
: RawTouchGestureDetectorRegion(
child: getBodyForMobile(),
ffi: gFFI,
)),
child: inputModel.isPhysicalMouse.value
? getBodyForMobile()
: RawTouchGestureDetectorRegion(
child: getBodyForMobile(),
ffi: gFFI,
),
);
}),
),
@@ -713,27 +712,6 @@ class _RemotePageState extends State<RemotePage> with WidgetsBindingObserver {
!gFFI.canvasModel.cursorEmbedded &&
!gFFI.inputModel.relativeMouseMode.value;
// The key bar sits above the canvas, outside its gesture region: a touch on the bar must not
// also reach the canvas recognizers, which would send it to the remote as a mouse event.
// The cursor and the touch-mode virtual mouse stay above the bar, as they were inside the canvas
// stack. The mouse-mode virtual mouse stays inside the region: see getBodyForMobile.
Widget withKeyHelpTools(Widget body) => Stack(children: [
Positioned.fill(child: body),
Obx(() {
final chatKeyboardRequested =
gFFI.chatModel.softKeyboardRequested.value;
return KeyHelpTools(
keyboardIsVisible: keyboardVisibilityController.isVisible &&
(_showEdit || chatKeyboardRequested),
showGestureHelp: _showGestureHelp);
}),
if (showCursorPaint) CursorPaint(widget.id),
if (gFFI.ffiModel.touchMode)
FloatingMouse(
ffi: gFFI,
),
]);
Widget getBodyForMobile() {
return Container(
color: MyTheme.canvasColor,
@@ -745,6 +723,14 @@ class _RemotePageState extends State<RemotePage> with WidgetsBindingObserver {
right: 10,
child: QualityMonitor(gFFI.qualityMonitorModel),
),
Obx(() {
final chatKeyboardRequested =
gFFI.chatModel.softKeyboardRequested.value;
return KeyHelpTools(
keyboardIsVisible: keyboardVisibilityController.isVisible &&
(_showEdit || chatKeyboardRequested),
showGestureHelp: _showGestureHelp);
}),
SizedBox(
width: 0,
height: 0,
@@ -776,9 +762,14 @@ class _RemotePageState extends State<RemotePage> with WidgetsBindingObserver {
).workaroundFreezeLinuxMint(),
),
];
// Holding a virtual button while another finger drags needs both pointers in the canvas
// recognizers (isSpecialHoldDragActive), so these stay inside the gesture region.
if (!gFFI.ffiModel.touchMode) {
if (showCursorPaint) {
paints.add(CursorPaint(widget.id));
}
if (gFFI.ffiModel.touchMode) {
paints.add(FloatingMouse(
ffi: gFFI,
));
} else {
paints.add(FloatingMouseWidgets(
ffi: gFFI,
));
+1 -1
View File
@@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# 1.1.9-1 works for android, but for ios it becomes 1.1.91, need to set it to 1.1.9-a.1 for iOS, will get 1.1.9.1, but iOS store not allow 4 numbers
version: 1.5.4+72
version: 1.5.3+71
environment:
sdk: '^3.1.0'
@@ -1,66 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_hbb/common.dart';
import 'package:flutter_hbb/common/widgets/peers_view.dart';
import 'package:flutter_hbb/consts.dart';
import 'package:flutter_hbb/desktop/pages/connection_page.dart';
import 'package:flutter_hbb/generated_bridge.dart';
import 'package:flutter_hbb/models/peer_model.dart';
import 'package:flutter_hbb/models/platform_model.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:provider/provider.dart';
class _OutgoingClient extends Fake implements RustdeskImpl {
@override
bool isOutgoingOnly({dynamic hint}) => true;
@override
bool isDisableAb({dynamic hint}) => true;
@override
bool isDisableGroupPanel({dynamic hint}) => true;
@override
bool mainIsOptionFixed({required String key, dynamic hint}) => false;
@override
String mainGetLocalOption({required String key, dynamic hint}) => '';
@override
String getLocalFlutterOption({required String k, dynamic hint}) =>
k == kOptionPeerTabVisible ? '[false,false,false,false,false]' : '';
@override
Future<void> setLocalFlutterOption(
{required String k, required String v, dynamic hint}) async {}
@override
String translate(
{required String name, required String locale, dynamic hint}) =>
'';
@override
Future<String> mainGetLastRemoteId({dynamic hint}) async => '';
@override
Future<void> mainLoadRecentPeers({dynamic hint}) async {}
@override
Future<void> mainLoadLanPeers({dynamic hint}) async {}
}
void main() {
testWidgets('refreshing recent peers keeps the remote ID caret',
(tester) async {
isTest = true;
platformFFI.setBindingForTesting(_OutgoingClient());
await initGlobalFFI();
await tester.pumpWidget(MaterialApp(
theme: MyTheme.lightTheme,
home: ChangeNotifierProvider.value(
value: gFFI.peerTabModel,
child: const Scaffold(body: ConnectionPage()),
),
));
final field = find.descendant(
of: find.byType(RawAutocomplete<Peer>),
matching: find.byType(TextField));
await tester.showKeyboard(field);
await tester.pumpAndSettle();
await tester.enterText(field, 'lhb');
await platformFFI.tryHandle({'name': LoadEvent.recent, 'peers': '[]'});
await tester.pumpAndSettle();
expect(tester.widget<TextField>(field).controller!.selection,
const TextSelection.collapsed(offset: 3));
}, variant: TargetPlatformVariant.only(TargetPlatform.windows));
}
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "rustdesk-portable-packer"
version = "1.5.4"
version = "1.5.3"
edition = "2021"
description = "RustDesk Remote Desktop"
+1 -1
View File
@@ -24,7 +24,7 @@ use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use base::platform::linux::{WaylandDisplayInfo, CMD_SH};
use hbb_common::{anyhow::anyhow, bail, config, serde_json, ResultType};
use hbb_common::{anyhow::anyhow, bail, config, serde_json, tokio, ResultType};
use super::capturable::PixelProvider;
use super::capturable::{Capturable, Recorder};
+1 -1
View File
@@ -1,5 +1,5 @@
pkgname=rustdesk
pkgver=1.5.4
pkgver=1.5.3
pkgrel=0
epoch=
pkgdesc=""
+1 -1
View File
@@ -1,5 +1,5 @@
Name: rustdesk
Version: 1.5.4
Version: 1.5.3
Release: 0
Summary: RPM package
License: GPL-3.0
+1 -1
View File
@@ -1,5 +1,5 @@
Name: rustdesk
Version: 1.5.4
Version: 1.5.3
Release: 0
Summary: RPM package
License: GPL-3.0
+1 -1
View File
@@ -1,5 +1,5 @@
Name: rustdesk
Version: 1.5.4
Version: 1.5.3
Release: 0
Summary: RPM package
License: GPL-3.0
-22
View File
@@ -758,26 +758,6 @@ impl<T: InvokeUiSession> Remote<T> {
match data {
Data::Close => {
self.send_close_reason(peer, "").await;
if peer.is_webrtc() {
// Reconnect starts the next round without waiting for this one, and that
// round reuses this peer's file clipboard channel. Give it up before the
// wait, or this round's cleanup removes the channel the next one is using.
#[cfg(any(target_os = "windows", feature = "unix-file-copy-paste"))]
clipboard::remove_channel_by_conn_id(self.client_conn_id);
// The next round also loads the saved transfer jobs as soon as it logs in.
// The wait discards what arrives, so the jobs no longer change after this.
let _ = self.sync_jobs_status_to_local().await;
// Makes the save on exit a no-op, so it cannot write these jobs over what a
// newer round saved in the meantime.
self.is_connected = false;
// Dropping the stream can discard the queued reason, and then the controlled
// side keeps this session for a password-free reconnect. It closes once it
// has read the reason.
let _ = tokio::time::timeout(Duration::from_secs(1), async {
while let Some(Ok(_)) = peer.next().await {}
})
.await;
}
return false;
}
Data::Login((os_username, os_password, password, remember)) => {
@@ -1719,7 +1699,6 @@ impl<T: InvokeUiSession> Remote<T> {
Some(message::Union::VideoFrame(vf)) => {
if !self.first_frame {
self.first_frame = true;
log::info!("Received first video frame");
self.handler.close_success();
self.handler.adapt_size();
self.send_toggle_virtual_display_msg(peer).await;
@@ -2375,7 +2354,6 @@ impl<T: InvokeUiSession> Remote<T> {
}
}
Some(misc::Union::CloseReason(c)) => {
log::info!("Received CloseReason from the controlled side: {c:?}");
self.sent_close_reason = true; // The controlled end will close, no need to send close reason
self.handler.msgbox("error", "Connection Error", &c, "");
return false;
+2 -2
View File
@@ -193,7 +193,7 @@ impl Drop for KcpStream {
}
#[cfg(test)]
pub(crate) mod tests {
mod tests {
use super::*;
use std::time::Duration;
@@ -205,7 +205,7 @@ pub(crate) mod tests {
(Arc::new(a), Arc::new(b))
}
pub(crate) async fn establish() -> ((KcpStream, Stream), (KcpStream, Stream)) {
async fn establish() -> ((KcpStream, Stream), (KcpStream, Stream)) {
let (a, b) = connected_pair().await;
let (accept_res, connect_res) = tokio::join!(
KcpStream::accept(b, Duration::from_secs(5), None),
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "وضع لوحة المفاتيح"),
("Enable Unicode input", "تفعيل إدخال Unicode"),
("unicode-input-tip", "التقاط نص Unicode الذي ترسله أدوات مثل KeePassXC Auto-Type. يتطلب استخدام مصدر الإدخال 1."),
("Remote terminal access requires an active desktop session", "يتطلب الوصول إلى الطرفية عن بُعد جلسة سطح مكتب نشطة"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Klaviatura rejimi"),
("Enable Unicode input", "Unicode girişini aktivləşdir"),
("unicode-input-tip", "KeePassXC Auto-Type kimi alətlərin göndərdiyi Unicode mətnini tutun. Giriş mənbəyi 1 tələb olunur."),
("Remote terminal access requires an active desktop session", "Terminala uzaqdan daxil olmaq üçün aktiv masaüstü sessiyası tələb olunur"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Рэжым клавіятуры"),
("Enable Unicode input", "Уключыць увод Unicode"),
("unicode-input-tip", "Захопліваць тэкст Unicode, які дасылаюць інструменты накшталт KeePassXC Auto-Type. Патрабуецца крыніца ўводу 1."),
("Remote terminal access requires an active desktop session", "Для аддаленага доступу да тэрмінала патрэбны актыўны сеанс працоўнага стала"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Режим на клавиатурата"),
("Enable Unicode input", "Разрешаване на въвеждане на Unicode"),
("unicode-input-tip", "Прихващане на Unicode текст, изпратен от инструменти като KeePassXC Auto-Type. Изисква източник на въвеждане 1."),
("Remote terminal access requires an active desktop session", "За отдалечен достъп до терминала е необходима активна сесия на работния плот"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Mode de teclat"),
("Enable Unicode input", "Habilita l'entrada Unicode"),
("unicode-input-tip", "Captura el text Unicode enviat per eines com ara KeePassXC Auto-Type. Requereix la font d'entrada 1."),
("Remote terminal access requires an active desktop session", "Per accedir al terminal de manera remota cal una sessió d’escriptori activa"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "键盘模式"),
("Enable Unicode input", "启用 Unicode 输入"),
("unicode-input-tip", "捕获 KeePassXC 自动输入等工具发送的 Unicode 文本。需要使用输入源 1。"),
("Remote terminal access requires an active desktop session", "访问远程终端需要一个活动的桌面会话"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Režim klávesnice"),
("Enable Unicode input", "Povolit vstup Unicode"),
("unicode-input-tip", "Zachytávat text Unicode odesílaný nástroji, jako je KeePassXC Auto-Type. Vyžaduje zdroj vstupu 1."),
("Remote terminal access requires an active desktop session", "Pro vzdálený přístup k terminálu je potřeba aktivní relace pracovní plochy"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Tastaturtilstand"),
("Enable Unicode input", "Aktivér Unicode-input"),
("unicode-input-tip", "Opfang Unicode-tekst sendt af værktøjer som KeePassXC Auto-Type. Kræver inputkilde 1."),
("Remote terminal access requires an active desktop session", "Fjernadgang til terminalen kræver en aktiv skrivebordssession"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Tastaturmodus"),
("Enable Unicode input", "Unicode-Eingabe aktivieren"),
("unicode-input-tip", "Unicode-Text erfassen, der von Werkzeugen wie KeePassXC Auto-Type gesendet wird. Erfordert Eingabequelle 1."),
("Remote terminal access requires an active desktop session", "Der Fernzugriff auf das Terminal erfordert eine aktive Desktop-Sitzung"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Λειτουργία πληκτρολογίου"),
("Enable Unicode input", "Ενεργοποίηση εισαγωγής Unicode"),
("unicode-input-tip", "Λήψη κειμένου Unicode που αποστέλλεται από εργαλεία όπως το KeePassXC Auto-Type. Απαιτείται η πηγή εισόδου 1."),
("Remote terminal access requires an active desktop session", "Η απομακρυσμένη πρόσβαση στο τερματικό απαιτεί ενεργή συνεδρία επιφάνειας εργασίας"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Klavara reĝimo"),
("Enable Unicode input", "Ebligi Unicode-enigon"),
("unicode-input-tip", "Kapti Unicode-tekston senditan de iloj kiel KeePassXC Auto-Type. Postulas enigfonton 1."),
("Remote terminal access requires an active desktop session", "Fora aliro al la terminalo postulas aktivan labortablan seancon"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Modo de teclado"),
("Enable Unicode input", "Habilitar la entrada Unicode"),
("unicode-input-tip", "Captura texto Unicode enviado por herramientas como KeePassXC Auto-Type. Requiere la fuente de entrada 1."),
("Remote terminal access requires an active desktop session", "Para acceder al terminal de forma remota se necesita una sesión de escritorio activa"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Klaviatuurirežiim"),
("Enable Unicode input", "Luba Unicode'i sisestus"),
("unicode-input-tip", "Püüa kinni selliste tööriistade nagu KeePassXC Auto-Type saadetud Unicode'i tekst. Nõuab sisendallikat 1."),
("Remote terminal access requires an active desktop session", "Kaugjuurdepääs terminalile nõuab aktiivset töölauaseanssi"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Teklatuaren modua"),
("Enable Unicode input", "Gaitu Unicode sarrera"),
("unicode-input-tip", "Atzeman KeePassXC Auto-Type bezalako tresnek bidalitako Unicode testua. 1. sarrera-iturria behar du."),
("Remote terminal access requires an active desktop session", "Terminalera urrunetik sartzeko, mahaigaineko saio aktibo bat behar da"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "حالت صفحه کلید"),
("Enable Unicode input", "فعال‌سازی ورودی Unicode"),
("unicode-input-tip", "متن Unicode ارسال‌شده توسط ابزارهایی مانند KeePassXC Auto-Type را دریافت می‌کند. به منبع ورودی 1 نیاز دارد."),
("Remote terminal access requires an active desktop session", "دسترسی از راه دور به ترمینال به یک نشست فعال دسکتاپ نیاز دارد"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Näppäimistötila"),
("Enable Unicode input", "Ota Unicode-syöte käyttöön"),
("unicode-input-tip", "Sieppaa työkalujen (esimerkiksi KeePassXC Auto-Type) lähettämää Unicode-tekstiä. Vaatii syötelähteen 1."),
("Remote terminal access requires an active desktop session", "Päätteen etäkäyttö edellyttää aktiivista työpöytäistuntoa"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Mode du clavier"),
("Enable Unicode input", "Activer la saisie Unicode"),
("unicode-input-tip", "Capturer le texte Unicode envoyé par des outils tels que KeePassXC Auto-Type. Nécessite la source d'entrée 1."),
("Remote terminal access requires an active desktop session", "L’accès à distance au terminal nécessite une session de bureau active"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "კლავიატურის რეჟიმი"),
("Enable Unicode input", "Unicode შეყვანის ჩართვა"),
("unicode-input-tip", "Unicode ტექსტის მიღება, რომელსაც აგზავნიან ისეთი ხელსაწყოები, როგორიცაა KeePassXC Auto-Type. საჭიროა შეყვანის წყარო 1."),
("Remote terminal access requires an active desktop session", "ტერმინალზე დისტანციური წვდომისთვის საჭიროა სამუშაო მაგიდის აქტიური სესია"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Modo de teclado"),
("Enable Unicode input", "Activar a entrada Unicode"),
("unicode-input-tip", "Capturar o texto Unicode enviado por ferramentas como KeePassXC Auto-Type. Require a fonte de entrada 1."),
("Remote terminal access requires an active desktop session", "Para acceder ao terminal de forma remota cómpre ter unha sesión de escritorio activa"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "કીબોર્ડ મોડ"),
("Enable Unicode input", "Unicode ઇનપુટ સક્ષમ કરો"),
("unicode-input-tip", "KeePassXC Auto-Type જેવા સાધનો દ્વારા મોકલાયેલ Unicode લખાણ કૅપ્ચર કરો. ઇનપુટ સ્રોત 1 જરૂરી છે."),
("Remote terminal access requires an active desktop session", "ટર્મિનલને રિમોટ રીતે ઍક્સેસ કરવા માટે સક્રિય ડેસ્કટોપ સત્ર જરૂરી છે"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "מצב מקלדת"),
("Enable Unicode input", "אפשר קלט Unicode"),
("unicode-input-tip", "לכידת טקסט Unicode שנשלח מכלים כגון KeePassXC Auto-Type. נדרש מקור קלט 1."),
("Remote terminal access requires an active desktop session", "כדי לגשת למסוף מרחוק נדרשת הפעלת שולחן עבודה פעילה"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "कीबोर्ड मोड"),
("Enable Unicode input", "Unicode इनपुट सक्षम करें"),
("unicode-input-tip", "KeePassXC Auto-Type जैसे टूल द्वारा भेजे गए Unicode पाठ को कैप्चर करें। इसके लिए इनपुट स्रोत 1 आवश्यक है।"),
("Remote terminal access requires an active desktop session", "टर्मिनल तक दूरस्थ पहुँच के लिए एक सक्रिय डेस्कटॉप सत्र आवश्यक है"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Način rada tipkovnice"),
("Enable Unicode input", "Omogući Unicode unos"),
("unicode-input-tip", "Hvatanje Unicode teksta koji šalju alati poput KeePassXC Auto-Type. Potreban je izvor unosa 1."),
("Remote terminal access requires an active desktop session", "Za udaljeni pristup terminalu potrebna je aktivna sesija radne površine"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Billentyűzetmód"),
("Enable Unicode input", "Unicode-bevitel engedélyezése"),
("unicode-input-tip", "Az olyan eszközök által küldött Unicode-szöveg rögzítése, mint a KeePassXC Auto-Type. Az 1. bemeneti forrást igényli."),
("Remote terminal access requires an active desktop session", "A terminál távoli eléréséhez aktív asztali munkamenet szükséges"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Mode papan ketik"),
("Enable Unicode input", "Aktifkan input Unicode"),
("unicode-input-tip", "Tangkap teks Unicode yang dikirim oleh alat seperti KeePassXC Auto-Type. Memerlukan sumber input 1."),
("Remote terminal access requires an active desktop session", "Akses terminal jarak jauh memerlukan sesi desktop yang aktif"),
].iter().cloned().collect();
}
+3 -4
View File
@@ -830,9 +830,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("drm-capture-tip", "Cattura lo schermo direttamente dalla scheda grafica tramite il servizio RustDesk, senza il prompt di condivisione dello schermo Wayland, anche al login schermo. Potrebbe non funzionare con tutti i dispositivi; se le connessioni chiedono ancora di condividere lo schermo, disabilita questa opzione o usa X11. La modifica di questa opzione disconnetterà le sessioni attuali."),
("wayland-drm-tip", "Per l'accesso non presidiato in Wayland, prova 'Cattura schermo DRM', o se non funziona usa X11."),
("login-wayland-drm-tip", "Per accedere alla schermata di accesso Wayland, prova 'Cattura schermo DRM' o passa a X11."),
("Keyboard mode", "Modo tastiera"),
("Enable Unicode input", "Abilita input Unicode"),
("unicode-input-tip", "Cattura testo Unicode inviato da strumenti come KeePassXC Auto-Type. Richiede input sorgente 1."),
("Remote terminal access requires an active desktop session", ""),
("Keyboard mode", ""),
("Enable Unicode input", ""),
("unicode-input-tip", ""),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "キーボードモード"),
("Enable Unicode input", "Unicode 入力を有効にする"),
("unicode-input-tip", "KeePassXC Auto-Type などのツールが送信する Unicode テキストを取り込みます。入力ソース 1 が必要です。"),
("Remote terminal access requires an active desktop session", "ターミナルへのリモートアクセスには、アクティブなデスクトップセッションが必要です"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "키보드 모드"),
("Enable Unicode input", "Unicode 입력 활성화"),
("unicode-input-tip", "KeePassXC Auto-Type 같은 도구가 보내는 Unicode 텍스트를 캡처합니다. 입력 소스 1이 필요합니다."),
("Remote terminal access requires an active desktop session", "터미널에 원격으로 접속하려면 활성 데스크톱 세션이 필요합니다"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Пернетақта режимі"),
("Enable Unicode input", "Unicode енгізуін қосу"),
("unicode-input-tip", "KeePassXC Auto-Type сияқты құралдар жіберген Unicode мәтінін қабылдау. Енгізу көзі 1 қажет."),
("Remote terminal access requires an active desktop session", "Терминалға қашықтан қол жеткізу үшін белсенді жұмыс үстелі сеансы қажет"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Klaviatūros režimas"),
("Enable Unicode input", "Įgalinti Unicode įvestį"),
("unicode-input-tip", "Perimti Unicode tekstą, kurį siunčia tokie įrankiai kaip KeePassXC Auto-Type. Reikalingas įvesties šaltinis 1."),
("Remote terminal access requires an active desktop session", "Nuotolinei prieigai prie terminalo reikia aktyvaus darbalaukio seanso"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Tastatūras režīms"),
("Enable Unicode input", "Iespējot Unicode ievadi"),
("unicode-input-tip", "Pārtvert Unicode tekstu, ko nosūta tādi rīki kā KeePassXC Auto-Type. Nepieciešams ievades avots 1."),
("Remote terminal access requires an active desktop session", "Lai attālināti piekļūtu terminālim, ir nepieciešama aktīva darbvirsmas sesija"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "കീബോർഡ് മോഡ്"),
("Enable Unicode input", "Unicode ഇൻപുട്ട് പ്രവർത്തനക്ഷമമാക്കുക"),
("unicode-input-tip", "KeePassXC Auto-Type പോലുള്ള ഉപകരണങ്ങൾ അയയ്ക്കുന്ന Unicode ടെക്സ്റ്റ് ക്യാപ്‌ചർ ചെയ്യുക. ഇൻപുട്ട് ഉറവിടം 1 ആവശ്യമാണ്."),
("Remote terminal access requires an active desktop session", "ടെർമിനൽ വിദൂരമായി ആക്‌സസ് ചെയ്യാൻ സജീവമായ ഒരു ഡെസ്ക്ടോപ്പ് സെഷൻ ആവശ്യമാണ്"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Tastaturmodus"),
("Enable Unicode input", "Aktiver Unicode-inndata"),
("unicode-input-tip", "Fang opp Unicode-tekst som sendes av verktøy som KeePassXC Auto-Type. Krever inndatakilde 1."),
("Remote terminal access requires an active desktop session", "Fjerntilgang til terminalen krever en aktiv skrivebordsøkt"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Toetsenbordmodus"),
("Enable Unicode input", "Unicode-invoer inschakelen"),
("unicode-input-tip", "Unicode-tekst opvangen die wordt verzonden door hulpmiddelen zoals KeePassXC Auto-Type. Vereist invoerbron 1."),
("Remote terminal access requires an active desktop session", "Voor toegang op afstand tot de terminal is een actieve bureaubladsessie vereist"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Tryb klawiatury"),
("Enable Unicode input", "Włącz wprowadzanie Unicode"),
("unicode-input-tip", "Przechwytuj tekst Unicode wysyłany przez narzędzia takie jak KeePassXC Auto-Type. Wymaga źródła wejścia 1."),
("Remote terminal access requires an active desktop session", "Zdalny dostęp do terminala wymaga aktywnej sesji pulpitu"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Modo do teclado"),
("Enable Unicode input", "Habilitar entrada Unicode"),
("unicode-input-tip", "Captura texto Unicode enviado por ferramentas como o KeePassXC Auto-Type. Requer a fonte de entrada 1."),
("Remote terminal access requires an active desktop session", "O acesso remoto ao terminal requer uma sessão ativa da área de trabalho"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Modo do teclado"),
("Enable Unicode input", "Ativar entrada Unicode"),
("unicode-input-tip", "Captura texto Unicode enviado por ferramentas como o KeePassXC Auto-Type. Requer a fonte de entrada 1."),
("Remote terminal access requires an active desktop session", "O acesso remoto ao terminal requer uma sessão ativa do ambiente de trabalho"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Mod tastatură"),
("Enable Unicode input", "Activează introducerea Unicode"),
("unicode-input-tip", "Capturează textul Unicode trimis de instrumente precum KeePassXC Auto-Type. Necesită sursa de intrare 1."),
("Remote terminal access requires an active desktop session", "Accesul de la distanță la terminal necesită o sesiune desktop activă"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Режим клавиатуры"),
("Enable Unicode input", "Включить ввод Unicode"),
("unicode-input-tip", "Перехватывать текст Unicode, отправляемый такими инструментами, как KeePassXC Auto-Type. Требуется источник ввода 1."),
("Remote terminal access requires an active desktop session", "Для удалённого доступа к терминалу нужен активный сеанс рабочего стола"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Modalidade de tecladu"),
("Enable Unicode input", "Abìlita s'intrada Unicode"),
("unicode-input-tip", "Catura su testu Unicode imbiadu dae ainas comente KeePassXC Auto-Type. Bisòngiat sa mitza de intrada 1."),
("Remote terminal access requires an active desktop session", "Pro acèdere a su terminale dae tesu serbit una sessione de iscrivania ativa"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Režim klávesnice"),
("Enable Unicode input", "Povoliť vstup Unicode"),
("unicode-input-tip", "Zachytávať text Unicode odosielaný nástrojmi, ako je KeePassXC Auto-Type. Vyžaduje sa zdroj vstupu 1."),
("Remote terminal access requires an active desktop session", "Vzdialený prístup k terminálu vyžaduje aktívnu reláciu pracovnej plochy"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Način tipkovnice"),
("Enable Unicode input", "Omogoči vnos Unicode"),
("unicode-input-tip", "Zajemi besedilo Unicode, ki ga pošiljajo orodja, kot je KeePassXC Auto-Type. Zahteva vir vnosa 1."),
("Remote terminal access requires an active desktop session", "Za oddaljeni dostop do terminala je potrebna aktivna seja namizja"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Modaliteti i tastierës"),
("Enable Unicode input", "Aktivizo hyrjen Unicode"),
("unicode-input-tip", "Kap tekstin Unicode të dërguar nga mjete si KeePassXC Auto-Type. Kërkon burimin e hyrjes 1."),
("Remote terminal access requires an active desktop session", "Për të hyrë në terminal nga larg, nevojitet një sesion aktiv i desktopit"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Režim tastature"),
("Enable Unicode input", "Omogući Unicode unos"),
("unicode-input-tip", "Hvatanje Unicode teksta koji šalju alati kao što je KeePassXC Auto-Type. Zahteva izvor unosa 1."),
("Remote terminal access requires an active desktop session", "Za udaljeni pristup terminalu potrebna je aktivna sesija radne površine"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Tangentbordsläge"),
("Enable Unicode input", "Aktivera Unicode-inmatning"),
("unicode-input-tip", "Fånga Unicode-text som skickas av verktyg som KeePassXC Auto-Type. Kräver inmatningskälla 1."),
("Remote terminal access requires an active desktop session", "Fjärråtkomst till terminalen kräver en aktiv skrivbordssession"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "விசைப்பலகை முறை"),
("Enable Unicode input", "Unicode உள்ளீட்டை இயக்கு"),
("unicode-input-tip", "KeePassXC Auto-Type போன்ற கருவிகள் அனுப்பும் Unicode உரையைப் பிடிக்கவும். உள்ளீட்டு மூலம் 1 தேவை."),
("Remote terminal access requires an active desktop session", "முனையத்தைத் தொலைவிலிருந்து அணுக, செயலில் உள்ள டெஸ்க்டாப் அமர்வு தேவை"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", ""),
("Enable Unicode input", ""),
("unicode-input-tip", ""),
("Remote terminal access requires an active desktop session", ""),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "โหมดคีย์บอร์ด"),
("Enable Unicode input", "เปิดใช้งานการป้อนข้อมูล Unicode"),
("unicode-input-tip", "จับข้อความ Unicode ที่ส่งจากเครื่องมือ เช่น KeePassXC Auto-Type โดยต้องใช้แหล่งป้อนข้อมูล 1"),
("Remote terminal access requires an active desktop session", "การเข้าถึงเทอร์มินัลจากระยะไกลต้องใช้เซสชันเดสก์ท็อปที่กำลังใช้งานอยู่"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Klavye modu"),
("Enable Unicode input", "Unicode girişini etkinleştir"),
("unicode-input-tip", "KeePassXC Auto-Type gibi araçların gönderdiği Unicode metnini yakalar. Giriş kaynağı 1 gerektirir."),
("Remote terminal access requires an active desktop session", "Terminale uzaktan erişim için etkin bir masaüstü oturumu gerekir"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "鍵盤模式"),
("Enable Unicode input", "啟用 Unicode 輸入"),
("unicode-input-tip", "擷取 KeePassXC 自動輸入等工具傳送的 Unicode 文字。需要使用輸入來源 1。"),
("Remote terminal access requires an active desktop session", "若要存取遠端終端機,必須有作用中的桌面工作階段"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Режим клавіатури"),
("Enable Unicode input", "Увімкнути введення Unicode"),
("unicode-input-tip", "Перехоплювати текст Unicode, надісланий такими інструментами, як KeePassXC Auto-Type. Потрібне джерело введення 1."),
("Remote terminal access requires an active desktop session", "Для віддаленого доступу до термінала потрібен активний сеанс стільниці"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "کی بورڈ موڈ"),
("Enable Unicode input", "Unicode ان پٹ کو فعال کریں"),
("unicode-input-tip", "KeePassXC Auto-Type جیسے ٹولز کے بھیجے گئے Unicode متن کو کیپچر کریں۔ ان پٹ کا ماخذ 1 درکار ہے۔"),
("Remote terminal access requires an active desktop session", "ٹرمینل تک ریموٹ رسائی کے لیے ایک فعال ڈیسک ٹاپ سیشن درکار ہے"),
].iter().cloned().collect();
}
-1
View File
@@ -833,6 +833,5 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Keyboard mode", "Chế độ bàn phím"),
("Enable Unicode input", "Bật đầu vào Unicode"),
("unicode-input-tip", "Thu nhận văn bản Unicode do các công cụ như KeePassXC Auto-Type gửi đến. Yêu cầu nguồn đầu vào 1."),
("Remote terminal access requires an active desktop session", "Cần có một phiên màn hình nền đang hoạt động để truy cập terminal từ xa"),
].iter().cloned().collect();
}
+13 -107
View File
@@ -2,8 +2,6 @@ use super::{gtk_sudo, CursorData, ResultType};
use desktop::Desktop;
pub use base::platform::linux::*;
pub(crate) mod terminal;
#[cfg(feature = "drm")]
pub fn dispatch_wayland_display_probe() {
use std::ffi::OsStr;
@@ -1091,16 +1089,9 @@ mod audio_latency_env_tests {
}
}
const LOGIND_SESSION_ARG: &str = "--logind-session=";
#[inline]
fn try_start_server_(desktop: Option<&Desktop>) -> ResultType<Option<Child>> {
let session = desktop
.map_or(Some(""), Desktop::root_server_session)
.map(|id| format!("{LOGIND_SESSION_ARG}{id}"));
let mut args = vec!["--server"];
args.extend(session.as_deref());
match desktop.filter(|desktop| !desktop.uses_service_environment()) {
match desktop {
Some(desktop) => {
let mut envs = vec![];
if !desktop.display.is_empty() {
@@ -1140,22 +1131,17 @@ fn try_start_server_(desktop: Option<&Desktop>) -> ResultType<Option<Child>> {
get_cur_term(&desktop.uid).unwrap_or_else(|| suggest_best_term()),
));
run_as_user(
args,
vec!["--server"],
Some((desktop.uid.clone(), desktop.username.clone())),
envs,
)
}
None => Ok(Some(crate::run_me(args)?)),
None => Ok(Some(crate::run_me(vec!["--server"])?)),
}
}
#[inline]
fn start_server(desktop: Option<&Desktop>, server: &mut Option<Child>) {
// should_start_server checked before force_stop_server() and the DRM greeter grace, so a
// sleep requested in between would otherwise still get a --server.
if is_system_preparing_for_sleep() {
return;
}
match try_start_server_(desktop) {
Ok(ps) => *server = ps,
Err(err) => {
@@ -1289,47 +1275,10 @@ fn should_start_server(
} else {
start_new = true;
}
if start_new && is_system_preparing_for_sleep() {
start_new = false;
}
*cm0 = cm;
start_new
}
// A --server started while the system enters sleep probes the GPU encoders, and NVENC init during
// suspend entry can hang the NVIDIA driver (#17208). logind keeps PreparingForSleep set from the
// sleep request until the system has resumed, so the start is retried by the loop after wake.
fn is_system_preparing_for_sleep() -> bool {
use dbus::blocking::{stdintf::org_freedesktop_dbus::Properties, Connection};
let preparing = Connection::new_system().and_then(|conn| {
conn.with_proxy(
"org.freedesktop.login1",
"/org/freedesktop/login1",
Duration::from_secs(1),
)
.get::<bool>("org.freedesktop.login1.Manager", "PreparingForSleep")
});
match preparing {
Ok(true) => {
hbb_common::throttled_log!(
Duration::from_secs(60),
info,
"system is preparing for sleep; --server starts after wake"
);
true
}
Ok(false) => false,
Err(err) => {
hbb_common::throttled_log!(
Duration::from_secs(600),
warn,
"failed to read logind PreparingForSleep: {err}"
);
false
}
}
}
// to-do: stop_server(&mut user_server); may not stop child correctly
// stop_rustdesk_servers() is just a temp solution here.
fn force_stop_server() {
@@ -1380,16 +1329,14 @@ pub fn start_os_service() {
update_active_user_lookup_cache(&desktop);
// Duplicate logic here with should_start_server.
let root_desktop = desktop.uses_service_environment().then_some(&desktop);
let root_session_changed = desktop.uid == "0" && sid != desktop.sid;
if root_desktop.is_some() || desktop.is_login_wayland() {
if desktop.username == "root" || desktop.is_login_wayland() {
// try kill subprocess "--server"
stop_server(&mut user_server);
// try start subprocess "--server"
// A switch between root logins needs a new server bound to the selected session.
// No need to check is_display_changed here.
if should_start_server(
true,
root_session_changed,
false,
&mut uid,
&desktop,
&mut cm0,
@@ -1403,13 +1350,14 @@ pub fn start_os_service() {
// SDDM Wayland greeter (is_gdm_user covers both) or a greetd one (tty_greeter), and
// desktop.uid is that greeter's uid, so this drops to whichever greeter owns seat0.
// A greeter neither recognizes (e.g. LightDM) never reaches this branch -- it takes
// the unprivileged else-branch below already. A genuine root graphical session (UID 0)
// the unprivileged else-branch below already. A genuine root graphical session (username=="root")
// has no lower uid to drop to, so it stays root. The whole branch is gated on the drm
// feature and on allow-drm-capture. Only a root desktop supplies a session ID for terminals.
// feature and on allow-drm-capture; otherwise it is upstream's single
// `start_server(None, ..)` line.
#[cfg(not(feature = "drm"))]
start_server(root_desktop, &mut server);
start_server(None, &mut server);
#[cfg(feature = "drm")]
if drm_capture_enabled() && root_desktop.is_none() && !desktop.uid.is_empty() {
if drm_capture_enabled() && desktop.username != "root" && !desktop.uid.is_empty() {
start_server(Some(&desktop), &mut server);
// If dropping to the greeter uid did not produce a RUNNING server, fall back to a
// root --server so the login screen stays remotable instead of looping on a
@@ -1427,15 +1375,14 @@ pub fn start_os_service() {
start_server(None, &mut server);
}
} else {
start_server(root_desktop, &mut server);
start_server(None, &mut server);
}
}
} else if desktop.username != "" {
// try kill subprocess "--server"
stop_server(&mut server);
let is_display_changed =
root_session_changed || desktop.display != display || desktop.xauth != xauth;
let is_display_changed = desktop.display != display || desktop.xauth != xauth;
display = desktop.display.clone();
xauth = desktop.xauth.clone();
@@ -2502,22 +2449,6 @@ mod desktop {
super::is_gdm_user(&self.username) && self.protocol == DISPLAY_SERVER_WAYLAND
}
/// An empty session ID marks a privileged greeter and denies its terminal.
pub(super) fn root_server_session(&self) -> Option<&str> {
if self.uid != "0" {
return None;
}
if self.username.is_empty() || self.is_login_wayland() {
Some("")
} else {
Some(&self.sid)
}
}
pub(super) fn uses_service_environment(&self) -> bool {
self.uid == "0" && (self.username == "root" || self.is_login_wayland())
}
/// The greeter's compositor creates its socket after logind has registered the session,
/// so a greeter first seen without one is asked again on every refresh until it has one.
/// Every compositor variable is dropped, not only the x11 values guessed meanwhile: going
@@ -2957,31 +2888,6 @@ mod desktop {
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn uid_zero_alias_binds_terminal_to_its_desktop() {
let session = |uid: &str, username: &str, protocol: &str| Desktop {
sid: "8".into(),
uid: uid.into(),
username: username.into(),
protocol: protocol.into(),
..Desktop::default()
};
let admin = session("0", "desktop-admin", DISPLAY_SERVER_WAYLAND);
assert_eq!(admin.root_server_session(), Some("8"));
assert!(!admin.uses_service_environment());
assert!(session("0", "root", DISPLAY_SERVER_WAYLAND).uses_service_environment());
let user = session("1000", "root", DISPLAY_SERVER_X11);
assert_eq!(user.root_server_session(), None);
let greeter = session("0", "gdm", DISPLAY_SERVER_WAYLAND);
assert_eq!(greeter.root_server_session(), Some(""));
assert!(greeter.uses_service_environment());
}
}
}
/// A session-bus idle-inhibit interface, tried in order; the first that answers wins.
-262
View File
@@ -1,262 +0,0 @@
use super::{CMD_LOGINCTL, LOGIND_SESSION_ARG};
use dbus::{
blocking::{stdintf::org_freedesktop_dbus::Properties, Connection},
Path,
};
use hbb_common::{
anyhow::{ensure, Context},
timeout, tokio, users, whoami, ResultType,
};
const SESSION_LOOKUP_TIMEOUT_MS: u64 = 2_000;
const DBUS_TIMEOUT: std::time::Duration =
std::time::Duration::from_millis(SESSION_LOOKUP_TIMEOUT_MS);
const LOGIN1: &str = "org.freedesktop.login1";
const LOGIN1_PATH: &str = "/org/freedesktop/login1";
pub(crate) async fn is_allowed() -> ResultType<bool> {
let arg = std::env::args_os().nth(2).unwrap_or_default();
let selector = logind_selector(arg.to_str().filter(|_| crate::is_server()));
session_allows_terminal(users::get_effective_uid(), selector).await
}
fn logind_selector(arg: Option<&str>) -> Option<&str> {
match arg.and_then(|arg| arg.strip_prefix(LOGIND_SESSION_ARG)) {
Some("") => None, // The service explicitly marked a greeter fallback.
None => Some(""), // Even on logind v237, an empty selector means the caller's own session.
Some(id) => Some(id),
}
}
async fn session_allows_terminal(uid: u32, selector: Option<&str>) -> ResultType<bool> {
if uid != 0 {
return Ok(true);
}
let Some(id) = selector else { return Ok(false) };
let mut cmd = tokio::process::Command::new(CMD_LOGINCTL.as_str());
cmd.kill_on_drop(true).args(["show-session", "--all"]);
for field in [
"Id", "User", "Class", "State", "Remote", "Seat", "Type", "Display",
] {
cmd.args(["-p", field]);
}
cmd.args(["--", id]);
let output = timeout(SESSION_LOOKUP_TIMEOUT_MS, cmd.output())
.await
.context("loginctl show-session timed out")?
.context("could not run loginctl show-session")?;
let status = output.status;
ensure!(
status.success(),
"loginctl show-session failed ({status}): {}",
String::from_utf8_lossy(&output.stderr).trim_end()
);
let properties = std::str::from_utf8(&output.stdout)?;
let display = std::env::var("DISPLAY").ok();
let check = root_desktop_display(properties, id, display.as_deref());
verify_display(check, local_x11_session).await
}
enum DisplayCheck<'a> {
Matched,
SocketSession { number: u32, session: &'a str },
}
fn root_desktop_display<'a>(
properties: &'a str,
id: &str,
display: Option<&str>,
) -> Option<DisplayCheck<'a>> {
let value = |key: &str| {
let mut fields = properties.lines().filter_map(|line| line.strip_prefix(key));
let first = fields.next()?;
fields.next().is_none().then_some(first)
};
if (!id.is_empty() && value("Id=")? != id)
|| value("User=")? != "0"
// Active stays yes while a logging-out session still holds the seat; State is closing then.
|| value("State=")? != "active"
|| value("Remote=")? != "no"
|| value("Seat=")?.is_empty()
|| !matches!(
value("Class=")?,
"user" | "user-early" | "user-light" | "user-early-light"
)
{
return None;
}
match value("Type=")? {
"wayland" => Some(DisplayCheck::Matched),
"x11" => {
let server = x11_server(display?)?;
match value("Display=")? {
// GDM on Xorg can leave Display empty on an active graphical session.
"" if server.0.is_empty() && server.1.bytes().all(|b| b.is_ascii_digit()) => {
Some(DisplayCheck::SocketSession {
number: server.1.parse().ok()?,
session: value("Id=").filter(|id| !id.is_empty())?,
})
}
expected if x11_server(expected) == Some(server) => Some(DisplayCheck::Matched),
_ => None,
}
}
_ => None,
}
}
async fn verify_display<F>(
check: Option<DisplayCheck<'_>>,
socket_session: impl FnOnce(u32) -> F,
) -> ResultType<bool>
where
F: std::future::Future<Output = ResultType<String>>,
{
match check {
Some(DisplayCheck::Matched) => Ok(true),
Some(DisplayCheck::SocketSession { number, session }) => {
Ok(socket_session(number).await? == session)
}
None => Ok(false),
}
}
async fn local_x11_session(number: u32) -> ResultType<String> {
timeout(SESSION_LOOKUP_TIMEOUT_MS, async {
let (pid, _socket) = local_x11_peer(number).await?;
tokio::task::spawn_blocking(move || x11_peer_logind_session(pid)).await?
})
.await
.context("X11 session lookup timed out")?
}
async fn local_x11_peer(number: u32) -> ResultType<(u32, tokio::net::UnixStream)> {
use std::io::ErrorKind::{ConnectionRefused, NotFound};
let path = format!("/tmp/.X11-unix/X{number}");
let mut peer = None;
// X11 transports can use either name. If both exist, they must identify the same server.
for name in [format!("\0{path}"), path] {
let socket = match tokio::net::UnixStream::connect(name).await {
Ok(socket) => socket,
Err(err) if matches!(err.kind(), NotFound | ConnectionRefused) => continue,
Err(err) => return Err(err.into()),
};
let cred = socket.peer_cred()?;
ensure!(cred.uid() == 0, "local X11 peer does not run as root");
let pid = cred
.pid()
.filter(|&p| p > 0)
.context("local X11 socket has no peer PID")? as u32;
if let Some((previous, _)) = &peer {
ensure!(*previous == pid, "local X11 sockets have different peers");
} else {
peer = Some((pid, socket));
}
}
peer.context("no local X11 socket for the root desktop")
}
fn x11_peer_logind_session(pid: u32) -> ResultType<String> {
let bus = Connection::new_system()?;
let manager = bus.with_proxy(LOGIN1, LOGIN1_PATH, DBUS_TIMEOUT);
let (path,): (Path<'static>,) =
manager.method_call("org.freedesktop.login1.Manager", "GetSessionByPID", (pid,))?;
let session = bus.with_proxy(LOGIN1, path, DBUS_TIMEOUT);
const SESSION: &str = "org.freedesktop.login1.Session";
let id = session.get(SESSION, "Id")?;
ensure!(
session.get::<String>(SESSION, "State")? == "active",
"local X11 peer session is not active"
);
Ok(id)
}
fn x11_server(display: &str) -> Option<(&str, &str)> {
let (host, number) = display.rsplit_once(':')?;
let number = number.split('.').next()?;
let local = matches!(host, "" | "unix" | "unix/")
|| whoami::fallible::hostname().ok().as_deref() == Some(host);
(!number.is_empty()).then_some((if local { "" } else { host }, number))
}
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn greeter_fallback_denies_only_root_terminals() {
let fallback = logind_selector(Some(LOGIND_SESSION_ARG));
assert_eq!(fallback, None);
assert!(!session_allows_terminal(0, fallback).await.unwrap());
assert!(session_allows_terminal(117, fallback).await.unwrap());
assert_eq!(logind_selector(None), Some(""));
assert_eq!(logind_selector(Some("--logind-session=7")), Some("7"));
}
#[tokio::test]
async fn gdm_x11_with_empty_display_can_authorize_its_own_root_desktop() {
let session =
"Id=8\nUser=0\nClass=user\nSeat=seat0\nState=active\nRemote=no\nType=x11\nDisplay=";
for (display, peer_session, allowed) in [
(":1", "8", true),
("unix/:1", "8", true),
("unix/:1", "9", false),
] {
let check = root_desktop_display(session, "8", Some(display));
let result = verify_display(check, |number| {
assert_eq!(number, 1);
std::future::ready(Ok(peer_session.to_owned()))
})
.await
.unwrap();
assert_eq!(result, allowed);
}
assert!(root_desktop_display(session, "8", Some("remote:1")).is_none());
for invalid in [
session.replace("Class=user", "Class=greeter"),
session.replace("\nDisplay=", ""),
format!("{session}\nDisplay="),
] {
assert!(root_desktop_display(&invalid, "8", Some(":1")).is_none());
}
}
#[test]
fn root_terminal_requires_its_own_local_desktop() {
let is_active_root_desktop =
|props: &str, id: &str, display: Option<&str>| match root_desktop_display(
props, id, display,
) {
Some(DisplayCheck::Matched) => true,
None => false,
Some(DisplayCheck::SocketSession { .. }) => panic!("unexpected X11 socket check"),
};
let session = "Id=7\nUser=0\nClass=user\nSeat=seat1\nState=active\nRemote=no";
let hostname = whoami::fallible::hostname().unwrap();
let x11 = format!("{session}\nType=x11\nDisplay={hostname}:0");
assert!(is_active_root_desktop(&x11, "7", Some(":0.0")));
assert!(is_active_root_desktop(&x11, "7", Some("unix/:0.0")));
assert!(!is_active_root_desktop(&x11, "7", Some("tcp/:0")));
assert!(!is_active_root_desktop(&x11, "8", Some(":0")));
assert!(!is_active_root_desktop(&x11, "", Some(":1")));
assert!(!is_active_root_desktop(
&format!("{session}\nType=x11"),
"7",
None
));
let other_host = format!("other.{hostname}:0");
assert!(!is_active_root_desktop(&x11, "7", Some(&other_host)));
let wayland = format!("{session}\nType=wayland");
assert!(is_active_root_desktop(&wayland, "", None));
let greeter = wayland.replace("Class=user", "Class=greeter");
assert!(!is_active_root_desktop(&greeter, "7", None));
// logind during a logout: still the seat's active session, but closing.
let logging_out = wayland.replace("State=active", "Active=yes\nState=closing");
assert!(!is_active_root_desktop(&logging_out, "7", None));
for required in session.lines() {
let missing = wayland.replace(required, "");
assert!(!is_active_root_desktop(&missing, "7", None), "{required}");
}
}
}
+1 -3
View File
@@ -48,7 +48,6 @@ fn connection_meta(
ConnectionMeta {
control_permissions,
controlled_context,
..Default::default()
}
}
@@ -1534,7 +1533,7 @@ async fn udp_nat_listen(
peer_addr: SocketAddr,
peer_addr_v4: SocketAddr,
server: ServerPtr,
mut meta: ConnectionMeta,
meta: ConnectionMeta,
slot: PunchSlot,
) -> ResultType<()> {
let tm = Instant::now();
@@ -1551,7 +1550,6 @@ async fn udp_nat_listen(
// The KCP session is up: from here it is a connection like any other and the connection
// layer's own limits apply to it, so the place goes back for the next punch.
drop(slot);
meta.is_kcp = true;
crate::server::create_tcp_connection(server, stream.1, peer_addr_v4, true, meta).await?;
Ok(())
};
-1
View File
@@ -90,7 +90,6 @@ type ConnMap = HashMap<i32, ConnInner>;
pub struct ConnectionMeta {
pub control_permissions: Option<ControlPermissions>,
pub controlled_context: Option<ControlledContext>,
pub is_kcp: bool,
}
#[cfg(any(target_os = "macos", target_os = "linux"))]
+22 -215
View File
@@ -75,8 +75,6 @@ use windows::Win32::Foundation::{CloseHandle, HANDLE};
use crate::virtual_display_manager;
pub type Sender = mpsc::UnboundedSender<(Instant, Arc<Message>)>;
#[cfg(target_os = "linux")]
mod linux_terminal;
mod trusted_devices;
const FAILURE_IDX_ID_WHITELIST: usize = 2;
@@ -228,15 +226,6 @@ fn constant_time_eq(a: &[u8], b: &[u8]) -> bool {
x == 0
}
async fn wait_for_peer_close(stream: &mut Stream, is_kcp: bool) {
// KCP uses a loopback TCP stream and can wait until the timeout when its endpoint stops.
let timeout_secs = if is_kcp || stream.is_webrtc() { 1 } else { 10 };
let _ = time::timeout(Duration::from_secs(timeout_secs), async {
while let Some(Ok(_)) = stream.next().await {}
})
.await;
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
fn should_use_terminal_os_login_scope(is_terminal: bool, os_login_username: &str) -> bool {
cfg!(target_os = "windows") && is_terminal && !os_login_username.trim().is_empty()
@@ -366,10 +355,10 @@ impl TerminalUserToken {
}
}
}
pub struct Connection<'a> {
pub struct Connection {
inner: ConnInner,
display_idx: usize,
stream: &'a mut Stream,
stream: super::Stream,
server: super::ServerPtrWeak,
hash: Hash,
read_jobs: Vec<fs::TransferJob>,
@@ -447,7 +436,6 @@ pub struct Connection<'a> {
#[cfg(not(any(target_os = "ios")))]
pressed_modifiers: HashSet<rdev::Key>,
closed: bool,
sent_final_message: bool,
#[cfg(not(any(target_os = "android", target_os = "ios")))]
start_cm_ipc_para: Option<StartCmIpcPara>,
auto_disconnect_timer: Option<(Instant, u64)>,
@@ -541,41 +529,18 @@ fn drm_can_serve_login_screen() -> bool {
false
}
impl Connection<'_> {
impl Connection {
pub async fn start(
addr: SocketAddr,
mut stream: super::Stream,
stream: super::Stream,
id: i32,
server: super::ServerPtrWeak,
meta: super::ConnectionMeta,
unauthorized: UnauthorizedID,
) {
// The admission place stays held while the transport drains, unless a newer
// connection needs it.
let is_kcp = meta.is_kcp;
let (wait_for_close, unauthorized) =
Self::_start(addr, &mut stream, id, server, meta, unauthorized).await;
if wait_for_close {
// Only the transport is needed here. Session cleanup must not wait for the peer.
tokio::select! {
_ = wait_for_peer_close(&mut stream, is_kcp) => {}
_ = unauthorized_evicted(&unauthorized) => {}
}
}
}
async fn _start(
addr: SocketAddr,
stream: &mut Stream,
id: i32,
server: super::ServerPtrWeak,
meta: super::ConnectionMeta,
unauthorized: UnauthorizedID,
) -> (bool, Option<UnauthorizedID>) {
let super::ConnectionMeta {
control_permissions,
controlled_context,
is_kcp,
} = meta;
// Android is not supported yet, so we always set control_permissions to None.
#[cfg(target_os = "android")]
@@ -605,7 +570,7 @@ impl Connection<'_> {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
let tx_cloned = tx.clone();
let mut conn = Connection {
let mut conn = Self {
inner: ConnInner {
id,
tx: Some(tx),
@@ -680,7 +645,6 @@ impl Connection<'_> {
#[cfg(not(any(target_os = "ios")))]
pressed_modifiers: Default::default(),
closed: false,
sent_final_message: false,
#[cfg(not(any(target_os = "android", target_os = "ios")))]
start_cm_ipc_para: Some(StartCmIpcPara {
rx_to_cm,
@@ -712,7 +676,7 @@ impl Connection<'_> {
conn.closed = true;
// sleep to ensure msg got received.
sleep(1.).await;
return (false, None);
return;
}
#[cfg(target_os = "android")]
start_channel(rx_to_cm, tx_from_cm);
@@ -779,7 +743,6 @@ impl Connection<'_> {
(_tx_clip, rx_clip) = mpsc::unbounded_channel::<i32>();
}
let mut manual_disconnect = false;
loop {
tokio::select! {
// biased; // video has higher priority // causing test_delay_timer failed while transferring big file
@@ -811,7 +774,6 @@ impl Connection<'_> {
ipc::Data::Close => {
conn.chat_unanswered = false; // seen
conn.file_transferred = false; //seen
manual_disconnect = true;
conn.send_close_reason_no_retry("").await;
conn.on_close("connection manager", true).await;
break;
@@ -1111,7 +1073,7 @@ impl Connection<'_> {
_ = conn.file_timer.tick() => {
if !conn.read_jobs.is_empty() {
conn.send_to_cm(ipc::Data::FileTransferLog(("transfer".to_string(), fs::serialize_transfer_jobs(&conn.read_jobs))));
match fs::handle_read_jobs(&mut conn.read_jobs, conn.stream).await {
match fs::handle_read_jobs(&mut conn.read_jobs, &mut conn.stream).await {
Ok(log) => {
if !log.is_empty() {
conn.send_to_cm(ipc::Data::FileTransferLog(("transfer".to_string(), log)));
@@ -1128,7 +1090,6 @@ impl Connection<'_> {
}
Ok(conns) = hbbs_rx.recv() => {
if conns.contains(&id) {
manual_disconnect = true;
conn.send_close_reason_no_retry("Closed manually by web console").await;
conn.on_close("web console", true).await;
break;
@@ -1209,7 +1170,7 @@ impl Connection<'_> {
Some(data) = rx_from_authed.recv() => {
match data {
ipc::Data::Close => {
conn.send_before_close(crate::common::make_privacy_mode_msg(
conn.send(crate::common::make_privacy_mode_msg(
back_notification::PrivacyModeState::PrvOnByOther,
String::new(),
)).await;
@@ -1321,10 +1282,6 @@ impl Connection<'_> {
}
conn.on_close("End", true).await;
log::info!("#{} connection loop exited", id);
(
conn.should_wait_for_peer_close(is_kcp, manual_disconnect),
conn.unauthorized_id.take(),
)
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
@@ -1490,7 +1447,7 @@ impl Connection<'_> {
async fn check_privacy_mode_on(&mut self) -> bool {
if privacy_mode::is_in_privacy_mode() {
self.send_login_error_before_close("Someone turns on privacy mode, exit")
self.send_login_error("Someone turns on privacy mode, exit")
.await;
false
} else {
@@ -1538,15 +1495,13 @@ impl Connection<'_> {
self.decay_id_whitelist_failures();
let (failure, res) = self.check_failure(FAILURE_IDX_ID_WHITELIST).await;
if !res {
// check_failure sent the error; its other callers keep the connection open.
self.sent_final_message = true;
return false;
}
if id_whitelist_allows(&id_whitelist, &self.lr.my_id) {
return true;
}
self.update_failure(failure, false, FAILURE_IDX_ID_WHITELIST);
self.send_login_error_before_close("Your ID is blocked by the peer")
self.send_login_error("Your ID is blocked by the peer")
.await;
self.post_alarm_audit(
AlarmAuditType::IdWhitelist,
@@ -1884,7 +1839,7 @@ impl Connection<'_> {
return true;
};
if pf.multiplex {
crate::port_forward_mux::cap_packet_size(self.stream);
crate::port_forward_mux::cap_packet_size(&mut self.stream);
// `inner.tx` is set for the connection's whole life; `None` here is
// unreachable, and refusing the login is the only honest answer.
self.port_forward_mux = self.inner.tx.clone().map(|tx| {
@@ -1905,7 +1860,7 @@ impl Connection<'_> {
if is_rdp {
addr = "RDP".to_owned();
}
self.send_login_error_before_close(format!(
self.send_login_error(format!(
"Failed to access remote {}. Please make sure it is reachable/open.",
addr
))
@@ -1917,7 +1872,7 @@ impl Connection<'_> {
if is_rdp {
addr = "RDP".to_owned();
}
self.send_login_error_before_close(format!(
self.send_login_error(format!(
"Failed to access remote {}. Please make sure it is reachable/open.",
addr
))
@@ -2537,24 +2492,6 @@ impl Connection<'_> {
self.send(msg_out).await;
}
async fn send_login_error_before_close<T: std::string::ToString>(&mut self, err: T) {
let mut msg_out = Message::new();
let mut res = LoginResponse::new();
res.set_error(err.to_string());
res.trusted_device_v2_supported =
self.lr.trusted_device_v2_supported && self.trusted_device.is_some();
msg_out.set_login_response(res);
self.send_before_close(msg_out).await;
}
/// For the last message before the connection closes, so WebRTC and KCP get to deliver it.
async fn send_before_close(&mut self, msg: Message) {
match self.stream.send(&msg).await {
Ok(()) => self.sent_final_message = true,
Err(err) => log::debug!("Failed to send the last message before closing: {err}"),
}
}
#[inline]
pub fn send_block_input_error(
s: &Sender,
@@ -2967,8 +2904,7 @@ impl Connection<'_> {
Self::login_scope_kind(&self.lr),
Self::login_scope_kind(lr),
);
self.send_login_error_before_close("Connection not allowed")
.await;
self.send_login_error("Connection not allowed").await;
false
}
Some(_) => true,
@@ -3123,7 +3059,7 @@ impl Connection<'_> {
if !crate::common::is_direct_ip_access(&lr.username) && lr.username != Config::get_id()
{
self.send_login_error_before_close(crate::client::LOGIN_MSG_OFFLINE)
self.send_login_error(crate::client::LOGIN_MSG_OFFLINE)
.await;
return false;
}
@@ -3291,8 +3227,7 @@ impl Connection<'_> {
log::warn!(
"Rejected switch sides response for non-remote-desktop session; closing connection"
);
self.send_login_error_before_close("Connection not allowed")
.await;
self.send_login_error("Connection not allowed").await;
return false;
}
self.reset_session_scope_for_login();
@@ -4274,7 +4209,7 @@ impl Connection<'_> {
true
}
#[cfg(target_os = "macos")]
#[cfg(any(target_os = "linux", target_os = "macos"))]
fn fill_terminal_user_token(
&mut self,
_username: &str,
@@ -4404,7 +4339,6 @@ impl Connection<'_> {
);
// Terminal OS login is sensitive. Close this connection instead of keeping it
// alive for retries on the same socket after a rate-limit block.
self.sent_final_message = true;
return Some(false);
}
TerminalAuthorizationMode::OsLogin {
@@ -4421,12 +4355,9 @@ impl Connection<'_> {
TerminalAuthorizationMode::SessionUser => FailureScope::Default,
};
#[cfg(target_os = "linux")]
let terminal_login_error = linux_terminal::fill_token(&mut self.terminal_user_token).await;
#[cfg(not(target_os = "linux"))]
let username = normalized_username;
let password = self.lr.os_login.password.clone();
let terminal_login_error = {
let username = normalized_username;
let password = self.lr.os_login.password.clone();
#[cfg(target_os = "windows")]
{
// Concurrency gate for terminal OS login with credentials, to prevent brute-force attacks.
@@ -4471,15 +4402,6 @@ impl Connection<'_> {
} else {
"Terminal session-user authorization"
};
#[cfg(target_os = "linux")]
hbb_common::throttled_log!(
linux_terminal::LOG_INTERVAL,
warn,
"{auth_context} failed: ip={} conn_id={} scope={failure_scope:?} msg='{msg}'",
self.ip,
self.inner.id()
);
#[cfg(not(target_os = "linux"))]
log::warn!(
"{} failed: ip={} conn_id={} scope={:?} msg='{}'",
auth_context,
@@ -5569,15 +5491,6 @@ impl Connection<'_> {
}
}
fn should_wait_for_peer_close(&self, is_kcp: bool, manual_disconnect: bool) -> bool {
// The controller or relay may still be writing when an active session is disconnected.
let wait_for_manual_close = manual_disconnect
&& self.authorized
&& matches!(self.stream, Stream::Tcp(_) | Stream::WebSocket(_));
// Dropping WebRTC or KCP can discard a queued final message.
self.sent_final_message && (is_kcp || self.stream.is_webrtc() || wait_for_manual_close)
}
// The `reason` should be consistent with `check_if_retry` if not empty
async fn send_close_reason_no_retry(&mut self, reason: &str) {
let mut misc = Misc::new();
@@ -5588,10 +5501,7 @@ impl Connection<'_> {
}
let mut msg_out = Message::new();
msg_out.set_misc(misc);
match self.stream.send(&msg_out).await {
Ok(()) => self.sent_final_message = true,
Err(err) => log::debug!("Failed to send CloseReason: {err}"),
}
self.send(msg_out).await;
raii::AuthedConnID::check_remove_session(self.inner.id(), self.session_key());
}
@@ -7000,7 +6910,7 @@ impl Default for PortableState {
}
}
impl Drop for Connection<'_> {
impl Drop for Connection {
fn drop(&mut self) {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
self.release_pressed_modifiers();
@@ -7476,109 +7386,6 @@ mod test {
UNAUTHORIZED_CONNS.lock().unwrap().len()
}
#[tokio::test]
async fn tcp_upload_receives_manual_disconnect_reason() {
use hbb_common::{bytes::Bytes, futures::stream};
let reason = "Closed manually by the peer";
let block = fs::new_block(FileTransferBlock {
data: vec![0; 128 * 1024].into(),
..Default::default()
});
let upload_block = Bytes::from(block.write_to_bytes().unwrap());
// A queued close reason can beat the reset even without the wait. Exercise several connections.
for _ in 0..4 {
let (mut controlled, mut controller, _) = stalled_incoming().await;
let block = &block;
let host = async move {
controlled.next().await.unwrap().unwrap();
controlled.send(block).await.unwrap();
let close = misc_msg(|m| m.set_close_reason(reason.into()));
controlled.send(&close).await.unwrap();
wait_for_peer_close(&mut controlled, false).await;
};
let upload_block = upload_block.clone();
let client = async move {
let Stream::Tcp(tcp) = &mut controller else {
unreachable!("expected loopback TCP");
};
let (writer, mut reader) = (&mut tcp.0).split();
let upload = stream::repeat(upload_block).map(Ok).forward(writer);
let receive = async {
reader.next().await.unwrap().unwrap(); // File data queued ahead of CloseReason.
let frame = reader
.next()
.await
.expect("EOF before CloseReason")
.unwrap();
let message = Message::parse_from_bytes(&frame).unwrap();
assert_eq!(message.misc().close_reason(), reason);
};
tokio::select! {
result = upload => panic!("upload ended before CloseReason: {result:?}"),
() = receive => {}
}
};
timeout(5_000, async { tokio::join!(host, client) })
.await
.unwrap();
}
}
#[tokio::test]
async fn webrtc_controller_receives_manual_disconnect_reason() {
use hbb_common::webrtc::WebRTCStream;
let (mut controller, mut controlled) = timeout(30_000, async {
let offerer = WebRTCStream::new("", false, 20000).await.unwrap();
let offer = offerer.get_local_endpoint().await.unwrap();
let answerer = WebRTCStream::new(&offer, false, 20000).await.unwrap();
let answer = answerer.get_local_endpoint().await.unwrap();
offerer.set_remote_endpoint(&answer).await.unwrap();
(Stream::WebRTC(offerer), Stream::WebRTC(answerer))
})
.await
.expect("WebRTC setup timed out");
let reason = "Closed manually by the peer";
let message = misc_msg(|m| m.set_close_reason(reason.into()));
let ping = msg(|m| m.set_test_delay(TestDelay::new()));
controller.send(&ping).await.unwrap();
controlled.send(&message).await.unwrap();
let reader = tokio::spawn(async move {
time::sleep(Duration::from_millis(100)).await;
let frame = controller.next_timeout(3000).await.expect("close reason");
Message::parse_from_bytes(&frame.unwrap()).unwrap()
});
wait_for_peer_close(&mut controlled, false).await;
drop(controlled);
assert_eq!(reader.await.unwrap().misc().close_reason(), reason);
}
#[tokio::test]
async fn kcp_controller_receives_manual_disconnect_reason() {
let ((_controller_guard, mut controller), (controlled_guard, mut controlled)) =
crate::kcp_stream::tests::establish().await;
let reason = "Closed manually by the peer";
let sender = tokio::spawn(async move {
let message = misc_msg(|m| m.set_close_reason(reason.into()));
controlled.send(&message).await.unwrap();
wait_for_peer_close(&mut controlled, true).await;
drop(controlled);
drop(controlled_guard);
});
let frame = controller
.next_timeout(3000)
.await
.expect("close reason")
.unwrap();
let message = Message::parse_from_bytes(&frame).unwrap();
assert_eq!(message.misc().close_reason(), reason);
drop(controller);
sender.await.unwrap();
}
#[test]
fn test_ip_whitelist_entries_ignore_spaces_around_them() {
let entries = ip_whitelist_entries("192.168.1.0/24, 10.0.0.1 ");
@@ -7623,7 +7430,7 @@ mod test {
.await
.unwrap();
let host = listener.local_addr().unwrap().to_string();
let controller = hbb_common::socket_client::connect_tcp_local(host, None, 3000)
let controller = hbb_common::socket_client::connect_tcp(host, 3000)
.await
.unwrap();
let (accepted, addr) = listener.accept().await.unwrap();
-54
View File
@@ -1,54 +0,0 @@
use super::TerminalUserToken;
use hbb_common::ResultType;
pub(super) const LOG_INTERVAL: std::time::Duration = std::time::Duration::from_secs(60);
const DESKTOP_REQUIRED: &str = "Remote terminal access requires an active desktop session";
pub(super) async fn fill_token(token: &mut Option<TerminalUserToken>) -> Option<&'static str> {
apply_session_check(token, crate::platform::linux::terminal::is_allowed().await)
}
fn apply_session_check(
token: &mut Option<TerminalUserToken>,
result: ResultType<bool>,
) -> Option<&'static str> {
let error = match result {
Ok(true) => None,
Ok(false) => Some(DESKTOP_REQUIRED),
Err(err) => {
hbb_common::throttled_log!(
LOG_INTERVAL,
warn,
"Could not verify the root terminal session: {err:#}"
);
Some("Failed to get user token.")
}
};
*token = error.is_none().then_some(TerminalUserToken::SelfUser);
error
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn only_an_allowed_session_gets_a_token() {
let mut token = None;
assert_eq!(apply_session_check(&mut token, Ok(true)), None);
assert!(matches!(token, Some(TerminalUserToken::SelfUser)));
assert_eq!(
apply_session_check(&mut token, Ok(false)),
Some(DESKTOP_REQUIRED)
);
assert!(token.is_none());
let mut token = Some(TerminalUserToken::SelfUser);
let fault = Err(hbb_common::anyhow::anyhow!("logind unavailable"));
assert_eq!(
apply_session_check(&mut token, fault),
Some("Failed to get user token.")
);
assert!(token.is_none());
}
}
+4 -4
View File
@@ -6,7 +6,7 @@ use crate::trusted_devices::{
};
use base::message_proto::LoginResponse;
impl Connection<'_> {
impl Connection {
pub(super) async fn begin_trusted_device(&mut self) -> bool {
if self.conn_audit_primary_auth != ConnAuditPrimaryAuth::PermanentPassword
|| (!self.stream.is_secured() && !crate::common::is_direct_ip_access(&self.lr.username))
@@ -36,7 +36,7 @@ impl Connection<'_> {
}
Ok(None) => true,
Err(error) => {
self.send_login_error_before_close(error).await;
self.send_login_error(error).await;
false
}
}
@@ -54,7 +54,7 @@ impl Connection<'_> {
return true;
}
self.trusted_device = None;
self.send_login_error_before_close(error).await;
self.send_login_error(error).await;
self.on_close("Trusted-device authentication failed", false)
.await;
return false;
@@ -91,7 +91,7 @@ impl Connection<'_> {
host::log_unavailable(&error);
return true;
}
self.send_login_error_before_close(error).await;
self.send_login_error(error).await;
self.on_close("Trusted-device enrollment failed", false)
.await;
false
+1 -1
View File
@@ -1,5 +1,5 @@
use super::*;
use hbb_common::anyhow;
use hbb_common::{allow_err, anyhow};
use base::platform::linux::DISTRO;
use scrap::{
is_cursor_embedded, set_map_err,