From 9d10cc77fcacb16d0910999ddaa39c94cd5faf72 Mon Sep 17 00:00:00 2001 From: Gilbert Chen Date: Wed, 8 Aug 2018 14:03:49 -0400 Subject: [PATCH] Do not update the Windows keyring file if the password remains unchanged --- src/duplicacy_keyring_windows.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/duplicacy_keyring_windows.go b/src/duplicacy_keyring_windows.go index a72f5b11..cba4c50e 100644 --- a/src/duplicacy_keyring_windows.go +++ b/src/duplicacy_keyring_windows.go @@ -136,6 +136,16 @@ func keyringSet(key string, value string) bool { if value == "" { keyring[key] = nil } else { + + // Check if the value to be set is the same as the existing one + existingEncryptedValue := keyring[key] + if len(existingEncryptedValue) > 0 { + existingValue, err := keyringDecrypt(existingEncryptedValue) + if err == nil && string(existingValue) == value { + return true + } + } + encryptedValue, err := keyringEncrypt([]byte(value)) if err != nil { LOG_DEBUG("KEYRING_ENCRYPT", "Failed to encrypt the value: %v", err)