mirror of
https://github.com/Luzifer/envrun.git
synced 2024-11-14 00:52:42 +00:00
Fix: Infinite loop on wrong password
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
76ace2d6bf
commit
93644bdbf9
1 changed files with 6 additions and 0 deletions
|
@ -40,7 +40,13 @@ func decryptGPGSymmetric(body []byte, passphrase string) ([]byte, error) {
|
||||||
return nil, fmt.Errorf("Unable to read armor: %s", err)
|
return nil, fmt.Errorf("Unable to read armor: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var passwordRetry bool
|
||||||
md, err := openpgp.ReadMessage(msgReader, nil, func(keys []openpgp.Key, symmetric bool) ([]byte, error) {
|
md, err := openpgp.ReadMessage(msgReader, nil, func(keys []openpgp.Key, symmetric bool) ([]byte, error) {
|
||||||
|
if passwordRetry {
|
||||||
|
return nil, fmt.Errorf("Wrong passphrase supplied")
|
||||||
|
}
|
||||||
|
|
||||||
|
passwordRetry = true
|
||||||
return []byte(passphrase), nil
|
return []byte(passphrase), nil
|
||||||
}, nil)
|
}, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue