platform/upstream/systemd.git
6 years agojournal: refuse an entry with invalid timestamp fields
Zbigniew Jędrzejewski-Szmek [Thu, 24 May 2018 11:11:12 +0000 (13:11 +0200)]
journal: refuse an entry with invalid timestamp fields

The journal verification functions would reject such an entry. It would probably
still display fine (because we prefer _SOURCE_REALTIME_TIMESTAMP= if present), but
it seems wrong to create an entry that would not pass verification.

6 years agoUse const char* for timestamp strings which we don't plan to modify
Zbigniew Jędrzejewski-Szmek [Thu, 24 May 2018 07:36:56 +0000 (09:36 +0200)]
Use const char* for timestamp strings which we don't plan to modify

Makes the intent a bit clearer.

6 years agoAlways allow timestamps to be printed
Zbigniew Jędrzejewski-Szmek [Mon, 21 May 2018 18:39:09 +0000 (20:39 +0200)]
Always allow timestamps to be printed

If the timestamp is above 9999-12-30, (or 2038-something-something on 32 bit),
use XXXX-XX-XX XX:XX:XX as the replacement.

The problem with refusing to print timestamps is that our code accepts such
timestamps, so we can't really just refuse to process them afterwards. Also, it
makes journal files non-portable, because suddently we might completely refuse
to print entries which are totally OK on a different machine.

6 years agofuzz-journal-remote: write to /dev/null not stdout
Zbigniew Jędrzejewski-Szmek [Mon, 21 May 2018 12:42:42 +0000 (14:42 +0200)]
fuzz-journal-remote: write to /dev/null not stdout

This makes the fuzzing much more efficient. Optionally provide output is
$SYSTEMD_FUZZ_OUTPUT is set, which makes debugging of any failures much easier.

The case from 056129deb73df17ece4212db39d2ca0842d9a49c is still detected properly.

6 years agobasic/journal-importer: "trusted" fields in binary format are not supported
Zbigniew Jędrzejewski-Szmek [Sun, 20 May 2018 20:51:28 +0000 (22:51 +0200)]
basic/journal-importer: "trusted" fields in binary format are not supported

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.

6 years agobasic/journal-importer: reject any field names that journald would reject
Zbigniew Jędrzejewski-Szmek [Sun, 20 May 2018 20:45:22 +0000 (22:45 +0200)]
basic/journal-importer: reject any field names that journald would reject

$ 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.

6 years agoshared/logs-show: use _cleanup_
Zbigniew Jędrzejewski-Szmek [Sun, 20 May 2018 20:13:08 +0000 (22:13 +0200)]
shared/logs-show: use _cleanup_

6 years agoshared/logs-show: fix mixup between length-based memory duplication and string operations
Zbigniew Jędrzejewski-Szmek [Sun, 20 May 2018 20:06:23 +0000 (22:06 +0200)]
shared/logs-show: fix mixup between length-based memory duplication and string operations

We'd look for a '=' separator using memchr, i.e. ignoring any nul bytes in the
string, but then do a strndup, which would terminate on any nul byte, and then
again do a memcmp, which would access memory past the chunk allocated by strndup.

Of course, we probably shouldn't allow keys with nul bytes in them. But we
currently do, so there might be journal files like that out there. So let's fix
the journal-reading code first.

6 years agobasic/random-util: do not use getrandom() under msan
Evgeny Vereshchagin [Sun, 20 May 2018 13:07:07 +0000 (15:07 +0200)]
basic/random-util: do not use getrandom() under msan

`fuzz-journal-remote` seems to be failing under `msan` as soon as it starts:

