]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/libsystemd/sd-journal/sd-journal.c
sd-journal: Don't compare hashes from different journal files
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 14 Sep 2021 14:08:46 +0000 (15:08 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 15 Sep 2021 02:00:49 +0000 (11:00 +0900)
commit27bf0ab76e13611dce10210f2a22fb5fba05adbb
tree05e5299fcdb67f681785f014156e63b85ead8065
parent2709d02906dd3ab5ecc2b3e19e2846b1714a7e5a
sd-journal: Don't compare hashes from different journal files

In sd_journal_enumerate_fields(), we check if we've already handled
a field by checking if we can find it in any of the already processed
journal files. We do this by calling
journal_file_find_field_object_with_hash(), which compares the size,
payload and hash of the given field against all fields in a journal file,
trying to find a match. However, since we now use per file hash functions,
hashes for the same fields will differ between different journal files,
meaning we'll never find an actual match.

To fix the issue(), let's use journal_file_find_field_object() when one
or more of the files we're comparing is using per file keyed hashes.
journal_file_find_field_object() only takes the field payload and size
as arguments and calculates the hash itself using the hash function from
the journal file we're searching in.
src/libsystemd/sd-journal/sd-journal.c