summaryrefslogtreecommitdiff
path: root/src/journal/journal-verify.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-08-19 15:15:59 +0200
committerLennart Poettering <lennart@poettering.net>2012-08-19 15:16:11 +0200
commitfc89a13992384ab8d8fb0c937b021434123bbc49 (patch)
tree6cd0136ce58b336caf800fb0406de867b3933a06 /src/journal/journal-verify.c
parent84168d8068bb67dcd5468ab3b376535d81643aef (diff)
journal: validate timestamps as well
Diffstat (limited to 'src/journal/journal-verify.c')
-rw-r--r--src/journal/journal-verify.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c
index a31817671b..535b2727ac 100644
--- a/src/journal/journal-verify.c
+++ b/src/journal/journal-verify.c
@@ -35,8 +35,8 @@
/* FIXME:
*
- * - write bit mucking test
* - evolve key even if nothing happened in regular intervals
+ * - add macro for accessing flags
*
* - Allow building without libgcrypt
* - check with sparse
@@ -115,7 +115,8 @@ static int journal_file_object_verify(JournalFile *f, Object *o) {
return -EBADMSG;
if (le64toh(o->entry.seqnum) <= 0 ||
- le64toh(o->entry.realtime) <= 0)
+ !VALID_REALTIME(le64toh(o->entry.realtime)) ||
+ !VALID_MONOTONIC(le64toh(o->entry.monotonic)))
return -EBADMSG;
for (i = 0; i < journal_file_entry_n_items(o); i++) {
@@ -169,6 +170,10 @@ static int journal_file_object_verify(JournalFile *f, Object *o) {
case OBJECT_TAG:
if (le64toh(o->object.size) != sizeof(TagObject))
return -EBADMSG;
+
+ if (!VALID_EPOCH(o->tag.epoch))
+ return -EBADMSG;
+
break;
}