$ sudo infra/helper.py run_fuzzer systemd fuzz-journal-remote
Running: docker run --rm -i --privileged -e FUZZING_ENGINE=libfuzzer -v /home/vagrant/oss-fuzz/build/out/systemd:/out -t gcr.io/oss-fuzz-base/base-runner run_fuzzer fuzz-journal-remote
Using seed corpus: fuzz-journal-remote_seed_corpus.zip
/out/fuzz-journal-remote -rss_limit_mb=2048 -timeout=25 /tmp/fuzz-journal-remote_corpus -max_len=65536 < /dev/null
INFO: Seed: 3380449479
INFO: Loaded 2 modules   (36336 inline 8-bit counters): 36139 [0x7ff36ea31d39, 0x7ff36ea3aa64), 197 [0x9998c8, 0x99998d),
INFO: Loaded 2 PC tables (36336 PCs): 36139 [0x7ff36ea3aa68,0x7ff36eac7d18), 197 [0x999990,0x99a5e0),
INFO:        2 files found in /tmp/fuzz-journal-remote_corpus
INFO: seed corpus: files: 2 min: 4657b max: 7790b total: 12447b rss: 97Mb
Uninitialized bytes in __interceptor_pwrite64 at offset 24 inside [0x7fffdd4d7230, 240)
==15==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7ff36e685e8a in journal_file_init_header /work/build/../../src/systemd/src/journal/journal-file.c:436:13
    #1 0x7ff36e683a9d in journal_file_open /work/build/../../src/systemd/src/journal/journal-file.c:3333:21
    #2 0x7ff36e68b8f6 in journal_file_open_reliably /work/build/../../src/systemd/src/journal/journal-file.c:3520:13
    #3 0x4a3f35 in open_output /work/build/../../src/systemd/src/journal-remote/journal-remote.c:70:13
    #4 0x4a34d0 in journal_remote_get_writer /work/build/../../src/systemd/src/journal-remote/journal-remote.c:136:21
    #5 0x4a550f in get_source_for_fd /work/build/../../src/systemd/src/journal-remote/journal-remote.c:183:13
    #6 0x4a46bd in journal_remote_add_source /work/build/../../src/systemd/src/journal-remote/journal-remote.c:235:13
    #7 0x4a271c in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/fuzz/fuzz-journal-remote.c:36:9
    #8 0x4f27cc in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/libfuzzer/FuzzerLoop.cpp:524:13
    #9 0x4efa0b in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/libfuzzer/FuzzerLoop.cpp:448:3
    #10 0x4f8e96 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) /src/libfuzzer/FuzzerLoop.cpp:732:7
    #11 0x4f9f73 in fuzzer::Fuzzer::Loop(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) /src/libfuzzer/FuzzerLoop.cpp:752:3
    #12 0x4bf329 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:756:6
    #13 0x4ac391 in main /src/libfuzzer/FuzzerMain.cpp:20:10
    #14 0x7ff36d14982f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #15 0x41f9d8 in _start (/out/fuzz-journal-remote+0x41f9d8)

  Uninitialized value was stored to memory at
    #0 0x7ff36e61cd41 in sd_id128_randomize /work/build/../../src/systemd/src/libsystemd/sd-id128/sd-id128.c:288:16
    #1 0x7ff36e685cec in journal_file_init_header /work/build/../../src/systemd/src/journal/journal-file.c:426:13
    #2 0x7ff36e683a9d in journal_file_open /work/build/../../src/systemd/src/journal/journal-file.c:3333:21
    #3 0x7ff36e68b8f6 in journal_file_open_reliably /work/build/../../src/systemd/src/journal/journal-file.c:3520:13
    #4 0x4a3f35 in open_output /work/build/../../src/systemd/src/journal-remote/journal-remote.c:70:13
    #5 0x4a34d0 in journal_remote_get_writer /work/build/../../src/systemd/src/journal-remote/journal-remote.c:136:21
    #6 0x4a550f in get_source_for_fd /work/build/../../src/systemd/src/journal-remote/journal-remote.c:183:13
    #7 0x4a46bd in journal_remote_add_source /work/build/../../src/systemd/src/journal-remote/journal-remote.c:235:13
    #8 0x4a271c in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/fuzz/fuzz-journal-remote.c:36:9
    #9 0x4f27cc in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/libfuzzer/FuzzerLoop.cpp:524:13
    #10 0x4efa0b in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/libfuzzer/FuzzerLoop.cpp:448:3
    #11 0x4f8e96 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) /src/libfuzzer/FuzzerLoop.cpp:732:7
    #12 0x4f9f73 in fuzzer::Fuzzer::Loop(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) /src/libfuzzer/FuzzerLoop.cpp:752:3
    #13 0x4bf329 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:756:6
    #14 0x4ac391 in main /src/libfuzzer/FuzzerMain.cpp:20:10
    #15 0x7ff36d14982f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

  Uninitialized value was created by an allocation of 't' in the stack frame of function 'sd_id128_randomize'
    #0 0x7ff36e61cb00 in sd_id128_randomize /work/build/../../src/systemd/src/libsystemd/sd-id128/sd-id128.c:274

SUMMARY: MemorySanitizer: use-of-uninitialized-value /work/build/../../src/systemd/src/journal/journal-file.c:436:13 in journal_file_init_header
Exiting
MS: 0 ; base unit: 0000000000000000000000000000000000000000
artifact_prefix='./'; Test unit written to ./crash-847911777b3096783f4ee70a69ab6d28380c810b
[vagrant@localhost oss-fuzz]$ sudo infra/helper.py check_build --sanitizer=memory systemd
Running: docker run --rm -i --privileged -e FUZZING_ENGINE=libfuzzer -e SANITIZER=memory -v /home/vagrant/oss-fuzz/build/out/systemd:/out -t gcr.io/oss-fuzz-base/base-runner test_all
INFO: performing bad build checks for /out/fuzz-dhcp-server.
INFO: performing bad build checks for /out/fuzz-journal-remote.
INFO: performing bad build checks for /out/fuzz-unit-file.
INFO: performing bad build checks for /out/fuzz-dns-packet.
4 fuzzers total, 0 seem to be broken (0%).
Check build passed.

