1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 17:51:22 +03:00
Commit Graph

37806 Commits

Author SHA1 Message Date
Yu Watanabe
416b88013c systemctl: check triggering units only for stopped units
Fixes #11088.
2018-12-10 11:06:28 +01:00
Lennart Poettering
e0069f2eb4
Merge pull request #10999 from wkennington/static-neighbor-master
networkd: Static neighbor support
2018-12-10 11:04:14 +01:00
Zbigniew Jędrzejewski-Szmek
5fe7a0a7de basic/hostname-util: do truncation last when cleaning up
This allows more of the original name to be used if there are invalid
chars in the beginning.
2018-12-10 09:56:56 +01:00
Zbigniew Jędrzejewski-Szmek
d65652f1f2 Partially unify hostname_is_valid() and dns_name_is_valid()
This makes hostname_is_valid() apply the ldh checks too, rejecting more
hostnames.
2018-12-10 09:56:56 +01:00
Zbigniew Jędrzejewski-Szmek
7470cc4c73 resolve: reject host names with leading or trailing dashes in /etc/hosts
https://tools.ietf.org/html/rfc1035#section-2.3.1 says (approximately)
that only letters, numbers, and non-leading non-trailing dashes are allowed
(for entries with A/AAAA records). We set no restrictions.

hosts(5) says:
> Host names may contain only alphanumeric characters, minus signs ("-"), and
> periods (".").  They must begin with an alphabetic character and end with an
> alphanumeric character.

nss-files follows those rules, and will ignore names in /etc/hosts that do not
follow this rule.

Let's follow the documented rules for /etc/hosts. In particular, this makes us
consitent with nss-files, reducing surprises for the user.

I'm pretty sure we should apply stricter filtering to names received over DNS
and LLMNR and MDNS, but it's a bigger project, because the rules differ
depepending on which level the label appears (rules for top-level names are
stricter), and this patch takes the minimalistic approach and only changes
behaviour for /etc/hosts.

Escape syntax is also disallowed in /etc/hosts, even if the resulting character
would be allowed. Other tools that parse /etc/hosts do not support this, and
there is no need to use it because no allowed characters benefit from escaping.
2018-12-10 09:56:56 +01:00
Zbigniew Jędrzejewski-Szmek
bd00527779 resolved: rework parsing of /etc/hosts
Do not treat various errors (missing hostname, invalid address) as fatal,
just warn and continue. /etc/hosts is written by humans and we should not
reject the whole file just because a singly entry is not to our liking.

Handle comments as described in hosts(5):
everything from the comment character until the end of the line should be
ignored.

Fixes #10779.

Add tests.
2018-12-10 09:56:56 +01:00
Franck Bui
145b8d0f68 fs-util: make CHASE_WARN effective with CHASE_NO_AUTOFS
This has the side effect to upgrade the log level at which the log is emitted
from debug to warning.

This might be better since after all we didn't apply a tmpfiles.d/ rule and
that actually might end up being problematic eventually.
2018-12-10 09:22:28 +01:00
Franck Bui
b85ee2ec95 fs-util: rename safe_transition() into unsafe_transition()
We're always interested into finding unsafe transitions so let's make the
helper return true when it finds such transitions so we don't need to negate
its results.

No functional changes.
2018-12-10 09:19:14 +01:00
Franck Bui
7f0704da94 tmpfiles: use CHASE_WARN in addition to CHASE_SAFE
and let's emit a more comprehensive warning when an unsafe transition is
encountered.

Before this patch:

 Unsafe symlinks encountered in /run/nrpe, refusing.

After:

 Detected unsafe path transition / → /run during canonicalization of /run/nrpe.
2018-12-10 09:19:14 +01:00
Franck Bui
36c97decbe fs-util: make chase_symlink() returns -ENOLINK when unsafe transitions are met
We previously returned -EPERM but it can be returned for various other reasons
too.

