diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2016-09-10 20:16:28 +0100 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2016-09-11 20:41:32 +0100 |
commit | 65151dd29dc01c6d1f6ff79ab6f8e049e925ce25 (patch) | |
tree | 2db5267b573f2a58ffff94de7f9b9af5f9767d82 /server/store | |
parent | 2e7c8c2f521c9e50bb3aea4df16771c22fe70e58 (diff) |
Add a toggle for unexpired certs
Diffstat (limited to 'server/store')
-rw-r--r-- | server/store/mem.go | 6 | ||||
-rw-r--r-- | server/store/store_test.go | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/server/store/mem.go b/server/store/mem.go index e63d00a..54aa965 100644 --- a/server/store/mem.go +++ b/server/store/mem.go @@ -40,7 +40,7 @@ func (ms *memoryStore) List(includeExpired bool) ([]*CertRecord, error) { defer ms.Unlock() for _, value := range ms.certs { - if !includeExpired && value.Expires.After(time.Now().UTC()) { + if !includeExpired && value.Expires.Before(time.Now().UTC()) { continue } records = append(records, value) @@ -62,7 +62,9 @@ func (ms *memoryStore) GetRevoked() ([]*CertRecord, error) { var revoked []*CertRecord all, _ := ms.List(false) for _, r := range all { - revoked = append(revoked, r) + if r.Revoked { + revoked = append(revoked, r) + } } return revoked, nil } diff --git a/server/store/store_test.go b/server/store/store_test.go index 3552d1c..594da37 100644 --- a/server/store/store_test.go +++ b/server/store/store_test.go @@ -49,7 +49,7 @@ func testStore(t *testing.T, db CertStorer) { if err := db.SetRecord(r); err != nil { t.Error(err) } - if _, err := db.List(); err != nil { + if _, err := db.List(true); err != nil { t.Error(err) } |