mirror of
https://github.com/systemd/systemd.git
synced 2024-12-27 07:22:31 +03:00
Merge pull request #4207 from fbuihuu/fix-journal-hmac-calculation
Fix journal hmac calculation.
This commit is contained in:
commit
2541b135bf
@ -333,8 +333,13 @@ JournalFile* journal_file_close(JournalFile *f) {
|
||||
|
||||
#ifdef HAVE_GCRYPT
|
||||
/* Write the final tag */
|
||||
if (f->seal && f->writable)
|
||||
journal_file_append_tag(f);
|
||||
if (f->seal && f->writable) {
|
||||
int r;
|
||||
|
||||
r = journal_file_append_tag(f);
|
||||
if (r < 0)
|
||||
log_error_errno(r, "Failed to append tag when closing journal: %m");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (f->post_change_timer) {
|
||||
@ -1369,6 +1374,12 @@ static int journal_file_append_data(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
#ifdef HAVE_GCRYPT
|
||||
r = journal_file_hmac_put_object(f, OBJECT_DATA, o, p);
|
||||
if (r < 0)
|
||||
return r;
|
||||
#endif
|
||||
|
||||
/* The linking might have altered the window, so let's
|
||||
* refresh our pointer */
|
||||
r = journal_file_move_to_object(f, OBJECT_DATA, p, &o);
|
||||
@ -1393,12 +1404,6 @@ static int journal_file_append_data(
|
||||
fo->field.head_data_offset = le64toh(p);
|
||||
}
|
||||
|
||||
#ifdef HAVE_GCRYPT
|
||||
r = journal_file_hmac_put_object(f, OBJECT_DATA, o, p);
|
||||
if (r < 0)
|
||||
return r;
|
||||
#endif
|
||||
|
||||
if (ret)
|
||||
*ret = o;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user