Let's use -ENOLINK instead as this value shouldn't be used currently. This
allows users of CHASE_SAFE to detect without any ambiguities when unsafe
transitions are encountered by chase_symlinks().

All current users of CHASE_SAFE that explicitly reacted on -EPERM have been
converted to react on -ENOLINK.
2018-12-10 09:18:27 +01:00
William A. Kennington III
e4a71bf36f networkd: Static neighbor support
When using networkd we currently have no way of ensuring that static
neighbor entries are set when our link comes up. This change adds a new
section to the network definition that allows multiple static neighbors
to be set on a link.
2018-12-09 16:56:37 -08:00
William A. Kennington III
289e6774d0 networkd: Use only a generic CONFIGURING state
This allows us to convey that we are performing multiple link
configuration changes in parallel. This is needed to support configuring
neighbors while simultaneously configuring addresses and routes.
2018-12-09 16:56:00 -08:00
William A. Kennington III
c42ff3a1a7 networkd: Track address configuration
This will be useful to assert that our static route configuration always
happens after address configuration once our individual configure state
goes away.
2018-12-09 16:54:37 -08:00
Yu Watanabe
d8a0bcfd77 tree-wide: drop header for emacs from python scripts 2018-12-10 03:17:33 +09:00
Yu Watanabe
87421ff560 tools: add one more SPDX license header 2018-12-10 03:08:52 +09:00
Yu Watanabe
fc1c09e1df lgtm: use python3 2018-12-10 03:07:17 +09:00
Yu Watanabe
2f6c9b6f3f tools: drop unused variable 2018-12-10 03:07:08 +09:00
Yu Watanabe
af182e786c hwdb: drop unused imported object 2018-12-10 03:06:58 +09:00
Yu Watanabe
a9f2655dbe hwdb: drop comment 2018-12-10 03:06:44 +09:00
Alexey Bogdanenko
1e5548c0e0 udev-test: fix missing directory test/run
Fixes the following error:

    Failed to mount test /run: No such file or directory

By the time command "./test-udev check" calls function "fake_filesystems",
directory "test/run" must be present.
2018-12-09 20:53:11 +03:00
Alexey Bogdanenko
7935dae547 udev-test: fix test skip condition
When there is a failure to setup the environment, the following happens:

1. Command "./test-udev check" exits with non-zero code.
2. Perl function "system" returns the code.
3. The code is evaluated as true by Perl.

