1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 19:21:53 +03:00
Commit Graph

24932 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
d09139e187 test-hashmap: fix undefined behaviour on string constants
The test was failing at -O2+ with gcc 5.3 and 6.0.
"val1" == "val1" and "val1" != "val1" are both valid.
http://stackoverflow.com/questions/4843640/why-is-a-a-in-c
2016-02-18 19:39:10 -05:00
Zbigniew Jędrzejewski-Szmek
06466a7f03 journal/catalog: fix memory leaks
Various buffers were lost because finish_item() either consumed
the buffer or allocated a new one (if an entry with the same key existed).
The caller would simply forget the buffer in either case.

Also add a check for the case when a valid identifier is followed by
an empty body. We should not allow this.

Also be more consistent in error handling and always print an error
message.
2016-02-18 19:39:09 -05:00
Zbigniew Jędrzejewski-Szmek
82501b3fc4 basic/strbuf: do not call bsearch with a null argument
Das ist verboten!

src/basic/strbuf.c:162:23: runtime error: null pointer passed as argument 2,
                           which is declared to never be null
2016-02-18 19:39:09 -05:00
Zbigniew Jędrzejewski-Szmek
48ddca5f35 Merge pull request #2644 from 0xAX/check-alloc-overflow-macro
alloc-util: extract overflow check into inline function
2016-02-18 15:32:22 -05:00
Alexander Kuleshov
dbacacaaea alloc-util: cleanups
This patch contains a set of little cleanups for alloc-util.h:

1. The malloc_multiply(), realloc_multiply() and memdup_multiply()
functions check allocation related parameters on overflow. Let's
move them to the separate size_multiply_overflow() function for
simplicity, code duplication prevention and possible reuse in future.

2. use SIZE_MAX from stdlib instead of ((size_t) - 1) to be more
clear.

3. The 'a'/'b' variables are renamed to 'size' and 'need' to be
more clear.'
2016-02-19 01:36:46 +06:00
Martin Pitt
2150e62287 Merge pull request #2621 from keszybz/wheel-group
build-sys: allow wheel group name to be specified
2016-02-18 19:20:14 +01:00
Zbigniew Jędrzejewski-Szmek
57156d9507 Merge pull request #2646 from evverx/fix-2637
Fix #2637 (doubled specifier expansion in ExecStart=)
2016-02-18 10:24:16 -05:00
Martin Pitt
04af5d645e Merge pull request #2653 from keszybz/test-dns-domain
build-sys: remove duplicated entry in tests
2016-02-18 16:11:03 +01:00
Zbigniew Jędrzejewski-Szmek
43a90c32c2 build-sys: remove duplicated entry in tests
test-dns-domain should be built and run even without ENABLE_RESOLVED.
2016-02-18 08:30:18 -05:00
Evgeny Vereshchagin
bd1b973fb3 core: revert "core: resolve specifier in config_parse_exec()"
This reverts commit cb48dfca6a.

Exec*-settings resolve specifiers twice:
%%U -> config_parse_exec [cb48dfca6a] -> %U -> service_spawn -> 0

Fixes #2637
2016-02-18 11:55:53 +00:00
Martin Pitt
8ac0402c06 Merge pull request #2652 from filbranden/testsresolved1
Do not build tests that depend on resolved when it has been disabled
2016-02-18 10:33:39 +01:00
Filipe Brandenburger
e49a8dcc29 build-sys: Do not build tests that depend on resolved when it has been disabled
If ./configure --disable-resolved has been used, do not try to build
test-dns-packet and test-resolve-tables which depend on it.

Previously, the SOURCES, LIBS and LDADDs for these tests were made conditional
while the main rules for them weren't, causing build failures trying to build a
binary with no sources.

This was uncovered when trying to build udeb for systemd in CI, which uses
--disable-resolved for a minimal build, which uncovered the issue.

