fix(ipc): never adopt an empty id from the main IPC (#15626)

This commit is contained in:
CHarris
2026-07-19 22:22:46 -04:00
committed by GitHub
parent 5f015c9da1
commit c01300be20

View File

@@ -1689,7 +1689,12 @@ pub fn clear_trusted_devices() {
} }
pub fn get_id() -> String { pub fn get_id() -> String {
// An empty id may come from a process that took over the main IPC with a
// config scope that has no id yet (e.g. a user GUI that became the server
// while the installed service was restarting). Treat it as no answer,
// otherwise the empty id is adopted below and wipes the local one.
if let Ok(Some(v)) = get_config("id") { if let Ok(Some(v)) = get_config("id") {
if !v.is_empty() {
// update salt also, so that next time reinstallation not causing first-time auto-login failure // update salt also, so that next time reinstallation not causing first-time auto-login failure
if let Ok(Some(v2)) = get_config("salt") { if let Ok(Some(v2)) = get_config("salt") {
Config::set_salt(&v2); Config::set_salt(&v2);
@@ -1698,10 +1703,10 @@ pub fn get_id() -> String {
Config::set_key_confirmed(false); Config::set_key_confirmed(false);
Config::set_id(&v); Config::set_id(&v);
} }
v return v;
} else {
Config::get_id()
} }
}
Config::get_id()
} }
pub async fn get_rendezvous_server(ms_timeout: u64) -> (String, Vec<String>) { pub async fn get_rendezvous_server(ms_timeout: u64) -> (String, Vec<String>) {