1
0
Fork 0
mirror of https://github.com/Luzifer/envrun.git synced 2024-11-08 22:30:02 +00:00

Fix: Infinite loop on wrong password

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-06-01 18:28:55 +02:00
parent 76ace2d6bf
commit 93644bdbf9
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -40,7 +40,13 @@ func decryptGPGSymmetric(body []byte, passphrase string) ([]byte, error) {
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) {
if passwordRetry {
return nil, fmt.Errorf("Wrong passphrase supplied")
}
passwordRetry = true
return []byte(passphrase), nil
}, nil)
if err != nil {