It's a false positive which is most likely caused by
https://github.com/google/sanitizers/issues/852. I think it could be got around
by avoiding `getrandom` when the code is compiled with `msan`

6 years agofuzz-journal-remote: try all output modes
Zbigniew Jędrzejewski-Szmek [Thu, 17 May 2018 09:42:55 +0000 (11:42 +0200)]
fuzz-journal-remote: try all output modes

6 years agobasic/journal-importer: escape & ellipsize bad data in log entries
Zbigniew Jędrzejewski-Szmek [Thu, 17 May 2018 09:09:07 +0000 (11:09 +0200)]
basic/journal-importer: escape & ellipsize bad data in log entries

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.

6 years agobasic/string-util: add a convenience function to cescape mostly-ascii fields
Zbigniew Jędrzejewski-Szmek [Thu, 17 May 2018 08:55:21 +0000 (10:55 +0200)]
basic/string-util: add a convenience function to cescape mostly-ascii fields

It's not supposed to be the most efficient, but instead fast and simple to use.

I kept the logic in ellipsize_mem() to use unicode ellipsis even in non-unicode
locales. I'm not quite convinced things should be this way, especially that with
this patch it'd actually be simpler to always use "…" in unicode locale and "..."
otherwise, but Lennart wanted it this way for some reason.

6 years agobasic/journal-importer: do not write non-unicode char to log
Zbigniew Jędrzejewski-Szmek [Thu, 17 May 2018 08:04:24 +0000 (10:04 +0200)]
basic/journal-importer: do not write non-unicode char to log

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.

6 years agojournal-remote: when an entry is rejected with -EBADMSG, do not rotate the journal...
Zbigniew Jędrzejewski-Szmek [Thu, 17 May 2018 07:27:30 +0000 (09:27 +0200)]
journal-remote: when an entry is rejected with -EBADMSG, do not rotate the 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.

6 years agojournal-remote: verify realtime and monotonic timestamps early
Zbigniew Jędrzejewski-Szmek [Thu, 17 May 2018 07:07:58 +0000 (09:07 +0200)]
journal-remote: verify realtime and monotonic timestamps early

We would accept any value, and then journal_file_check_object() would reject
the whole entry. Let's just ignore the field.

6 years agofuzz-journal-remote: a fuzzer for journal-remote over-the-wire input
Zbigniew Jędrzejewski-Szmek [Wed, 16 May 2018 10:05:07 +0000 (12:05 +0200)]
fuzz-journal-remote: a fuzzer for journal-remote over-the-wire input

6 years agoshared/logs-show: export show_journal()
Zbigniew Jędrzejewski-Szmek [Wed, 16 May 2018 15:21:51 +0000 (17:21 +0200)]
shared/logs-show: export show_journal()

This is a nice function to output some journal entries without much ado.

6 years agojournal: rename output_journal to show_journal_entry
Zbigniew Jędrzejewski-Szmek [Wed, 16 May 2018 15:12:53 +0000 (17:12 +0200)]
journal: rename output_journal to show_journal_entry

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.

6 years agojournal: allow writing journal files even if machine-id is missing
Zbigniew Jędrzejewski-Szmek [Wed, 16 May 2018 12:02:24 +0000 (14:02 +0200)]
journal: allow writing journal files even if machine-id is missing

The code to open journal files seems like the wrong place to enforce this. We
already check during boot and refuse to boot if machine-id is missing, no need
to enforce this here. In particular, it seems better to write logs from
journald even if they are not completely functional rather than refuse to
operate at all, and systemd-journal-remote also writes journal files and may
even be run on a system without systemd at all.

The docker image that oss-fuzz uses has an empty /etc/machine-id. Obviously
this is an error in the docker, but docker is fact of life, and it seems better
for systemd-journal-remote to work in such an incomplete environment.

6 years agosd-id128: return -ENOMEDIUM on null id
Zbigniew Jędrzejewski-Szmek [Wed, 16 May 2018 11:55:12 +0000 (13:55 +0200)]
sd-id128: return -ENOMEDIUM on null id

We currently return -ENOMEDIUM when /etc/machine-id is empty, and -EINVAL when
it is all zeros. But -EINVAL is also used for invalid args. The distinction
between empty and all-zero is not very important, let's use the same return
code.

