1
0
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:
Diogo Mónica
2015-07-22 15:39:31 -07:00
2 changed files with 3 additions and 7 deletions

View File

@@ -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
}

View File

@@ -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")