Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix break in scankeys (#11878)
- this is a fix due to fact we're halfway through the LoginState refactor
- just pull the username out of the environment for now
- fixes #11875
  • Loading branch information
maxtaco committed May 16, 2018
1 parent 1650051 commit cb48915
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions go/libkb/account.go
Expand Up @@ -278,20 +278,28 @@ func (a *Account) Keyring() (*SKBKeyringFile, error) {
a.G().Log.Warning("local session after load is nil")
}
unp := a.localSession.GetUsername()
var un NormalizedUsername
if unp != nil {
un = *unp
}
if un.IsNil() {
un = a.G().Env.GetUsername()
}

// not sure how this could happen, but just in case:
if unp == nil {
if un.IsNil() {
return nil, NoUsernameError{}
}

if a.skbKeyring != nil && a.skbKeyring.IsForUsername(*unp) {
a.G().Log.Debug("Account: found loaded keyring for %s", *unp)
if a.skbKeyring != nil && a.skbKeyring.IsForUsername(un) {
a.G().Log.Debug("Account: found loaded keyring for %s", un)
return a.skbKeyring, nil
}

a.skbKeyring = nil

a.G().Log.Debug("Account: loading keyring for %s", *unp)
kr, err := LoadSKBKeyring(*unp, a.G())
a.G().Log.Debug("Account: loading keyring for %s", un)
kr, err := LoadSKBKeyring(un, a.G())
if err != nil {
return nil, err
}
Expand Down

0 comments on commit cb48915

Please sign in to comment.