Also document -ENOENT and -ENOMEDIUM since they can be a bit surprising.

6 years agofuzz-journal-remote: allow fuzzer to be built without µhttpd
Zbigniew Jędrzejewski-Szmek [Wed, 16 May 2018 11:30:37 +0000 (13:30 +0200)]
fuzz-journal-remote: allow fuzzer to be built without µhttpd

journal-remote still requires µhttpd, but things are easier if the fuzzer
can be built without.

6 years agoshared/dissect-image: avoid warning about unused function when compiled w/o blkid
Zbigniew Jędrzejewski-Szmek [Wed, 16 May 2018 10:40:07 +0000 (12:40 +0200)]
shared/dissect-image: avoid warning about unused function when compiled w/o blkid

6 years agolog-generator: make message size configurable, add short options
Zbigniew Jędrzejewski-Szmek [Wed, 16 May 2018 10:05:43 +0000 (12:05 +0200)]
log-generator: make message size configurable, add short options

Also remove "b''" from the generated MESSAGE= field.

6 years agojournal-remote: export handle_raw_source()
Zbigniew Jędrzejewski-Szmek [Wed, 16 May 2018 09:36:52 +0000 (11:36 +0200)]
journal-remote: export handle_raw_source()

6 years agojournal-remote: split out µhttpd support and main() into a separate file
Zbigniew Jędrzejewski-Szmek [Wed, 16 May 2018 08:21:58 +0000 (10:21 +0200)]
journal-remote: split out µhttpd support and main() into a separate file

This is in preparation to reusing the RemoteServer in other concepts.
I tried to keep changes to minimum:
- arg_* global variables are now passed as state in RemoteServer
- exported functions get the "journal_remote_" prefix
- some variables are renamed

In particular, there is an ugly global RemoveServer* variable. It was originally
added because µhttpd did not allow state to be passed to the callbacks. I'm not
sure if this has been remediated in µhttpd, but either way, this is not changed
here, the global variable is only renamed for clarity.

6 years agojournal: rewrap function args
Zbigniew Jędrzejewski-Szmek [Wed, 16 May 2018 06:24:33 +0000 (08:24 +0200)]
journal: rewrap function args

6 years agoMerge pull request #9115 from yuwata/rfe-8491
Lennart Poettering [Thu, 31 May 2018 09:54:01 +0000 (11:54 +0200)]
Merge pull request #9115 from yuwata/rfe-8491

locale: re-read configuration files if necessary

6 years agoMerge pull request #9144 from yuwata/sysusers-spec
Lennart Poettering [Thu, 31 May 2018 09:41:29 +0000 (11:41 +0200)]
Merge pull request #9144 from yuwata/sysusers-spec

sysusers: support specifier expansion for GECOS and home directory

6 years agoMerge pull request #9131 from poettering/memory-startswith
Lennart Poettering [Thu, 31 May 2018 09:21:43 +0000 (11:21 +0200)]
Merge pull request #9131 from poettering/memory-startswith

add new memory_startswith() helper and make use of it everywhere

6 years agoMerge pull request #9083 from yuwata/empty-assignment
Lennart Poettering [Thu, 31 May 2018 09:13:52 +0000 (11:13 +0200)]
Merge pull request #9083 from yuwata/empty-assignment

load-fragment: make many settings accept empty string

6 years agolocale: assume locale is for LANG= when variable name is not specified
Yu Watanabe [Thu, 31 May 2018 07:27:07 +0000 (16:27 +0900)]
locale: assume locale is for LANG= when variable name is not specified

Closes #6070.

6 years agosmack: make mac_smack_fix() deal somewhat sensible with non-absolute paths
Lennart Poettering [Wed, 30 May 2018 16:21:58 +0000 (18:21 +0200)]
smack: make mac_smack_fix() deal somewhat sensible with non-absolute paths

This tries to improve the mac_smack_fix() logic a bit, by properly
handling non-absolute paths.

It's still pretty broken though, which is sad for security technology:
non-normalized paths (for example "/usr/../dev/sda") will still not be
treated correctly. I am not sure how to fix that properly though, and I
don't understand SMACK well enough to do so. This fix hence just fixes
to most obvious glaring issue.

6 years agoMerge pull request #9142 from yuwata/coverity-fixes
Lennart Poettering [Thu, 31 May 2018 08:50:10 +0000 (10:50 +0200)]
Merge pull request #9142 from yuwata/coverity-fixes

Coverity fixes

6 years agodoc: update TODO
Yu Watanabe [Thu, 31 May 2018 08:39:13 +0000 (17:39 +0900)]
doc: update TODO

