summaryrefslogtreecommitdiffstats
path: root/src/journal-remote (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Remove 'inline' attributes from static functions in .c files (#11426)Topi Miettinen2019-01-152-2/+2
| | | Let the compiler perform inlining (see #11397).
* journal-remote: set a limit on the number of fields in a messageZbigniew Jędrzejewski-Szmek2019-01-092-2/+8
| | | | | | | | | Existing use of E2BIG is replaced with ENOBUFS (entry too long), and E2BIG is reused for the new error condition (too many fields). This matches the change done for systemd-journald, hence forming the second part of the fix for CVE-2018-16865 (https://bugzilla.redhat.com/show_bug.cgi?id=1653861).
* journal-remote: verify entry length from headerZbigniew Jędrzejewski-Szmek2019-01-091-10/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling mhd_respond(), which ulimately calls MHD_queue_response() is ineffective at point, becuase MHD_queue_response() immediately returns MHD_NO signifying an error, because the connection is in state MHD_CONNECTION_CONTINUE_SENT. As Christian Grothoff kindly explained: > You are likely calling MHD_queue_repsonse() too late: once you are > receiving upload_data, HTTP forces you to process it all. At this time, > MHD has already sent "100 continue" and cannot take it back (hence you > get MHD_NO!). > > In your request handler, the first time when you are called for a > connection (and when hence *upload_data_size == 0 and upload_data == > NULL) you must check the content-length header and react (with > MHD_queue_response) based on this (to prevent MHD from automatically > generating 100 continue). If we ever encounter this kind of error, print a warning and immediately abort the connection. (The alternative would be to keep reading the data, but ignore it, and return an error after we get to the end of data. That is possible, but of course puts additional load on both the sender and reciever, and doesn't seem important enough just to return a good error message.) Note that sending of the error does not work (the connection is always aborted when MHD_queue_response is used with MHD_RESPMEM_MUST_FREE, as in this case) with libµhttpd 0.59, but works with 0.61: https://src.fedoraproject.org/rpms/libmicrohttpd/pull-request/1
* µhttpd: use a cleanup function to call MHD_destroy_responseZbigniew Jędrzejewski-Szmek2019-01-093-47/+18
|
* meson: generate version tag from gitZbigniew Jędrzejewski-Szmek2018-12-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ build/systemctl --version systemd 239-3555-g6178cbb5b5 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid $ git tag v240 -m 'v240' $ ninja -C build ninja: Entering directory `build' [76/76] Linking target fuzz-unit-file. $ build/systemctl --version systemd 240 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid This is very useful during development, because a precise version string is embedded in the build product and displayed during boot, so we don't have to guess answers for questions like "did I just boot the latest version or the one from before?". This change creates an overhead for "noop" builds. On my laptop, 'ninja -C build' that does nothing goes from 0.1 to 0.5 s. It would be nice to avoid this, but I think that <1 s is still acceptable. Fixes #7183. PACKAGE_VERSION is renamed to GIT_VERSION, to make it obvious that this is the more dynamically changing version string. Why save to a file? It would be easy to generate the version tag using run_command(), but we want to go through a file so that stuff gets rebuilt when this file changes. If we just defined an variable in meson, ninja wouldn't know it needs to rebuild things.
* Remove use of PACKAGE_STRINGZbigniew Jędrzejewski-Szmek2018-12-191-1/+1
| | | | | | | PACKAGE_VERSION is more explicit, and also, we don't pretend that changing the project name in meson.build has any real effect. "systemd" is embedded in a thousand different places, so let's just use the hardcoded string consistently. This is mostly in preparation for future changes.
* journal-remote: define main through macroYu Watanabe2018-12-081-38/+45
| | | | Also, this fixes memleaks on failure.
* journal-remote: destroy RemoteServer object by using _cleanup_ attributeYu Watanabe2018-12-083-6/+3
|
* journal-upload: define main through macroYu Watanabe2018-12-081-29/+24
|
* journal-upload: use _cleanup_ attribute to clear uploaderYu Watanabe2018-12-081-3/+1
|
* journal-gateway: define main through macroYu Watanabe2018-12-081-70/+68
|
* journal-gateway: use _cleanup_ attribute to stop microhttpd daemonYu Watanabe2018-12-082-4/+3
|
* Merge pull request #10935 from poettering/rlimit-nofile-safeZbigniew Jędrzejewski-Szmek2018-12-061-0/+2
|\ | | | | | | Merged by hand to resolve a trivial conflict in TODO.
| * tree-wide: invoke rlimit_nofile_safe() before various exec{v,ve,l}() invocationsLennart Poettering2018-12-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whenever we invoke external, foreign code from code that has RLIMIT_NOFILE's soft limit bumped to high values, revert it to 1024 first. This is a safety precaution for compatibility with programs using select() which cannot operate with fds > 1024. This commit adds the call to rlimit_nofile_safe() to all invocations of exec{v,ve,l}() and friends that either are in code that we know runs with RLIMIT_NOFILE bumped up (which is PID 1 and all journal code for starters) or that is part of shared code that might end up there. The calls are placed as early as we can in processes invoking a flavour of execve(), but after the last time we do fd manipulations, so that we can still take benefit of the high fd limits for that.
* | util-lib: split out env file parsing code into env-file.cLennart Poettering2018-12-021-0/+1
| | | | | | | | | | | | It's quite complex, let's split this out. No code changes, just some file rearranging.
* | util-lib: split out all temporary file related calls into tmpfiles-util.cLennart Poettering2018-12-022-0/+2
|/ | | | | | | | This splits out a bunch of functions from fileio.c that have to do with temporary files. Simply to make the header files a bit shorter, and to group things more nicely. No code changes, just some rearranging of source files.
* journal-upload: use static initializationLennart Poettering2018-11-261-2/+3
|
* journal-remote: shorten code a bit by using strcspn()Lennart Poettering2018-11-261-8/+3
|
* tree-wide: port various places over to STARTSWITH_SET()Lennart Poettering2018-11-262-5/+6
|
* Also drop a few more unnecessary uses of synthethic errnoZbigniew Jędrzejewski-Szmek2018-11-222-3/+2
|
* coccinelle: make use of SYNTHETIC_ERRNOZbigniew Jędrzejewski-Szmek2018-11-225-214/+166
| | | | | | | | | | | Ideally, coccinelle would strip unnecessary braces too. But I do not see any option in coccinelle for this, so instead, I edited the patch text using search&replace to remove the braces. Unfortunately this is not fully automatic, in particular it didn't deal well with if-else-if-else blocks and ifdefs, so there is an increased likelikehood be some bugs in such spots. I also removed part of the patch that coccinelle generated for udev, where we returns -1 for failure. This should be fixed independently.
* Split out pretty-print.c and move pager.c and main-func.h to shared/Zbigniew Jędrzejewski-Szmek2018-11-203-3/+3
| | | | | This is high-level functionality, and fits better in shared/ (which is for our executables), than in basic/ (which is also for libraries).
* log: introduce new helper call log_setup_service()Lennart Poettering2018-11-201-3/+1
| | | | | Let's reduce the common boilerplate and have a single setup function used by all service code to setup logging.
* fileio: automatically add NULL sentinel to parse_env_file()Lennart Poettering2018-11-141-4/+1
| | | | Let's modernize things a bit.
* fileio: drop "newline" parameter for env file parsersLennart Poettering2018-11-141-1/+1
| | | | | | | Now that we don't (mis-)use the env file parser to parse kernel command lines there's no need anymore to override the used newline character set. Let's hence drop the argument and just "\n\r" always. This nicely simplifies our code.
* journal-remote: log about inability to install signalsLennart Poettering2018-11-121-1/+3
|
* journal-remote: bugfix to re-enable ssl key check (#10707)Markus Grimm2018-11-121-1/+3
|
* tree-wide: uniformly bump RLIMIT_NOFILE in all our tools that access the journalLennart Poettering2018-10-162-0/+8
| | | | | | This makes use of rlimit_nofile_bump() in all tools that access the journal. In some cases this replaces older code to achieve this, and others we add it in where it was missing.
* journal-upload: check for overflowLennart Poettering2018-10-131-11/+11
| | | | CID 1394386
* journalctl: port JSON output mode to new JSON APILennart Poettering2018-10-111-0/+3
| | | | | | Also, while we are at it, beef it up, by adding json-seq support (i.e. https://tools.ietf.org/html/rfc7464). This is particularly useful in conjunction with jq's --seq switch.
* journal-upload: add asserts that snprintf does not return an errorZbigniew Jędrzejewski-Szmek2018-10-021-4/+8
| | | | | | | | | | LGMT complains: > The size argument of this snprintf call is derived from its return value, > which may exceed the size of the buffer and overflow. Let's make sure that r is non-negative. (This shouldn't occur unless the format string is borked, so let's just add an assert.) Then, let's reorder the comparison to avoid the potential overflow.
* journal-upload: fix off-by-one in assert()Zbigniew Jędrzejewski-Szmek2018-09-251-1/+1
| | | | CID #1394386.
* tree-wide: use DEFINE_TRIVIAL_REF_UNREF_FUNC() macro or friends where applicableYu Watanabe2018-08-272-16/+2
|
* tree-wide: use unsigned for refcountYu Watanabe2018-08-271-1/+1
|
* tree-wide: add clickable man page link to all --help textsLennart Poettering2018-08-203-16/+53
| | | | | | | | | | This is a bit like the info link in most of GNU's --help texts, but we don't do info but man pages, and we make them properly clickable on terminal supporting that, because awesome. I think it's generally advisable to link up our (brief) --help texts and our (more comprehensive) man pages a bit, so this should be an easy and straight-forward way to do it.
* Merge pull request #9422 from yuwata/conf-filesLennart Poettering2018-06-282-0/+26
|\ | | | | cleanups for default conf files
| * journal-remote: add license and reference to man page in conf filesYu Watanabe2018-06-252-0/+26
| |
* | journal-gateway: use localStorage["cursor"] only when it has valid valueYu Watanabe2018-06-271-4/+6
| | | | | | | | Discovered by LGTM.
* | journal-gateway: explicitly declare local variablesYu Watanabe2018-06-271-5/+6
|/ | | | Suggested by LGTM.
* Drop my copyright headersZbigniew Jędrzejewski-Szmek2018-06-1411-36/+0
| | | | | | | perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-1411-11/+11
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-142-4/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-1411-22/+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: do not send _BOOT_ID twiceZbigniew Jędrzejewski-Szmek2018-05-311-3/+9
| | | | | | | | | | | | Also remove the comma from the comment everywhere, I think the comma unnecessarilly put emphasis on the clause after the comma. Fixes #9090. Reproducer: systemd-journal-remote --split-mode=none -o /tmp/msg6.journal --trust=all --listen-http=8080 systemd-journal-upload -u http://localhost:8080 journalctl --file /tmp/msg6.journal -o verbose -n1
* journal: allow boot_id to be passed to journal_append_entry()Zbigniew Jędrzejewski-Szmek2018-05-311-2/+4
| | | | | In this commit, this is done only in testing code, i.e. there is no functional change apart from tests.
* journal-remote: when an entry is rejected with -EBADMSG, do not rotate the ↵Zbigniew Jędrzejewski-Szmek2018-05-312-5/+8
| | | | | | | | | | | journal file Something is wrong with the entry (probably a missing timestamp), so no point in rotating. But suppress the error in process_source(), so that the processing of the data stream continues. Also, just return 0 from writer_write() on success, the only caller doesn't care.
* journal: rename output_journal to show_journal_entryZbigniew Jędrzejewski-Szmek2018-05-311-1/+1
| | | | | We have show_journal, and output_journal, and it's not immediately clear how they related. Rename the first to show that it just prints one entry.
* fuzz-journal-remote: allow fuzzer to be built without µhttpdZbigniew Jędrzejewski-Szmek2018-05-313-9/+26
| | | | | journal-remote still requires µhttpd, but things are easier if the fuzzer can be built without.
* log-generator: make message size configurable, add short optionsZbigniew Jędrzejewski-Szmek2018-05-311-2/+5
| | | | Also remove "b''" from the generated MESSAGE= field.
* journal-remote: export handle_raw_source()Zbigniew Jędrzejewski-Szmek2018-05-312-7/+13
|