3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-14 16:09:32 +01:00

Merge pull request #735 from slingamn/issue733

fix #733
This commit is contained in:
Shivaram Lingamneni 2020-01-06 13:29:34 -05:00 committed by GitHub
commit 01e1a01fa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -378,9 +378,6 @@ func (am *AccountManager) Register(client *Client, account string, callbackNames
tx.Set(registeredTimeKey, registeredTimeStr, setOptions) tx.Set(registeredTimeKey, registeredTimeStr, setOptions)
tx.Set(credentialsKey, credStr, setOptions) tx.Set(credentialsKey, credStr, setOptions)
tx.Set(callbackKey, callbackSpec, setOptions) tx.Set(callbackKey, callbackSpec, setOptions)
if certfp != "" {
tx.Set(certFPKey, casefoldedAccount, setOptions)
}
return nil return nil
}) })
}() }()
@ -1439,6 +1436,13 @@ func (ac *AccountCredentials) SetPassphrase(passphrase string, bcryptCost uint)
} }
func (ac *AccountCredentials) AddCertfp(certfp string) (err error) { func (ac *AccountCredentials) AddCertfp(certfp string) (err error) {
// XXX we require that certfp is already normalized (rather than normalize here
// and pass back the normalized version as an additional return parameter);
// this is just a final sanity check:
if len(certfp) != 64 {
return utils.ErrInvalidCertfp
}
for _, current := range ac.Certfps { for _, current := range ac.Certfps {
if certfp == current { if certfp == current {
return errNoop return errNoop