6 years agoman: mention that systemd-sysusers understand the specifier.
Yu Watanabe [Thu, 31 May 2018 08:37:15 +0000 (17:37 +0900)]
man: mention that systemd-sysusers understand the specifier.

6 years agosysusers: support specifier expansion for GECOS and home directory fields
Yu Watanabe [Thu, 31 May 2018 08:36:22 +0000 (17:36 +0900)]
sysusers: support specifier expansion for GECOS and home directory fields

6 years agolocale: re-read configuration files if changed
Yu Watanabe [Thu, 31 May 2018 07:22:05 +0000 (16:22 +0900)]
locale: re-read configuration files if changed

Closes #8491.

6 years agolocale: use _cleanup_free_ and free_and_replace
Yu Watanabe [Tue, 29 May 2018 16:35:26 +0000 (01:35 +0900)]
locale: use _cleanup_free_ and free_and_replace

6 years agolocale: check xkb data before requesting authentication
Yu Watanabe [Tue, 29 May 2018 06:49:21 +0000 (15:49 +0900)]
locale: check xkb data before requesting authentication

6 years agolocale: return earlier if no operation will be done
Yu Watanabe [Thu, 31 May 2018 07:15:21 +0000 (16:15 +0900)]
locale: return earlier if no operation will be done

6 years agoload-fragment: use free_and_replace()
Yu Watanabe [Thu, 31 May 2018 04:27:06 +0000 (13:27 +0900)]
load-fragment: use free_and_replace()

6 years agoload-fragment: add missing oom check
Yu Watanabe [Thu, 31 May 2018 04:26:24 +0000 (13:26 +0900)]
load-fragment: add missing oom check

Fixes CID#1391379.

6 years agoportable: fix memleak
Yu Watanabe [Thu, 31 May 2018 04:16:47 +0000 (13:16 +0900)]
portable: fix memleak

Fixes CID#1391382.

6 years agocore/socket: fix coding style
Yu Watanabe [Tue, 29 May 2018 04:32:05 +0000 (13:32 +0900)]
core/socket: fix coding style

6 years agoload-fragment: move macro-defined config parsers
Yu Watanabe [Thu, 31 May 2018 02:04:52 +0000 (11:04 +0900)]
load-fragment: move macro-defined config parsers

6 years agoload-fragment: use DEFINE_CONFIG_PARSE_*() macros
Yu Watanabe [Tue, 29 May 2018 03:57:06 +0000 (12:57 +0900)]
load-fragment: use DEFINE_CONFIG_PARSE_*() macros

6 years agoload-fragment: make IPTOS= accept the empty string
Yu Watanabe [Tue, 29 May 2018 03:52:14 +0000 (12:52 +0900)]
load-fragment: make IPTOS= accept the empty string

6 years agoload-fragment: make SocketProtocol= accept the empty string
Yu Watanabe [Tue, 29 May 2018 03:49:47 +0000 (12:49 +0900)]
load-fragment: make SocketProtocol= accept the empty string

6 years agonamespace: rename parse_protect_{home,system}_or_bool() to protect_{home,system}_or_b...
Yu Watanabe [Tue, 29 May 2018 03:44:57 +0000 (12:44 +0900)]
namespace: rename parse_protect_{home,system}_or_bool() to protect_{home,system}_or_bool_to_string()

Hence, we can define config_parse_protect_{home,system}() by using
DEFINE_CONFIG_PARSE_ENUM() macro.

6 years agosocket-util: rename parse_socket_address_bind_ipv6_only_or_bool() to socket_address_b...
Yu Watanabe [Tue, 29 May 2018 03:40:28 +0000 (12:40 +0900)]
socket-util: rename parse_socket_address_bind_ipv6_only_or_bool() to socket_address_bind_ipv6_only_or_bool_from_string()

Hence, we can define config_parse_socket_bind() by using
DEFINE_CONFIG_PARSE_ENUM() macro.

6 years agoconf-parser: introduce DEFINE_CONFIG_PARSE*() macros
Yu Watanabe [Sat, 26 May 2018 16:39:12 +0000 (01:39 +0900)]
conf-parser: introduce DEFINE_CONFIG_PARSE*() macros

This introduces several macros for defining config parsers.
Also this fixes errno in DEFINE_CONFIG_PARSE_ENUM() and _ENUMV()
and makes the log level lower when a duplicated item is
specified to the settings parsed by the function defined by
DEFINE_CONFIG_PARSE_ENUMV().

6 years agoload-fragment: drop config_parse_no_new_privileges() and use config_parse_bool()...
Yu Watanabe [Fri, 25 May 2018 03:52:12 +0000 (12:52 +0900)]
load-fragment: drop config_parse_no_new_privileges() and use config_parse_bool() instead

