summaryrefslogtreecommitdiff
path: root/src/basic/journal-importer.c
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* journal-remote: parse the _BOOT_ID field and use the value when writing entriesZbigniew Jędrzejewski-Szmek2018-05-311-17/+29
| | | | | | The boot id is stored twice, and different code paths use either one or the other. So we need to store it both in the header and as a field for full compatibility.
* basic/journal-importer: "trusted" fields in binary format are not supportedZbigniew Jędrzejewski-Szmek2018-05-311-12/+6
| | | | | | | | | | | The parser never accepted "__"-prefixed fields in binary format, but there was a comment questioning this decision. Let's make it official, and remove the comment. Also, for clarity, let's move the dunder field parsing after the field verification check. This doesn't change much, because invalid fields cannot be known special fields, but is seems cleaner to first verify the validity of the name, and then check if it is one of the known ones.
* basic/journal-importer: reject any field names that journald would rejectZbigniew Jędrzejewski-Szmek2018-05-311-0/+11
| | | | | | | | | | | $ build-asan/fuzz-journal-remote test/fuzz-regressions/fuzz-journal-remote/crash-96dee870ea66d03e89ac321eee28ea63a9b9aa45 ... Ignoring invalid field: "S\020" Ignoring invalid field: "S\020" ... If the field name includes nul bytes, we won't print all of the name. But that seems enough of a corner case to ignore.
* basic/journal-importer: escape & ellipsize bad data in log entriesZbigniew Jędrzejewski-Szmek2018-05-311-3/+8
| | | | | | | We shouldn't just log arbitrary stuff, in particular newlines and control chars Now: Unknown dunder line __CURSORFACILITY=6\nSYSLOG_IDENTIFIER=/USR/SBIN/CRON\nMES…, ignoring. Unknown dunder line __REALTIME_TIME[TAMP=1404101101501874\n__MONOTONIC_TIMEST…, ignoring.
* basic/journal-importer: do not write non-unicode char to logZbigniew Jędrzejewski-Szmek2018-05-311-1/+6
| | | | | The type of cescape_char() is changed to int to make it easier to use in "%.*s". We know the value is between 1 and 4, so size_t is overkill.
* journal-remote: verify realtime and monotonic timestamps earlyZbigniew Jędrzejewski-Szmek2018-05-311-13/+22
| | | | | We would accept any value, and then journal_file_check_object() would reject the whole entry. Let's just ignore the field.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* log: minimize includes in log.hLennart Poettering2018-01-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | log.h really should only include the bare minimum of other headers, as it is really pulled into pretty much everything else and already in itself one of the most basic pieces of code we have. Let's hence drop inclusion of: 1. sd-id128.h because it's entirely unneeded in current log.h 2. errno.h, dito. 3. sys/signalfd.h which we can replace by a simple struct forward declaration 4. process-util.h which was needed for getpid_cached() which we now hide in a funciton log_emergency_level() instead, which nicely abstracts the details away. 5. sys/socket.h which was needed for struct iovec, but a simple struct forward declaration suffices for that too. Ultimately this actually makes our source tree larger (since users of the functionality above must now include it themselves, log.h won't do that for them), but I think it helps to untangle our web of includes a tiny bit. (Background: I'd like to isolate the generic bits of src/basic/ enough so that we can do a git submodule import into casync for it)
* tree-wide: drop a few == NULL and != NULL comparisonLennart Poettering2017-12-111-3/+3
| | | | | | | Our CODING_STYLE suggests not comparing with NULL, but relying on C's downgrade-to-bool feature for that. Fix up some code to match these guidelines. (This is not comprehensive, the coccinelle output for this is unfortunately kinda borked)
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* tree-wide: use IN_SET where possibleAndreas Rammhold2017-10-021-3/+1
| | | | | In addition to the changes from #6933 this handles cases that could be matched with the included cocci file.
* io-util: add new IOVEC_INIT/IOVEC_MAKE macrosLennart Poettering2017-09-221-2/+3
| | | | | | | | | | | | | | | | | | | | | | This adds IOVEC_INIT() and IOVEC_MAKE() for initializing iovec structures from a pointer and a size. On top of these IOVEC_INIT_STRING() and IOVEC_MAKE_STRING() are added which take a string and automatically determine the size of the string using strlen(). This patch removes the old IOVEC_SET_STRING() macro, given that IOVEC_MAKE_STRING() is now useful for similar purposes. Note that the old IOVEC_SET_STRING() invocations were two characters shorter than the new ones using IOVEC_MAKE_STRING(), but I think the new syntax is more readable and more generic as it simply resolves to a C99 literal structure initialization. Moreover, we can use very similar syntax now for initializing strings and pointer+size iovec entries. We canalso use the new macros to initialize function parameters on-the-fly or array definitions. And given that we shouldn't have so many ways to do the same stuff, let's just settle on the new macros. (This also converts some code to use _cleanup_ where dynamically allocated strings were using IOVEC_SET_STRING() before, to modernize things a bit)
* journal-remote: fix memleak of the name of the remote sourceZbigniew Jędrzejewski-Szmek2017-05-191-0/+1
|
* basic/journal-importer: Fix unaligned access in get_data_size() (#5622)John Paul Adrian Glaubitz2017-03-211-1/+2
|
* coredump: fix handling of premature-eof data for --backtraceZbigniew Jędrzejewski-Szmek2017-03-051-1/+1
| | | | | We'd fail with an assert in journal_importer_process_data(), because that function requires the caller to handle EOF themselves.
* Move export format parsing from src/journal-remote/ to src/basic/Zbigniew Jędrzejewski-Szmek2017-02-141-0/+481
No functional change.