Fix a null pointer and update status threshold
This commit is contained in:
parent
bd0ac25eb9
commit
2d05e072b9
|
@ -64,11 +64,18 @@ func handleSysRekeyInitGet(ctx context.Context, core *vault.Core, recovery bool,
|
|||
return
|
||||
}
|
||||
|
||||
sealThreshold, err := core.RekeyThreshold(ctx, recovery)
|
||||
if err != nil {
|
||||
respondError(w, err.Code(), err)
|
||||
return
|
||||
}
|
||||
|
||||
// Format the status
|
||||
status := &RekeyStatusResponse{
|
||||
Started: false,
|
||||
T: 0,
|
||||
N: 0,
|
||||
Started: false,
|
||||
T: 0,
|
||||
N: 0,
|
||||
Required: sealThreshold,
|
||||
}
|
||||
if rekeyConf != nil {
|
||||
// Get the progress
|
||||
|
@ -78,18 +85,11 @@ func handleSysRekeyInitGet(ctx context.Context, core *vault.Core, recovery bool,
|
|||
return
|
||||
}
|
||||
|
||||
sealThreshold, err := core.RekeyThreshold(ctx, recovery)
|
||||
if err != nil {
|
||||
respondError(w, err.Code(), err)
|
||||
return
|
||||
}
|
||||
|
||||
status.Nonce = rekeyConf.Nonce
|
||||
status.Started = started
|
||||
status.T = rekeyConf.SecretThreshold
|
||||
status.N = rekeyConf.SecretShares
|
||||
status.Progress = progress
|
||||
status.Required = sealThreshold
|
||||
status.VerificationRequired = rekeyConf.VerificationRequired
|
||||
if rekeyConf.PGPKeys != nil && len(rekeyConf.PGPKeys) != 0 {
|
||||
pgpFingerprints, err := pgpkeys.GetFingerprints(rekeyConf.PGPKeys, nil)
|
||||
|
|
|
@ -359,7 +359,9 @@ func (c *Core) BarrierRekeyUpdate(ctx context.Context, key []byte, nonce string)
|
|||
|
||||
// Schedule the rekey progress for forgetting
|
||||
defer func() {
|
||||
c.barrierRekeyConfig.RekeyProgress = nil
|
||||
if c.barrierRekeyConfig != nil {
|
||||
c.barrierRekeyConfig.RekeyProgress = nil
|
||||
}
|
||||
}()
|
||||
|
||||
// Recover the master key or recovery key
|
||||
|
@ -590,7 +592,9 @@ func (c *Core) RecoveryRekeyUpdate(ctx context.Context, key []byte, nonce string
|
|||
|
||||
// Schedule the rekey progress for forgetting
|
||||
defer func() {
|
||||
c.recoveryRekeyConfig.RekeyProgress = nil
|
||||
if c.recoveryRekeyConfig != nil {
|
||||
c.recoveryRekeyConfig.RekeyProgress = nil
|
||||
}
|
||||
}()
|
||||
|
||||
// Recover the master key
|
||||
|
|
Loading…
Reference in New Issue