6 years agoload-fragment: make WorkingDirectory= accept the empty string
Yu Watanabe [Fri, 25 May 2018 03:25:41 +0000 (12:25 +0900)]
load-fragment: make WorkingDirectory= accept the empty string

6 years agoload-fragment: use parse_sec_fix_0() instead of updating the value later
Yu Watanabe [Fri, 25 May 2018 03:17:52 +0000 (12:17 +0900)]
load-fragment: use parse_sec_fix_0() instead of updating the value later

6 years agoload-fragment: use config_parse_sec_fix_0() for TimeoutStopSec=
Yu Watanabe [Fri, 25 May 2018 03:16:24 +0000 (12:16 +0900)]
load-fragment: use config_parse_sec_fix_0() for TimeoutStopSec=

6 years agoload-fragment: always include config_parse_warn_compat() in the table used by unit_du...
Yu Watanabe [Fri, 25 May 2018 02:54:59 +0000 (11:54 +0900)]
load-fragment: always include config_parse_warn_compat() in the table used by unit_dump_config_items()

6 years agoload-fragment: drop unused function config_parse_sysv_priority()
Yu Watanabe [Fri, 25 May 2018 02:53:39 +0000 (11:53 +0900)]
load-fragment: drop unused function config_parse_sysv_priority()

6 years agoload-fragment: make CPUSchedulingPolicy= accept the empty string
Yu Watanabe [Fri, 25 May 2018 02:36:10 +0000 (11:36 +0900)]
load-fragment: make CPUSchedulingPolicy= accept the empty string

6 years agoload-fragment: make IOScheduling{Class,Priority}= accept the empty string
Yu Watanabe [Fri, 25 May 2018 02:25:43 +0000 (11:25 +0900)]
load-fragment: make IOScheduling{Class,Priority}= accept the empty string

6 years agoload-fragment: setting empty string to Nice= resets the previous assignments
Yu Watanabe [Fri, 25 May 2018 01:52:47 +0000 (10:52 +0900)]
load-fragment: setting empty string to Nice= resets the previous assignments

6 years agohwdb: consolidate multiple razer evdev sections
Jared Kazimir [Wed, 30 May 2018 15:30:09 +0000 (11:30 -0400)]
hwdb: consolidate multiple razer evdev sections

6 years agoMerge pull request #9132 from poettering/sd-bus-slot-set-floating
Lennart Poettering [Wed, 30 May 2018 22:58:41 +0000 (00:58 +0200)]
Merge pull request #9132 from poettering/sd-bus-slot-set-floating

make sure we don't leak bus slots when sd_bus_add_match_async() is used

6 years agoFix pattern to detect distribution
Sergio Lindo Mansilla [Fri, 18 May 2018 14:24:36 +0000 (16:24 +0200)]
Fix pattern to detect distribution

With operator '=', when in /etc/os-release:
ID_LIKE="opensuse suse" # Tumbleweed since at least 2018-04-24
or
ID_LIKE="suse opensuse" # Leap 15

6 years agosd-bus: make add match method callback slot "floating"
Lennart Poettering [Wed, 30 May 2018 14:35:36 +0000 (16:35 +0200)]
sd-bus: make add match method callback slot "floating"

When we allocate an asynchronous match object we will allocate an
asynchronous bus call object to install the match server side.
Previously the call slot would be created as regular slot, i.e.
non-floating which meant installing the match even if it was itself
floating would result in a non-floating slot to be created internally,
which ultimately would mean the sd_bus object would be referenced by it,
and thus never be freed.

Let's fix that by making the match method callback floating in any case
as we have no interest in leaving the bus allocated beyond the match
slot.

Fixes: #8551

6 years agobus-slot: for bus slot objects with no explicit description use the match string...
Lennart Poettering [Wed, 30 May 2018 14:34:06 +0000 (16:34 +0200)]
bus-slot: for bus slot objects with no explicit description use the match string as description

Let's make debugging a but easier with implicit descriptions for some
match objects.

6 years agoman: document the new sd_bus_slot_set_floating() call
Lennart Poettering [Wed, 30 May 2018 14:33:12 +0000 (16:33 +0200)]
man: document the new sd_bus_slot_set_floating() call

Also extend the memory management description of sd-bus highlighting the
effect of "floating" slot objects a bit.

6 years agosd-bus: add new sd_bus_slot_set_floating() call
Lennart Poettering [Wed, 30 May 2018 14:29:33 +0000 (16:29 +0200)]
sd-bus: add new sd_bus_slot_set_floating() call

This new call allows explicit control of the "floating" state of a bus
slot object. This is useful for creating a bus slot object first,
retaining a reference to it, using it for making changes to the slot
object (for example, set a description) and then handing it over to
sd-bus for lifecycle management.