Then we stop the test.
2018-12-09 19:22:47 +03:00
Evgeny Vereshchagin
a01eb97b6c
Merge pull request #11095 from evverx/use-systemd-as-pid1-yolo
travis: use systemd as PID1 in debian containers
2018-12-09 16:53:03 +03:00
Zbigniew Jędrzejewski-Szmek
6e076600d0
Merge pull request #10931 from yuwata/daemon-util
sd-daemon: add notify_on_cleanup() helper function and use it where applicable
2018-12-09 12:10:57 +01:00
Zbigniew Jędrzejewski-Szmek
503a1bd37f
Merge pull request #11097 from jwrdegoede/hwdb-sensors5
Hwdb sensors5
2018-12-09 11:50:39 +01:00
Evgeny Vereshchagin
f413cd0a6a travis: mount tmpfs on /tmp before running the tests
To judge from https://api.travis-ci.org/v3/job/465547774/log.txt,
overlayfs on Travis CI is having trouble delivering inotify events,
which is why `test-path` and `test-event` are failing there.
2018-12-09 11:46:23 +01:00
Evgeny Vereshchagin
ee6776b41a travis: use systemd as PID1 in debian containers
Turns out some tests like `test-execute` are tightly coupled with
systemd as PID1 (which should be fixed of course). In the meantime,
let's see how it goes.
2018-12-09 11:31:01 +01:00
Lennart Poettering
be24321f3d mount-point: honour AT_SYMLINK_FOLLOW correctly
Fixes: #11092
2018-12-08 22:43:55 +01:00
Hans de Goede
84e8548313 hwdb: Add accelerometer orientation quirk for the PoV P1005W-232 tablet
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2018-12-08 22:11:39 +01:00
Hans de Goede
76efe240b8 hwdb: Add accelerometer orientation quirk for the Prowise PT301 tablet 2018-12-08 22:11:39 +01:00
Zbigniew Jędrzejewski-Szmek
c90ee83400 coding style: reduce text width to 109 characters
Patches are shown on github with a fixed width (no matter how wide the window
is). When line numbers are high (we have some files with 5 digit line numbers),
the diff does not fit, and horizontal scrolling must be used when viewing the
patch. This is super annoying. Let's reduce the width a bit. I think 109 is
still very wide, but at least the github issue should be alleviated.
2018-12-08 10:14:28 +01:00
Yu Watanabe
d8dd35fd31 journal-remote: define main through macro
Also, this fixes memleaks on failure.
2018-12-08 18:09:40 +09:00
Yu Watanabe
94952201e1 journal-remote: destroy RemoteServer object by using _cleanup_ attribute 2018-12-08 18:09:40 +09:00
Yu Watanabe
f36bb1e182 journal-upload: define main through macro 2018-12-08 18:09:40 +09:00
Yu Watanabe
c9ed608679 journal-upload: use _cleanup_ attribute to clear uploader 2018-12-08 18:09:40 +09:00
Yu Watanabe
29cd4c8ffb journal-gateway: define main through macro 2018-12-08 18:09:40 +09:00
Yu Watanabe
0d2a1a2085 journal-gateway: use _cleanup_ attribute to stop microhttpd daemon 2018-12-08 18:09:40 +09:00
Yu Watanabe
c03a80c419 wait-online: define main through macro 2018-12-08 18:09:40 +09:00
Yu Watanabe
82310c7981 timesync: define main through macro 2018-12-08 18:09:40 +09:00
Yu Watanabe
2362a8f547 network: define main through macro 2018-12-08 18:09:40 +09:00
Yu Watanabe
1e88b8199b resolve: define main through macro 2018-12-08 18:09:40 +09:00
Yu Watanabe
c157884f09 sd-daemon: add notify_start() and notify_on_cleanup() helper function 2018-12-08 18:09:25 +09:00
Yu Watanabe
1437822638 meson: rename sd_event_c to sd_event_sources 2018-12-08 18:06:45 +09:00
Lennart Poettering
99b5b0d0ef
Merge pull request #11055 from poettering/resolved-close-fix
a number of resolved fixes
2018-12-08 00:23:43 +01:00
Lennart Poettering
e474bf118c
Merge pull request #10980 from poettering/mount-no-extras
mount and swap improvements
2018-12-08 00:23:15 +01:00
Lennart Poettering
06721f39f6 swap: always add in extras when we load a swap unit
Much like for the mount units we need fields such as the slice
initialized by the time we activate the swap, hence when the kernel
let's us know about a new swap that appeared we need to initialize the
slice in any Swap object we allocated for that right-away, even if we
can't read the real unit file for the swap device.
2018-12-07 17:35:32 +01:00
Lennart Poettering
a0a424083f swap: drop return value
We don't actually return any valid 'r' here, let's explicitly return 0
here hence instead.
2018-12-07 17:35:32 +01:00
Lennart Poettering
eb04385dc5 swap: don't propagate issues with processing /proc/swaps
This follows similar recent changes in mount.c: error should be consider
local, and not be propagated.
2018-12-07 17:35:32 +01:00
Lennart Poettering
46f944802c swap: when loading a unit from /proc/swaps, mark its load state as good
This follows similar logic in the mount unit.
2018-12-07 17:35:32 +01:00
Lennart Poettering
15332d738f swap: split out code adding in additional unit props into a function of its own
This adds swap_add_extras() similar to mount_add_extras().

No change in behaviour, just some refactoring.
2018-12-07 17:35:32 +01:00
Lennart Poettering
ba6fbb2cee swap: fix misplaced comment 2018-12-07 17:35:32 +01:00