Skip to content

Commit

Permalink
Do not update the Windows keyring file if the password remains unchanged
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbertchen committed Aug 8, 2018
1 parent e8b8922 commit 9d10cc7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/duplicacy_keyring_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9d10cc7

Please sign in to comment.