mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-06 00:41:29 +03:00
password: ensure encrypt only once
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
@@ -218,7 +218,8 @@ impl Config2 {
|
||||
fn load() -> Config2 {
|
||||
let mut config = Config::load_::<Config2>("2");
|
||||
if let Some(mut socks) = config.socks {
|
||||
let (password, store) = decrypt_str_or_original(&socks.password, PASSWORD_ENC_VERSION);
|
||||
let (password, _, store) =
|
||||
decrypt_str_or_original(&socks.password, PASSWORD_ENC_VERSION);
|
||||
socks.password = password;
|
||||
config.socks = Some(socks);
|
||||
if store {
|
||||
@@ -298,7 +299,7 @@ impl Config {
|
||||
|
||||
fn load() -> Config {
|
||||
let mut config = Config::load_::<Config>("");
|
||||
let (password, store) = decrypt_str_or_original(&config.password, PASSWORD_ENC_VERSION);
|
||||
let (password, _, store) = decrypt_str_or_original(&config.password, PASSWORD_ENC_VERSION);
|
||||
config.password = password;
|
||||
if store {
|
||||
config.store();
|
||||
@@ -754,17 +755,17 @@ impl PeerConfig {
|
||||
Ok(config) => {
|
||||
let mut config: PeerConfig = config;
|
||||
let mut store = false;
|
||||
let (password, store2) =
|
||||
let (password, _, store2) =
|
||||
decrypt_vec_or_original(&config.password, PASSWORD_ENC_VERSION);
|
||||
config.password = password;
|
||||
store = store || store2;
|
||||
config.options.get_mut("rdp_password").map(|v| {
|
||||
let (password, store2) = decrypt_str_or_original(v, PASSWORD_ENC_VERSION);
|
||||
let (password, _, store2) = decrypt_str_or_original(v, PASSWORD_ENC_VERSION);
|
||||
*v = password;
|
||||
store = store || store2;
|
||||
});
|
||||
config.options.get_mut("os-password").map(|v| {
|
||||
let (password, store2) = decrypt_str_or_original(v, PASSWORD_ENC_VERSION);
|
||||
let (password, _, store2) = decrypt_str_or_original(v, PASSWORD_ENC_VERSION);
|
||||
*v = password;
|
||||
store = store || store2;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user