mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-07-18 05:45:05 +03:00
Compare commits
11 Commits
revert-155
...
switch_cod
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af096f800d | ||
|
|
96e2a330b8 | ||
|
|
5abf4e9724 | ||
|
|
cf2b28faf9 | ||
|
|
bdb38c4730 | ||
|
|
fa418cace6 | ||
|
|
94a2a2bb4a | ||
|
|
865fe71c46 | ||
|
|
137298e05a | ||
|
|
685a89a171 | ||
|
|
12b5cc7f72 |
13
.github/workflows/flutter-build.yml
vendored
13
.github/workflows/flutter-build.yml
vendored
@@ -49,7 +49,6 @@ env:
|
||||
#signing keys env variable checks
|
||||
ANDROID_SIGNING_KEY: "${{ secrets.ANDROID_SIGNING_KEY }}"
|
||||
MACOS_P12_BASE64: "${{ secrets.MACOS_P12_BASE64 }}"
|
||||
MACOS_NOTARIZE_JSON: "${{ secrets.MACOS_NOTARIZE_JSON }}"
|
||||
UPLOAD_ARTIFACT: "${{ inputs.upload-artifact }}"
|
||||
SIGN_BASE_URL: "${{ secrets.SIGN_BASE_URL }}-2"
|
||||
|
||||
@@ -694,20 +693,12 @@ jobs:
|
||||
|
||||
- name: Check sign and import sign key
|
||||
if: env.MACOS_P12_BASE64 != null
|
||||
env:
|
||||
MACOS_CODESIGN_IDENTITY: ${{ secrets.MACOS_CODESIGN_IDENTITY }}
|
||||
shell: bash
|
||||
run: |
|
||||
security default-keychain -s rustdesk.keychain
|
||||
security find-identity -v
|
||||
if ! [[ "$MACOS_CODESIGN_IDENTITY" =~ ^[A-Za-z0-9]+$ ]]; then
|
||||
# Ensure no whitespaces or special characters
|
||||
echo 'FATAL: Invalid `secrets.MACOS_CODESIGN_IDENTITY` given. If signing key is stored on your Mac, you can run `security find-identity -v -p codesigning` to find out hex format of your identity.' >&2
|
||||
exit 128
|
||||
fi
|
||||
|
||||
- name: Import notarize key
|
||||
if: env.MACOS_P12_BASE64 != null && env.MACOS_NOTARIZE_JSON != null
|
||||
if: env.MACOS_P12_BASE64 != null
|
||||
uses: timheuer/base64-to-file@adaa40c0c581f276132199d4cf60afa07ce60eac # v1.2
|
||||
with:
|
||||
# https://gregoryszorc.com/docs/apple-codesign/stable/apple_codesign_rcodesign.html#notarizing-and-stapling
|
||||
@@ -855,10 +846,8 @@ jobs:
|
||||
codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict ./flutter/build/macos/Build/Products/Release/RustDesk.app -vvv
|
||||
create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app
|
||||
codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict rustdesk-${{ env.VERSION }}.dmg -vvv
|
||||
if [ "$MACOS_NOTARIZE_JSON" != "" ]; then
|
||||
# notarize the rustdesk-${{ env.VERSION }}.dmg
|
||||
rcodesign notary-submit --api-key-path ${{ github.workspace }}/rustdesk.json --staple rustdesk-${{ env.VERSION }}.dmg
|
||||
fi
|
||||
|
||||
- name: Rename rustdesk
|
||||
if: env.UPLOAD_ARTIFACT == 'true'
|
||||
|
||||
32
Cargo.lock
generated
32
Cargo.lock
generated
@@ -771,6 +771,26 @@ dependencies = [
|
||||
"syn 2.0.98",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.72.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"cexpr",
|
||||
"clang-sys",
|
||||
"itertools 0.12.1",
|
||||
"log",
|
||||
"prettyplease",
|
||||
"proc-macro2 1.0.93",
|
||||
"quote 1.0.36",
|
||||
"regex",
|
||||
"rustc-hash 2.1.1",
|
||||
"shlex",
|
||||
"syn 2.0.98",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bit_field"
|
||||
version = "0.10.2"
|
||||
@@ -2329,7 +2349,7 @@ version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
|
||||
dependencies = [
|
||||
"libloading 0.7.4",
|
||||
"libloading 0.8.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2694,7 +2714,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.60.2",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4494,7 +4514,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"windows-targets 0.48.5",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7434,7 +7454,7 @@ dependencies = [
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys 0.11.0",
|
||||
"windows-sys 0.60.2",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7491,7 +7511,7 @@ dependencies = [
|
||||
"security-framework 3.5.1",
|
||||
"security-framework-sys",
|
||||
"webpki-root-certs",
|
||||
"windows-sys 0.60.2",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7578,7 +7598,7 @@ name = "scrap"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"android_logger",
|
||||
"bindgen 0.65.1",
|
||||
"bindgen 0.72.1",
|
||||
"block",
|
||||
"cfg-if 1.0.0",
|
||||
"dbus",
|
||||
|
||||
@@ -495,14 +495,14 @@ class _CmHeaderState extends State<_CmHeader>
|
||||
if (client.type_() == ClientType.file)
|
||||
FittedBox(
|
||||
child: Text(
|
||||
translate("File Transfer"),
|
||||
translate("Transfer file"),
|
||||
style: TextStyle(color: Colors.white70, fontSize: 12),
|
||||
),
|
||||
),
|
||||
if (client.type_() == ClientType.camera)
|
||||
FittedBox(
|
||||
child: Text(
|
||||
translate("View Camera"),
|
||||
translate("View camera"),
|
||||
style: TextStyle(color: Colors.white70, fontSize: 12),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
typedef char** (*FUNC_RUSTDESK_CORE_MAIN)(int*);
|
||||
typedef void (*FUNC_RUSTDESK_FREE_ARGS)( char**, int);
|
||||
typedef int (*FUNC_RUSTDESK_GET_APP_NAME)(wchar_t*, int);
|
||||
typedef int (*FUNC_RUSTDESK_IS_DISABLE_INSTALLATION)();
|
||||
/// Note: `--server`, `--service` are already handled in [core_main.rs].
|
||||
const std::vector<std::string> parameters_white_list = {"--install", "--cm"};
|
||||
|
||||
@@ -62,6 +63,22 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
|
||||
}
|
||||
std::vector<std::string> rust_args(c_args, c_args + args_len);
|
||||
free_c_args(c_args, args_len);
|
||||
FUNC_RUSTDESK_IS_DISABLE_INSTALLATION rustdesk_is_disable_installation =
|
||||
(FUNC_RUSTDESK_IS_DISABLE_INSTALLATION)GetProcAddress(hInstance, "rustdesk_is_disable_installation");
|
||||
bool is_disable_installation =
|
||||
rustdesk_is_disable_installation && rustdesk_is_disable_installation() != 0;
|
||||
const auto installParam = std::string("--install");
|
||||
// Flutter reads the original process command line, not only rust_args, so
|
||||
// remove the `--install` injected by the portable wrapper here as well. This
|
||||
// also lets `no-install.exe` continue as a portable app when installation is
|
||||
// disabled. See: https://github.com/rustdesk/rustdesk-server-pro/issues/991#issuecomment-4978376890
|
||||
if (is_disable_installation) {
|
||||
command_line_arguments.erase(
|
||||
std::remove(command_line_arguments.begin(),
|
||||
command_line_arguments.end(),
|
||||
installParam),
|
||||
command_line_arguments.end());
|
||||
}
|
||||
|
||||
std::wstring app_name = L"RustDesk";
|
||||
FUNC_RUSTDESK_GET_APP_NAME get_rustdesk_app_name = (FUNC_RUSTDESK_GET_APP_NAME)GetProcAddress(hInstance, "get_rustdesk_app_name");
|
||||
@@ -118,7 +135,6 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
|
||||
is_cm_page = true;
|
||||
}
|
||||
bool is_install_page = false;
|
||||
auto installParam = std::string("--install");
|
||||
if (!command_line_arguments.empty() && command_line_arguments.front().compare(0, installParam.size(), installParam.c_str()) == 0) {
|
||||
is_install_page = true;
|
||||
}
|
||||
|
||||
Submodule libs/hbb_common updated: 7e1c392c62...5438d20225
@@ -48,7 +48,7 @@ quest = "0.3"
|
||||
|
||||
[build-dependencies]
|
||||
target_build_utils = "0.3"
|
||||
bindgen = "0.65"
|
||||
bindgen = "0.72.1"
|
||||
pkg-config = { version = "0.3.27", optional = true }
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
|
||||
@@ -426,8 +426,8 @@ impl Client {
|
||||
NatType::from_i32(my_nat_type).unwrap_or(NatType::UNKNOWN_NAT)
|
||||
};
|
||||
|
||||
if !key.is_empty() && !token.is_empty() {
|
||||
// mainly for the security of token
|
||||
let switch_code = interface.get_switch_code();
|
||||
if !key.is_empty() && (!token.is_empty() || !switch_code.is_empty()) {
|
||||
secure_tcp(&mut socket, &key)
|
||||
.await
|
||||
.map_err(|e| anyhow!("Failed to secure tcp: {}", e))?;
|
||||
@@ -469,6 +469,7 @@ impl Client {
|
||||
udp_port: udp_nat_port as _,
|
||||
force_relay: interface.is_force_relay(),
|
||||
socket_addr_v6: ipv6.1.unwrap_or_default(),
|
||||
switch_code,
|
||||
..Default::default()
|
||||
});
|
||||
for i in 1..=3 {
|
||||
@@ -716,6 +717,7 @@ impl Client {
|
||||
let mut direct = !conn.is_err();
|
||||
if interface.is_force_relay() || conn.is_err() {
|
||||
if !relay_server.is_empty() {
|
||||
let switch_code = interface.get_switch_code();
|
||||
conn = Self::request_relay(
|
||||
peer_id,
|
||||
relay_server.to_owned(),
|
||||
@@ -724,6 +726,7 @@ impl Client {
|
||||
key,
|
||||
token,
|
||||
conn_type,
|
||||
&switch_code,
|
||||
)
|
||||
.await;
|
||||
if let Err(e) = conn {
|
||||
@@ -844,6 +847,7 @@ impl Client {
|
||||
key: &str,
|
||||
token: &str,
|
||||
conn_type: ConnType,
|
||||
switch_code: &str,
|
||||
) -> ResultType<Stream> {
|
||||
let mut succeed = false;
|
||||
let mut uuid = "".to_owned();
|
||||
@@ -855,8 +859,7 @@ impl Client {
|
||||
.await
|
||||
.with_context(|| "Failed to connect to rendezvous server")?;
|
||||
|
||||
if !key.is_empty() && !token.is_empty() {
|
||||
// mainly for the security of token
|
||||
if !key.is_empty() && (!token.is_empty() || !switch_code.is_empty()) {
|
||||
secure_tcp(&mut socket, key).await?;
|
||||
}
|
||||
|
||||
@@ -877,6 +880,7 @@ impl Client {
|
||||
uuid: uuid.clone(),
|
||||
relay_server: relay_server.clone(),
|
||||
secure,
|
||||
switch_code: switch_code.to_owned(),
|
||||
..Default::default()
|
||||
});
|
||||
socket.send(&msg_out).await?;
|
||||
@@ -3736,6 +3740,16 @@ pub trait Interface: Send + Clone + 'static + Sized {
|
||||
self.get_lch().read().unwrap().force_relay
|
||||
}
|
||||
|
||||
fn get_switch_code(&self) -> String {
|
||||
match self.get_lch().read().unwrap().switch_uuid.clone() {
|
||||
Some(u) if !u.is_empty() => {
|
||||
use hbb_common::sodiumoxide::crypto::hash::sha256;
|
||||
crate::encode64(sha256::hash(u.as_bytes()).0)
|
||||
}
|
||||
_ => String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
fn swap_modifier_mouse(&self, _msg: &mut hbb_common::protos::message::MouseEvent) {}
|
||||
|
||||
fn update_direct(&self, direct: Option<bool>) {
|
||||
|
||||
@@ -1024,7 +1024,7 @@ pub fn get_full_name() -> String {
|
||||
}
|
||||
|
||||
pub fn is_setup(name: &str) -> bool {
|
||||
name.to_lowercase().ends_with("install.exe")
|
||||
!config::is_disable_installation() && name.to_lowercase().ends_with("install.exe")
|
||||
}
|
||||
|
||||
pub fn get_custom_rendezvous_server(custom: String) -> String {
|
||||
@@ -2623,6 +2623,20 @@ pub fn is_direct_ip_access(peer: &str) -> bool {
|
||||
hbb_common::is_ip_str(peer) || hbb_common::is_domain_port_str(peer)
|
||||
}
|
||||
|
||||
// Align the maximum length of the peer id to the maximum length of the peer id in the server.
|
||||
const MAX_UNTRUSTED_PEER_ID_LEN: usize = 253;
|
||||
const UNTRUSTED_PEER_ID_FORBIDDEN_CHARS: &[char] = &['"', '<', '>', '/', '\\', '|', '?', '*'];
|
||||
|
||||
// Shared validation for peer/connect ids that cross untrusted boundaries before
|
||||
// they are stored or written into command/script contexts.
|
||||
pub fn is_valid_untrusted_peer_id(id: &str) -> bool {
|
||||
!id.is_empty()
|
||||
&& id.len() <= MAX_UNTRUSTED_PEER_ID_LEN
|
||||
&& !id.chars().any(|ch| {
|
||||
ch.is_control() || ch.is_whitespace() || UNTRUSTED_PEER_ID_FORBIDDEN_CHARS.contains(&ch)
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -2653,6 +2667,29 @@ mod tests {
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn untrusted_peer_id_validation() {
|
||||
let cases = [
|
||||
("123456789", true),
|
||||
("m\u{00FC}nchen-pc", true),
|
||||
("192.168.1.10:21118", true),
|
||||
("9123456234@public", true),
|
||||
(
|
||||
r#"1" & oWS.Run("cmd.exe /k whoami /priv",1,False) & ""#,
|
||||
false,
|
||||
),
|
||||
("", false),
|
||||
("peer id", false),
|
||||
("peer\nid", false),
|
||||
("peer/id", false),
|
||||
("peer?id", false),
|
||||
];
|
||||
|
||||
for (id, expected) in cases {
|
||||
assert_eq!(is_valid_untrusted_peer_id(id), expected, "{id:?}");
|
||||
}
|
||||
}
|
||||
|
||||
// ThrottledInterval tick at the same time as tokio interval, if no sleeps
|
||||
#[allow(non_snake_case)]
|
||||
#[tokio::test]
|
||||
|
||||
@@ -127,6 +127,13 @@ pub fn core_main() -> Option<Vec<String>> {
|
||||
if args.contains(&"--noinstall".to_string()) {
|
||||
args.clear();
|
||||
}
|
||||
// The portable wrapper injects `--install` when its name ends with `install.exe`,
|
||||
// including `no-install.exe`. Drop the argument instead of exiting so disabled
|
||||
// clients can continue running as portable applications.
|
||||
if config::is_disable_installation() {
|
||||
args.retain(|arg| arg != "--install");
|
||||
flutter_args.retain(|arg| arg != "--install");
|
||||
}
|
||||
if args.len() > 0 {
|
||||
if args[0] == "--version" {
|
||||
println!("{}", crate::VERSION);
|
||||
|
||||
@@ -136,6 +136,12 @@ pub extern "C" fn rustdesk_core_main_args(args_len: *mut c_int) -> *mut *mut c_c
|
||||
return std::ptr::null_mut() as _;
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn rustdesk_is_disable_installation() -> c_int {
|
||||
hbb_common::config::is_disable_installation() as c_int
|
||||
}
|
||||
|
||||
// https://gist.github.com/iskakaushik/1c5b8aa75c77479c33c4320913eebef6
|
||||
#[cfg(windows)]
|
||||
fn rust_args_to_c_args(args: Vec<String>, outlen: *mut c_int) -> *mut *mut c_char {
|
||||
|
||||
@@ -308,3 +308,44 @@ fn handle_config_options(config_options: HashMap<String, String>) {
|
||||
pub fn is_pro() -> bool {
|
||||
PRO.lock().unwrap().clone()
|
||||
}
|
||||
|
||||
#[cfg(feature = "flutter")]
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
pub fn register_switch_grant(switch_uuid: String) {
|
||||
tokio::spawn(async move {
|
||||
let api_server = crate::ui_interface::get_api_server();
|
||||
if api_server.is_empty() {
|
||||
return;
|
||||
}
|
||||
use hbb_common::sodiumoxide::crypto::{hash::sha256, sign};
|
||||
let switch_code = crate::encode64(sha256::hash(switch_uuid.as_bytes()).0);
|
||||
let id = Config::get_id();
|
||||
let kp = Config::get_key_pair();
|
||||
let Some(sk) = sign::SecretKey::from_slice(&kp.0) else {
|
||||
log::warn!("Failed to register switch grant: no device key");
|
||||
return;
|
||||
};
|
||||
let signed = sign::sign(&switch_grant_signed_msg(&id, &switch_code), &sk);
|
||||
let body = json!({
|
||||
"id": id,
|
||||
"switch_code": switch_code,
|
||||
"signature": crate::encode64(signed),
|
||||
})
|
||||
.to_string();
|
||||
let url = format!("{}/api/switch-grant", api_server);
|
||||
if let Err(e) = crate::post_request(url, body, "").await {
|
||||
log::warn!("Failed to register switch grant: {}", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(feature = "flutter")]
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
fn switch_grant_signed_msg(id: &str, switch_code: &str) -> Vec<u8> {
|
||||
let mut msg = Vec::with_capacity(13 + id.len() + 1 + switch_code.len());
|
||||
msg.extend_from_slice(b"switch-grant\0");
|
||||
msg.extend_from_slice(id.as_bytes());
|
||||
msg.push(0);
|
||||
msg.extend_from_slice(switch_code.as_bytes());
|
||||
msg
|
||||
}
|
||||
|
||||
@@ -968,6 +968,7 @@ async fn handle(data: Data, stream: &mut Connection) {
|
||||
Data::SwitchSidesRequest(id) => {
|
||||
let uuid = uuid::Uuid::new_v4();
|
||||
crate::server::insert_switch_sides_uuid(id, uuid.clone());
|
||||
crate::hbbs_http::sync::register_switch_grant(uuid.to_string());
|
||||
allow_err!(
|
||||
stream
|
||||
.send(&Data::SwitchSidesRequest(uuid.to_string()))
|
||||
|
||||
@@ -241,6 +241,14 @@ fn wait_response(
|
||||
Some(rendezvous_message::Union::PeerDiscovery(p)) => {
|
||||
last_recv_time = Instant::now();
|
||||
if p.cmd == "pong" {
|
||||
if !crate::common::is_valid_untrusted_peer_id(&p.id) {
|
||||
log::warn!(
|
||||
"Ignoring LAN discovery response from {} with invalid peer id",
|
||||
addr
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
let local_mac = if try_get_ip_by_peer {
|
||||
if let Some(self_addr) = get_ipaddr_by_peer(&addr) {
|
||||
get_mac(&self_addr)
|
||||
|
||||
@@ -112,7 +112,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Waiting", "Aguardando"),
|
||||
("Finished", "Concluído"),
|
||||
("Speed", "Velocidade"),
|
||||
("Custom Image Quality", "Qualidade Visual Personalizada"),
|
||||
("Custom Image Quality", "Qualidade de imagem personalizada"),
|
||||
("Privacy mode", "Modo privado"),
|
||||
("Block user input", "Bloquear entrada do usuário"),
|
||||
("Unblock user input", "Desbloquear entrada do usuário"),
|
||||
@@ -122,15 +122,15 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Stretch", "Aumentar"),
|
||||
("Scrollbar", "Barra de rolagem"),
|
||||
("ScrollAuto", "Rolagem automática"),
|
||||
("Good image quality", "Boa qualidade de imagem"),
|
||||
("Good image quality", "Melhor qualidade"),
|
||||
("Balanced", "Balanceada"),
|
||||
("Optimize reaction time", "Otimizar tempo de resposta"),
|
||||
("Custom", "Personalizado"),
|
||||
("Custom", "Personalizada"),
|
||||
("Show remote cursor", "Mostrar cursor remoto"),
|
||||
("Show quality monitor", "Exibir monitor de qualidade"),
|
||||
("Disable clipboard", "Desabilitar área de transferência"),
|
||||
("Lock after session end", "Bloquear após o fim da sessão"),
|
||||
("Insert Ctrl + Alt + Del", "Enviar Ctrl + Alt + Del"),
|
||||
("Insert Ctrl + Alt + Del", "Enviar Ctrl+Alt+Del"),
|
||||
("Insert Lock", "Bloquear computador"),
|
||||
("Refresh", "Atualizar"),
|
||||
("ID does not exist", "ID não existe"),
|
||||
@@ -332,7 +332,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Relay Connection", "Conexão via Relay"),
|
||||
("Secure Connection", "Conexão Segura"),
|
||||
("Insecure Connection", "Conexão Insegura"),
|
||||
("Continue", ""),
|
||||
("Continue", "Continuar"),
|
||||
("Scale original", "Escala original"),
|
||||
("Scale adaptive", "Escala adaptada"),
|
||||
("General", "Geral"),
|
||||
|
||||
@@ -2278,6 +2278,10 @@ fn get_shortcut_icon_location(install_dir: &str, exe: &str) -> String {
|
||||
}
|
||||
|
||||
pub fn create_shortcut(id: &str) -> ResultType<()> {
|
||||
if !crate::common::is_valid_untrusted_peer_id(id) {
|
||||
bail!("Invalid peer id for shortcut");
|
||||
}
|
||||
|
||||
let exe = std::env::current_exe()?.to_str().unwrap_or("").to_owned();
|
||||
// https://github.com/rustdesk/rustdesk/issues/13735
|
||||
// Replace ':' with '_' for filename since ':' is not allowed in Windows filenames
|
||||
|
||||
@@ -2807,7 +2807,6 @@ impl Connection {
|
||||
#[cfg(feature = "flutter")]
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
if let Some(lr) = _s.lr.clone().take() {
|
||||
self.handle_login_request_without_validation(&lr).await;
|
||||
SWITCH_SIDES_UUID
|
||||
.lock()
|
||||
.unwrap()
|
||||
@@ -2816,6 +2815,15 @@ impl Connection {
|
||||
if let Ok(uuid) = uuid::Uuid::from_slice(_s.uuid.to_vec().as_ref()) {
|
||||
if let Some((_instant, uuid_old)) = uuid_old {
|
||||
if uuid == uuid_old {
|
||||
if lr.union.is_some() {
|
||||
log::warn!(
|
||||
"Rejected switch sides response for non-remote-desktop session; closing connection"
|
||||
);
|
||||
self.send_login_error("Connection not allowed").await;
|
||||
return false;
|
||||
}
|
||||
self.reset_session_scope_for_login();
|
||||
self.handle_login_request_without_validation(&lr).await;
|
||||
self.from_switch = true;
|
||||
self.set_conn_audit_primary_auth(ConnAuditPrimaryAuth::SwitchSides);
|
||||
if !self.send_logon_response_and_keep_alive().await {
|
||||
@@ -5656,6 +5664,7 @@ impl Connection {
|
||||
Some(misc::Union::ChangeDisplayResolution(_)) => "misc.change_display_resolution",
|
||||
Some(misc::Union::MessageQuery(_)) => "misc.message_query",
|
||||
Some(misc::Union::FollowCurrentDisplay(_)) => "misc.follow_current_display",
|
||||
Some(misc::Union::SwitchSidesRequest(_)) => "misc.switch_sides_request",
|
||||
Some(_) => "misc.other",
|
||||
None => "misc.empty",
|
||||
}
|
||||
@@ -6773,6 +6782,10 @@ mod test {
|
||||
misc_msg(|m| m.set_capture_displays(CaptureDisplays::new())),
|
||||
Some("misc.capture_displays"),
|
||||
),
|
||||
(
|
||||
misc_msg(|m| m.set_switch_sides_request(SwitchSidesRequest::new())),
|
||||
Some("misc.switch_sides_request"),
|
||||
),
|
||||
(msg(|m| m.set_clipboard(Clipboard::new())), None),
|
||||
(
|
||||
msg(|m| m.set_multi_clipboards(MultiClipboards::new())),
|
||||
@@ -6817,6 +6830,10 @@ mod test {
|
||||
misc_msg(|m| m.set_toggle_privacy_mode(TogglePrivacyMode::new())),
|
||||
Some("misc.toggle_privacy_mode"),
|
||||
),
|
||||
(
|
||||
misc_msg(|m| m.set_switch_sides_request(SwitchSidesRequest::new())),
|
||||
Some("misc.switch_sides_request"),
|
||||
),
|
||||
(misc_msg(|m| m.set_chat_message(ChatMessage::new())), None),
|
||||
(msg(|m| m.set_clipboard(Clipboard::new())), None),
|
||||
(
|
||||
@@ -6902,6 +6919,10 @@ mod test {
|
||||
msg(|m| m.set_terminal_action(TerminalAction::new())),
|
||||
Some("terminal_action"),
|
||||
),
|
||||
(
|
||||
misc_msg(|m| m.set_switch_sides_request(SwitchSidesRequest::new())),
|
||||
Some("misc.switch_sides_request"),
|
||||
),
|
||||
],
|
||||
),
|
||||
(
|
||||
@@ -6912,6 +6933,10 @@ mod test {
|
||||
None,
|
||||
),
|
||||
(msg(|m| m.set_terminal_action(TerminalAction::new())), None),
|
||||
(
|
||||
misc_msg(|m| m.set_switch_sides_request(SwitchSidesRequest::new())),
|
||||
None,
|
||||
),
|
||||
],
|
||||
),
|
||||
(
|
||||
@@ -6931,6 +6956,10 @@ mod test {
|
||||
msg(|m| m.set_screenshot_request(ScreenshotRequest::new())),
|
||||
Some("screenshot_request"),
|
||||
),
|
||||
(
|
||||
misc_msg(|m| m.set_switch_sides_request(SwitchSidesRequest::new())),
|
||||
Some("misc.switch_sides_request"),
|
||||
),
|
||||
(misc_msg(|m| m.set_refresh_video(true)), None),
|
||||
(misc_msg(|m| m.set_refresh_video_display(0)), None),
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user