Skip to content

Commit

Permalink
Fix a nil map pointer in mergeEntity. (#7711)
Browse files Browse the repository at this point in the history
  • Loading branch information
ncabatoff committed Oct 22, 2019
1 parent f032fb2 commit 46c34b6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vault/identity_store_entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/hashicorp/errwrap"
memdb "github.com/hashicorp/go-memdb"
"github.com/hashicorp/vault/helper/identity"
"github.com/hashicorp/vault/helper/identity/mfa"
"github.com/hashicorp/vault/helper/namespace"
"github.com/hashicorp/vault/helper/storagepacker"
"github.com/hashicorp/vault/sdk/framework"
Expand Down Expand Up @@ -649,6 +650,9 @@ func (i *IdentityStore) mergeEntity(ctx context.Context, txn *memdb.Txn, toEntit
if ok && !force {
return nil, fmt.Errorf("conflicting MFA config ID %q in entity ID %q", configID, fromEntity.ID)
} else {
if toEntity.MFASecrets == nil {
toEntity.MFASecrets = make(map[string]*mfa.Secret)
}
toEntity.MFASecrets[configID] = configSecret
}
}
Expand Down

0 comments on commit 46c34b6

Please sign in to comment.