Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

fix(deploy): don't wipe local id when --deploy gets an empty --id (#15633)

CHarris20ab5ab0ad78
diff --git a/src/core_main.rs b/src/core_main.rs
index 3f2f0d246..b20ecd92b 100644
--- a/src/core_main.rs
+++ b/src/core_main.rs
@@ -667,7 +667,8 @@ pub fn core_main() -> Option<Vec<String>> {
None
}
};
- let new_id = get_value("--id");
+ // An empty --id (e.g. an unset var) would deploy a blank id; the Android flow guards this too (#15146).
+ let new_id = get_value("--id").filter(|s| !s.is_empty());
match crate::ui_interface::deploy_device(token, new_id) {
crate::ui_interface::DeployResult::Ok => {
println!("Device deployed.");
diff --git a/src/ipc.rs b/src/ipc.rs
index 01f4cda6e..e4b92be5f 100644
--- a/src/ipc.rs
+++ b/src/ipc.rs
@@ -881,8 +881,14 @@ async fn handle(data: Data, stream: &mut Connection) {
Some(value) => {
let mut updated = true;
if name == "id" {
- Config::set_key_confirmed(false);
- Config::set_id(&value);
+ // An empty id would wipe the local id and unconfirm the key (cf. #15626).
+ if value.is_empty() {
+ log::warn!("Ignoring empty id write over IPC");
+ updated = false;
+ } else {
+ Config::set_key_confirmed(false);
+ Config::set_id(&value);
+ }
} else if name == "temporary-password" {
password::update_temporary_password();
} else if name == "permanent-password" {