Fixes #2651.
2016-02-18 00:39:38 -08:00
Zbigniew Jędrzejewski-Szmek
2a998ffa1e build-sys: allow references to wheel group to be omitted
https://github.com/systemd/systemd/issues/2492
2016-02-17 23:47:23 -05:00
Evgeny Vereshchagin
252549990f tests: add test for https://github.com/systemd/systemd/issues/2637
+ perl -e 'exit(!(qq{0} eq qq{\x25U}))'
exec-spec-interpolation.service: Main process exited, code=exited, status=1/FAILURE
exec-spec-interpolation.service: Unit entered failed state.
exec-spec-interpolation.service: Failed with result 'exit-code'.
        PID: 11270
        Start Timestamp: Wed 2016-02-17 22:21:31 UTC
        Exit Timestamp: Wed 2016-02-17 22:21:31 UTC
        Exit Code: exited
        Exit Status: 1
Assertion 'service->main_exec_status.status == status_expected' failed at src/test/test-execute.c:65, function check(). Aborting.
2016-02-17 22:40:26 +00:00
Lennart Poettering
5031c4e21b Merge pull request #2640 from keszybz/dnssec-work-3
resolve: dumping of binary packets
2016-02-17 12:45:31 +01:00
Zbigniew Jędrzejewski-Szmek
5259c0559c test-resolve-tables: verify that dns type/class length is within limits
DNS_TYPE_STRING_MAX causes a problem with the table autogeneration code,
change to _DNS_TYPE_STRING_MAX.
2016-02-16 19:55:51 -05:00
Zbigniew Jędrzejewski-Szmek
202b76ae1a Use provided buffer in dns_resource_key_to_string
When the buffer is allocated on the stack we do not have to check for
failure everywhere. This is especially useful in debug statements, because
we can put dns_resource_key_to_string() call in the debug statement, and
we do not need a seperate if (log_level >= LOG_DEBUG) for the conversion.

dns_resource_key_to_string() is changed not to provide any whitespace
padding. Most callers were stripping the whitespace with strstrip(),
and it did not look to well anyway. systemd-resolve output is not column
aligned anymore.

The result of the conversion is not stored in DnsTransaction object
anymore. It is used only for debugging, so it seems fine to generate it
when needed.

Various debug statements are extended to provide more information.
2016-02-16 19:55:51 -05:00
Zbigniew Jędrzejewski-Szmek
1c02e7ba55 Replace DNS_RESOURCE_KEY_NAME with a version which always returns "." for root
This fixes formatting of root domain in debug messages:
Old:
systemd-resolved[10049]: Requesting DS to validate transaction 19313 (., DNSKEY with key tag: 19036).
New:
systemd-resolved[10049]: Requesting DS to validate transaction 19313 (, DNSKEY with key tag: 19036).
2016-02-16 19:55:51 -05:00
Zbigniew Jędrzejewski-Szmek
c690b20a85 systemd-resolved: split out inner loop
With two nested loops and a switch statements, it's quite hard to
understand what break and continue mean.
2016-02-16 19:55:51 -05:00
Zbigniew Jędrzejewski-Szmek
dab48ea63a systemd-resolve: allow whole packets to be dumped in binary form 2016-02-16 19:55:50 -05:00
Zbigniew Jędrzejewski-Szmek
2e74028a5c systemd-resolve: allow keys to be dumped in binary form
$ systemd-resolve --raw --openpgp zbyszek@fedoraproject.org | pgpdump /dev/stdin
2016-02-16 19:24:07 -05:00
Zbigniew Jędrzejewski-Szmek
1ace2438c6 systemd-resolve: reword --help output
The output didn't specify if the default for --cname/--search/--legend and
other options was yes or no. Change the description to be explicit about that.

