Skip to content

Commit

Permalink
Don't continue in a few places in pki tidy if value is nil (#7589)
Browse files Browse the repository at this point in the history
Fixes #7588
  • Loading branch information
jefferai authored and chrishoffman committed Oct 15, 2019
1 parent 217a796 commit acfc348
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions builtin/logical/pki/path_tidy.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func (b *backend) pathTidyWrite(ctx context.Context, req *logical.Request, d *fr
if err := req.Storage.Delete(ctx, "certs/"+serial); err != nil {
return errwrap.Wrapf(fmt.Sprintf("error deleting entry with nil value with serial %s: {{err}}", serial), err)
}
continue
}

cert, err := x509.ParseCertificate(certEntry.Value)
Expand Down Expand Up @@ -156,13 +157,15 @@ func (b *backend) pathTidyWrite(ctx context.Context, req *logical.Request, d *fr
if err := req.Storage.Delete(ctx, "revoked/"+serial); err != nil {
return errwrap.Wrapf(fmt.Sprintf("error deleting nil revoked entry with serial %s: {{err}}", serial), err)
}
continue
}

if revokedEntry.Value == nil || len(revokedEntry.Value) == 0 {
logger.Warn("revoked entry has nil value; tidying up since it is no longer useful for any server operations", "serial", serial)
if err := req.Storage.Delete(ctx, "revoked/"+serial); err != nil {
return errwrap.Wrapf(fmt.Sprintf("error deleting revoked entry with nil value with serial %s: {{err}}", serial), err)
}
continue
}

err = revokedEntry.DecodeJSON(&revInfo)
Expand Down

0 comments on commit acfc348

Please sign in to comment.