1
0
mirror of https://github.com/gilbertchen/duplicacy synced 2025-12-06 00:03:38 +00:00

Do not update the Windows keyring file if the password remains unchanged

This commit is contained in:
Gilbert Chen
2018-08-08 14:03:49 -04:00
parent e8b8922754
commit 9d10cc77fc

View File

@@ -136,6 +136,16 @@ func keyringSet(key string, value string) bool {
if value == "" { if value == "" {
keyring[key] = nil keyring[key] = nil
} else { } 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)) encryptedValue, err := keyringEncrypt([]byte(value))
if err != nil { if err != nil {
LOG_DEBUG("KEYRING_ENCRYPT", "Failed to encrypt the value: %v", err) LOG_DEBUG("KEYRING_ENCRYPT", "Failed to encrypt the value: %v", err)