fix: correctly handle failure to unlock single key

This commit is contained in:
James Houlahan 2020-06-24 12:31:32 +02:00
parent ec224a962f
commit 7ec4309ae1
3 changed files with 11 additions and 7 deletions

View File

@ -8,7 +8,7 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
* GODT-360 Detect charset embedded in html/xml.
### Changed
* GODT-354 Do not label/unlabel messsages from `All Mail` folder
* GODT-354 Do not label/unlabel messsages from `All Mail` folder.
* GODT-388 Support for both bridge and import/export credentials by package users.
* GODT-387 Store factory to make store optional.
* GODT-386 Renamed bridge to general users and keep bridge only for bridge stuff.
@ -19,6 +19,9 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
* `Unlock()` call on pmapi-client unlocks both User keys and Address keys.
* Salt is available via `AuthSalt()` method.
* GODT-394 Don't check SMTP message send time in integration tests.
* GODT-280 Migrate to gopenpgp v2.
* `Unlock()` call on pmapi-client unlocks both User keys and Address keys.
* Salt is available via `AuthSalt()` method.
### Fixed
* GODT-356 Fix crash when removing account while mail client is fetching messages (regression from GODT-204).
@ -35,6 +38,7 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
* GODT-404 Don't keep connections to proxy servers alive if user disables DoH.
* Ensure DoH is used at startup to load users for the initial auth.
* Issue causing deadlock when reloading users keys due to double-locking of a mutex.
* Correctly handle failure to unlock single key.
## [v1.2.7] Donghai-hotfix - beta (2020-05-07)

1
go.sum
View File

@ -188,6 +188,7 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20191216052735-49a3e744a425 h1:VvQyQJN0tSuecqgcIxMWnnfG5kSmgy9KZR9sW3W5QeA=
golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=

View File

@ -142,15 +142,14 @@ func (keys *PMKeys) UnlockAll(passphrase []byte, userKey *crypto.KeyRing) (kr *c
return
}
var k *crypto.Key
if k, err = key.unlock(secret); err != nil {
logrus.WithError(err).Warn("Failed to unlock key")
k, unlockErr := key.unlock(secret)
if unlockErr != nil {
logrus.WithError(unlockErr).WithField("fingerprint", key.Fingerprint).Warn("Failed to unlock key")
continue
}
if err = kr.AddKey(k); err != nil {
logrus.WithError(err).Warn("Failed to add key to keyring")
if addKeyErr := kr.AddKey(k); addKeyErr != nil {
logrus.WithError(addKeyErr).Warn("Failed to add key to keyring")
continue
}
}