It's also useful to fix #8551.

6 years agoman: fix minor typo
Lennart Poettering [Wed, 30 May 2018 14:28:28 +0000 (16:28 +0200)]
man: fix minor typo

6 years agotree-wide: make use of memory_startswith() at various places
Lennart Poettering [Wed, 30 May 2018 11:09:03 +0000 (13:09 +0200)]
tree-wide: make use of memory_startswith() at various places

6 years agostring-util: add new memory_startswith() helper
Lennart Poettering [Wed, 30 May 2018 11:07:37 +0000 (13:07 +0200)]
string-util: add new memory_startswith() helper

We have code like this at various placer, let's make things shorter and
more readable with a helper for it.

6 years agonetworkd: Add ability to set MULTICAST flag on interface
Susant Sahani [Tue, 29 May 2018 14:58:11 +0000 (20:28 +0530)]
networkd: Add ability to set MULTICAST flag on interface

Closes #9113

fix ARP toggling flag

6 years agopo: update French translation
Sylvain Plantefève [Tue, 29 May 2018 19:26:39 +0000 (21:26 +0200)]
po: update French translation

6 years agoMerge pull request #9120 from poettering/timedated-timezone-minifixes
Yu Watanabe [Wed, 30 May 2018 03:56:23 +0000 (12:56 +0900)]
Merge pull request #9120 from poettering/timedated-timezone-minifixes

Minor improvements to timedated

6 years agotree-wide: fix typo in comments and NEWS
Yu Watanabe [Tue, 29 May 2018 16:07:37 +0000 (01:07 +0900)]
tree-wide: fix typo in comments and NEWS

6 years agoman: recommend After= with Requisite=
Zbigniew Jędrzejewski-Szmek [Tue, 22 May 2018 10:19:27 +0000 (12:19 +0200)]
man: recommend After= with Requisite=

Fixes #8309.

6 years agojournal-file: avoid joining offline thread
Vito Caputo [Mon, 28 May 2018 22:09:55 +0000 (15:09 -0700)]
journal-file: avoid joining offline thread

In journal_file_set_online() the offline thread doesn't need to be
joined if it's been canceled before actually reaching the phase of
writing the offline state.

6 years agotimedated: add some debug logging when a number of kernel calls fail
Lennart Poettering [Tue, 29 May 2018 10:39:16 +0000 (12:39 +0200)]
timedated: add some debug logging when a number of kernel calls fail

6 years agotimedated: show the short timezone name when changing timezones in logs
Lennart Poettering [Tue, 29 May 2018 10:36:40 +0000 (12:36 +0200)]
timedated: show the short timezone name when changing timezones in logs

6 years agoconf-parser: add a bit more whitespace
Lennart Poettering [Mon, 28 May 2018 19:47:43 +0000 (21:47 +0200)]
conf-parser: add a bit more whitespace

We usually seperate case statements within a switch from each other by
empty lines. We also often add an empty line after multi-line function
prototypes, let's do so here too

Also, no trailing ; after }...

6 years agocore: drop deprecated (and ignored) configuration items from --dump-configuration...
Lennart Poettering [Mon, 28 May 2018 19:47:12 +0000 (21:47 +0200)]
core: drop deprecated (and ignored) configuration items from --dump-configuration-items output

6 years agoMerge pull request #9116 from poettering/tmpfiles-tmp-var-tmp
Zbigniew Jędrzejewski-Szmek [Tue, 29 May 2018 13:23:03 +0000 (15:23 +0200)]
Merge pull request #9116 from poettering/tmpfiles-tmp-var-tmp

add new specifiers %T and %V that expand to /tmp or /var/tmp or $TMP/$TMPDIR/$TEMP

6 years agoMerge pull request #9084 from yuwata/fix-8965
Zbigniew Jędrzejewski-Szmek [Tue, 29 May 2018 13:13:34 +0000 (15:13 +0200)]
Merge pull request #9084 from yuwata/fix-8965

core: make StateDirectory= or friends works with DynamicUser= and RootDirectory=/RootImage=

6 years agoupdate TODO
Lennart Poettering [Tue, 29 May 2018 09:40:49 +0000 (11:40 +0200)]
update TODO

6 years agoman: don't refer to "service manager" in tmpfiles.d(5)
Lennart Poettering [Tue, 29 May 2018 09:32:27 +0000 (11:32 +0200)]
man: don't refer to "service manager" in tmpfiles.d(5)

system-tmpfiles is not a "service manager" hence say "command" instead.

6 years agoresolved: reindent specifier table
Lennart Poettering [Tue, 29 May 2018 09:30:10 +0000 (11:30 +0200)]
resolved: reindent specifier table

6 years agocore: introduce specifiers for /tmp and /var/tmp
Lennart Poettering [Tue, 29 May 2018 09:25:26 +0000 (11:25 +0200)]
core: introduce specifiers for /tmp and /var/tmp

This corresponds nicely with the specifiers we already pass for
/var/lib, /var/cache, /run and so on.

This is particular useful to update the test-path service files to
operate without guessable files, thus allowing multiple parallel
test-path invocations to pass without issues (the idea is to set $TMPDIR
early on in the test to some private directory, and then only use the
new %T or %V specifier to refer to it).

6 years agoman: sort specifier list in systemd.unit(5) alphabetically
Lennart Poettering [Tue, 29 May 2018 09:13:40 +0000 (11:13 +0200)]
man: sort specifier list in systemd.unit(5) alphabetically

Usually, we order our settings in our unit files in a logical order,
grouping related settings together, and putting more relevant stuff
first, instead of following a strictly alphabetical order.

For specifiers I think it makes sense to follow an alphabetical order
however, since they literally are just characters, and hence I think the
concept of alphabetical ordering is much more commanding for them. Also,
since specifiers are usually not used in combination, but mostly used
indepdently of each other I think it's not that important to group
similar ones together.

No other changes except the reordering.

6 years agodoc: mention RestrictNamespaces= merges multiple assignment now
Yu Watanabe [Tue, 29 May 2018 06:11:35 +0000 (15:11 +0900)]
doc: mention RestrictNamespaces= merges multiple assignment now

Follow-up for #8817.

6 years agoMerge pull request #9103 from keszybz/more-tables-tests
Lennart Poettering [Mon, 28 May 2018 12:24:19 +0000 (14:24 +0200)]
Merge pull request #9103 from keszybz/more-tables-tests

More tables tests

6 years agoMerge pull request #9104 from keszybz/nspawn-umask
Lennart Poettering [Mon, 28 May 2018 12:24:00 +0000 (14:24 +0200)]
Merge pull request #9104 from keszybz/nspawn-umask

Nspawn umask

6 years agomeson: test out headers with more standard versions
Zbigniew Jędrzejewski-Szmek [Mon, 28 May 2018 07:07:36 +0000 (09:07 +0200)]
meson: test out headers with more standard versions

They all pass fine, but let's keep testing regularly.

6 years agoMerge pull request #9099 from yuwata/list-dbus-prop
Zbigniew Jędrzejewski-Szmek [Mon, 28 May 2018 09:42:02 +0000 (11:42 +0200)]
Merge pull request #9099 from yuwata/list-dbus-prop

completion: fixes for `systemctl status --property`

6 years agoman: use IMAGE for portable service image name
Yu Watanabe [Mon, 28 May 2018 09:16:32 +0000 (18:16 +0900)]
man: use IMAGE for portable service image name

6 years agobash-completion: add completion for portablectl
Yu Watanabe [Mon, 28 May 2018 06:38:19 +0000 (15:38 +0900)]
bash-completion: add completion for portablectl

6 years agobash-completion: also suggest template unit files
Yu Watanabe [Mon, 28 May 2018 05:57:00 +0000 (14:57 +0900)]
bash-completion: also suggest template unit files

Fixes #9041.

6 years agozsh-completion: suggest bus properties instead of configuration items for 'systemctl -p'
Zbigniew Jędrzejewski-Szmek [Mon, 28 May 2018 06:41:04 +0000 (08:41 +0200)]
zsh-completion: suggest bus properties instead of configuration items for 'systemctl -p'

6 years agobash-completion: suggest bus properties instead of configuration items for 'systemctl -p'
Yu Watanabe [Mon, 28 May 2018 05:19:16 +0000 (14:19 +0900)]
bash-completion: suggest bus properties instead of configuration items for 'systemctl -p'

Closes #5137.

6 years agocore: add --dump-bus-properties option to systemd
Yu Watanabe [Mon, 28 May 2018 09:13:19 +0000 (18:13 +0900)]
core: add --dump-bus-properties option to systemd

If systemd is invoked with this option, this dumps all bus properties.
This may be useful for shell completion for `systemctl --property`.

6 years agonspawn: reset umask early
Zbigniew Jędrzejewski-Szmek [Mon, 28 May 2018 09:01:30 +0000 (11:01 +0200)]
nspawn: reset umask early

Fixes #8911.

6 years agonspawn: remove some vertical whitespace
Zbigniew Jędrzejewski-Szmek [Mon, 28 May 2018 08:53:11 +0000 (10:53 +0200)]
nspawn: remove some vertical whitespace

Sometimes an empty line is good for readability, but here I think
they all can be removed without any loss.