Also make the --help output and man page closer.
2016-02-16 19:10:25 -05:00
Zbigniew Jędrzejewski-Szmek
edb4843fbd man: show output in example systemd-resolve commands
I think example output allows the reader of the man page to
see what functionlity is provided without running the commands
themselves. Specific values in the examples are bound to get out
of date but this is not a problem.
2016-02-16 19:10:25 -05:00
Zbigniew Jędrzejewski-Szmek
2c45295e47 Merge pull request #2623 from poettering/networkd-fixes
Networkd, resolved, build-sys fixes
2016-02-16 18:36:42 -05:00
Lennart Poettering
12343facf3 Merge pull request #2626 from poettering/fionread-fix
networkd: FIONREAD is not reliable on some sockets
2016-02-16 23:53:44 +01:00
Lennart Poettering
bd8b65996c Merge pull request #2636 from 0xAX/not-edit-errno-manually
main: no need to set errno manually
2016-02-16 20:22:07 +01:00
Lennart Poettering
c77d26122a resolved: make sure to normalize all domain names returned via the bus
Most domain names we deal with are normalized anyway (since we read them that
way from DNS packets), but some might not (because they are synthesized from
unnormalized configuration or so), hence make sure to normalize all names
before passing them out to clients, to be fully deterministic.

Note that internally we are process normalized and non-normalized names the
same way, and while comparing them ignore the differences due to unnormalized
names. However, that internal implementation detail really shouldn't spill out
the clients, hence make sure to clean it all up.
2016-02-16 15:30:04 +01:00
Lennart Poettering
6d2353394f udev: fix cg_unified() return code checking
Fixes fall-out from 8b3aa503c1.

Fixes: #2635
2016-02-16 15:30:04 +01:00
Lennart Poettering
3f51aec864 core: fix assertion check
Fixes: #2632
2016-02-16 15:30:04 +01:00
Lennart Poettering
41815a4aa6 resolve: print a noisy warning if we show crypto keys that could not be authenticated
Doing DNS retrieval on non-authenticated crypt keys is useless, hence warn
loudly about it.
2016-02-16 15:30:03 +01:00
Lennart Poettering
9dc907f9c9 networkd: rework idle detection logic of networkd
This patch makes networkd stay around as long as there is more than just a
loopback interface around, or the loopback device isn't fully probed yet, or
the loopback device has a .network file attached.

In essence, this means networkd stays around now continously as it should,
unless it is running in some (container?) environment that really has no
interface except a loopback device.

Fixes #2577.
2016-02-16 15:22:06 +01:00
Lennart Poettering
de08570050 build-sys: fix type detection
Before this patch existence of char16_t, char32_t, key_serial_t was checked
with AC_CHECK_DECLS() which doesn't actually work for types. Correct this to
use AC_CHECK_TYPES() instead.

Also, while we are at it, change the check for memfd_create() to use
AC_CHECK_DECLS() instead of AC_CHECK_FUNCS(). This is a better choice, since a
couple of syscalls are defined by glibc but not exported in the header files
(pivot_root() for example), and we hence should probably be more picky with
memfd_create() too, which glibc might decide to expose one day, but not
necessarily in the headers too.
2016-02-16 15:22:06 +01:00
Lennart Poettering
61ecb465b1 resolved: turn on DNSSEC by default, unless configured otherwise
Let's make sure DNSSEC gets more testing, by defaulting DNSSEC to
"allow-downgrade" mode. Since distros should probably not ship DNSSEC enabled
by default add a configure switch to disable this again.

