chore: add detailed logging for RustDesk password propagation
This commit is contained in:
parent
aa0d861778
commit
c1d8181abf
1 changed files with 27 additions and 0 deletions
|
|
@ -467,6 +467,11 @@ fn ensure_password_files(secret: &str) -> Result<(), String> {
|
||||||
let password_path = dir.join("RustDesk.toml");
|
let password_path = dir.join("RustDesk.toml");
|
||||||
if let Err(error) = write_toml_kv(&password_path, "password", secret) {
|
if let Err(error) = write_toml_kv(&password_path, "password", secret) {
|
||||||
errors.push(format!("{} -> {}", password_path.display(), error));
|
errors.push(format!("{} -> {}", password_path.display(), error));
|
||||||
|
} else {
|
||||||
|
log_event(&format!(
|
||||||
|
"Senha escrita via fallback em {}",
|
||||||
|
password_path.display()
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
let local_path = dir.join("RustDesk_local.toml");
|
let local_path = dir.join("RustDesk_local.toml");
|
||||||
|
|
@ -475,6 +480,11 @@ fn ensure_password_files(secret: &str) -> Result<(), String> {
|
||||||
"Falha ao ajustar verification-method em {}: {error}",
|
"Falha ao ajustar verification-method em {}: {error}",
|
||||||
local_path.display()
|
local_path.display()
|
||||||
));
|
));
|
||||||
|
} else {
|
||||||
|
log_event(&format!(
|
||||||
|
"verification-method atualizado para use-both-passwords em {}",
|
||||||
|
local_path.display()
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -487,12 +497,21 @@ fn ensure_password_files(secret: &str) -> Result<(), String> {
|
||||||
|
|
||||||
fn propagate_password_profile() -> io::Result<bool> {
|
fn propagate_password_profile() -> io::Result<bool> {
|
||||||
let Some(src_dir) = user_appdata_config_dir() else {
|
let Some(src_dir) = user_appdata_config_dir() else {
|
||||||
|
log_event("AppData do usuário não disponível para copiar RustDesk.toml (propagação ignorada)");
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
};
|
};
|
||||||
let src_path = src_dir.join("RustDesk.toml");
|
let src_path = src_dir.join("RustDesk.toml");
|
||||||
if !src_path.exists() {
|
if !src_path.exists() {
|
||||||
|
log_event(&format!(
|
||||||
|
"Arquivo {} não encontrado; usando fallback de escrita",
|
||||||
|
src_path.display()
|
||||||
|
));
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
|
log_event(&format!(
|
||||||
|
"Copiando {} para ProgramData/LocalService",
|
||||||
|
src_path.display()
|
||||||
|
));
|
||||||
let contents = fs::read(&src_path)?;
|
let contents = fs::read(&src_path)?;
|
||||||
for dest_root in [program_data_config_dir(), PathBuf::from(LOCAL_SERVICE_CONFIG)] {
|
for dest_root in [program_data_config_dir(), PathBuf::from(LOCAL_SERVICE_CONFIG)] {
|
||||||
let target_path = dest_root.join("RustDesk.toml");
|
let target_path = dest_root.join("RustDesk.toml");
|
||||||
|
|
@ -500,6 +519,10 @@ fn propagate_password_profile() -> io::Result<bool> {
|
||||||
fs::create_dir_all(parent)?;
|
fs::create_dir_all(parent)?;
|
||||||
}
|
}
|
||||||
fs::write(&target_path, &contents)?;
|
fs::write(&target_path, &contents)?;
|
||||||
|
log_event(&format!(
|
||||||
|
"RustDesk.toml propagado para {}",
|
||||||
|
target_path.display()
|
||||||
|
));
|
||||||
}
|
}
|
||||||
Ok(true)
|
Ok(true)
|
||||||
}
|
}
|
||||||
|
|
@ -528,6 +551,10 @@ fn replicate_password_artifacts() -> io::Result<()> {
|
||||||
|
|
||||||
let target_path = dest.join(name);
|
let target_path = dest.join(name);
|
||||||
fs::copy(&source_path, &target_path)?;
|
fs::copy(&source_path, &target_path)?;
|
||||||
|
log_event(&format!(
|
||||||
|
"Artefato de senha {name} replicado para {}",
|
||||||
|
target_path.display()
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue