mirror of
https://github.com/docker/docs.git
synced 2026-10-31 10:34:26 +03:00
Merge pull request #116 from dmcgowan/invalid-password
Return invalid password when cannot retrieve passphrase
This commit is contained in:
@@ -94,11 +94,7 @@ func (ccs *CryptoService) Sign(keyIDs []string, payload []byte) ([]data.Signatur
|
||||
|
||||
privKey, _, err = ccs.keyStore.GetKey(keyName)
|
||||
if err != nil {
|
||||
// Note that GetKey always fails on InitRepo.
|
||||
// InitRepo gets a signer that doesn't have access to
|
||||
// the root keys. Continuing here is safe because we
|
||||
// end up not returning any signatures.
|
||||
logrus.Debugf("ignoring error attempting to retrieve key ID: %s, %v", keyid, err)
|
||||
logrus.Debugf("error attempting to retrieve key ID: %s, %v", keyid, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ type ErrPasswordInvalid struct{}
|
||||
// ErrPasswordInvalid is returned when signing fails. It could also mean the signing
|
||||
// key file was corrupted, but we have no way to distinguish.
|
||||
func (err ErrPasswordInvalid) Error() string {
|
||||
return "Password Invalid, operation has failed."
|
||||
return "password invalid, operation has failed."
|
||||
}
|
||||
|
||||
// KeyStore is a generic interface for private key storage
|
||||
@@ -159,7 +159,7 @@ func addKey(s LimitedFileStore, passphraseRetriever passphrase.Retriever, cached
|
||||
continue
|
||||
}
|
||||
if giveup {
|
||||
return errors.New("obtaining passphrase failed")
|
||||
return ErrPasswordInvalid{}
|
||||
}
|
||||
if attempts > 10 {
|
||||
return errors.New("maximum number of passphrase attempts exceeded")
|
||||
|
||||
Reference in New Issue
Block a user