DNSSEC in "allow-downgrade" mode should mostly work without affecting user
experience. There's one exception: some captive portal systems rewrite DNS in
order to redirect HTTP traffic to the captive portal. If these systems
implement DNS servers that are otherwise DNSSEC-capable (which in fact is
pretty unlikely, but still...), then this will result in the captive portal
being inaccessible. To fix this support in NetworkManager (or any other network
management solution that does captive portal detection) is required, which
simply turns off DNSSEC during the captive portal detection, and resets it back
to the default (i.e. on) after captive portal authentication is complete.
2016-02-16 15:22:05 +01:00
Alexander Kuleshov
b9f65a60c2 main: no need to set errno manually
If we are not PID 1 and started as init, we executing systemctl
with execv(). Here no need to set errno manually, because in a
failure case, because the execv() anyway will set errno depends
on a error.
2016-02-16 18:56:15 +06:00
Lennart Poettering
d477bc35b0 Merge pull request #2630 from keszybz/systemctl-m-h
systemctl: fix style to avoid modification of array passed by caller
2016-02-16 13:21:14 +01:00
Lennart Poettering
4edc2c9b6b networkd: FIONREAD is not reliable on some sockets
Fixes: #2457
2016-02-16 13:06:55 +01:00
Zbigniew Jędrzejewski-Szmek
c11bda1e3c systemctl: fix style to avoid modification of array passed by caller
Followup for 4524439edb.
2016-02-15 19:06:53 -05:00
Lennart Poettering
6043679c6e Merge pull request #2628 from benjarobin/fix-pull-req-2611
time-util: Rename and fix call of deserialize_timestamp_value()
2016-02-16 00:05:20 +01:00
Benjamin Robin
b895a7353b time-util: Rename and fix call of deserialize_timestamp_value()
The deserialize_timestamp_value() is renamed timestamp_deserialize() to be more
consistent with dual_timestamp_deserialize()
And add the NULL check back on realtime and monotonic
2016-02-15 23:26:34 +01:00
Lennart Poettering
a6b8530aec Merge pull request #2622 from keszybz/systemctl-m-h
systemctl: include -M or -H arguments in the hint
2016-02-15 23:07:24 +01:00
Zbigniew Jędrzejewski-Szmek
4524439edb systemctl: include -M or -H arguments in the hint
https://github.com/systemd/systemd/issues/2431

Some newlines are added, but the output will still exceed 80 columns in many
cases. The fallback for oom conditions is changed from "n/a" to something
"<service>", and a similar pattern is used for the new code. This way we
have a realistic fallback for oom, which seems nicer than making the whole
function return an error code which would then have to be propagated.

$ systemctl -M fedora-rawhide restart systemd-networkd.service
Job for systemd-networkd.service failed because start of the service was attempted too often.
See "systemctl -M fedora-rawhide status systemd-networkd.service" and "journalctl -M fedora-rawhide -xe" for details.
To force a start use "systemctl -M fedora-rawhide reset-failed systemd-networkd.service"
followed by "systemctl -M fedora-rawhide start systemd-networkd.service" again.
2016-02-15 15:23:45 -05:00
Lennart Poettering
11ab173d40 Merge pull request #2611 from 0xAX/deserialize-clkid
time-util: introduce deserialize_timestamp_value()
2016-02-15 20:29:59 +01:00
Alexander Kuleshov
d4c6cc937c logind: use deserialize_timestamp_value()
which is introduced in the ebf30a086d commit.
2016-02-16 00:04:49 +06:00
Alexander Kuleshov
8e1afa0a5d machine: use deserialize_timestamp_value()
which is introduced in the ebf30a086d commit.
2016-02-16 00:04:09 +06:00
Alexander Kuleshov
ebf30a086d time-util: introduce deserialize_timestamp_value()
The time-util.c provides dual_timestamp_deserialize() function to
convert value to usec_t and set it as value of ts->monotonic and
ts->realtime.

There are some places in code which do the same but only for one
clockid_t (realtime or monotonic), when dual_timestamp_deserialize()
sets value of both.

This patch introduces the deserialize_timestamp_value() which converts
 a given value to usec_t and write it to a given timestamp.
2016-02-16 00:01:44 +06:00
Daniel Mack
251b4cb6a2 Merge pull request #2620 from bengal/assert-sd-event-now
dhcp: assert the success of sd_event_now()
2016-02-15 16:50:55 +01:00
Beniamino Galvani
8ecdcb5525 dhcp: assert the success of sd_event_now()
The function must never fail.
2016-02-15 16:20:55 +01:00
Lennart Poettering
8eff97a103 Merge pull request #2618 from zonque/busproxy-removal
remove bus-proxyd
2016-02-15 14:54:09 +01:00
Lennart Poettering
4d5d9d0011 Merge pull request #2596 from keszybz/move-activate-to-bin
Move activate to bin, extend --fdnames functionality
2016-02-15 14:08:28 +01:00
Daniel Mack
3aa3d5d412 Merge pull request #2617 from rabinv/master
missing.h: define IFLA_EXT_MASK
2016-02-15 11:11:19 +01:00