platform/upstream/systemd.git
7 years agoresolved: count the number of addresses per link
Lennart Poettering [Mon, 13 Feb 2017 19:41:09 +0000 (20:41 +0100)]
resolved: count the number of addresses per link

This becomes handy later on. Moreover, we keep track of similar counters
for other objects like this too, hence adding this here too is obvious.

7 years agoresolved: don't return ANY transactions when looking for transactions
Lennart Poettering [Mon, 13 Feb 2017 19:34:39 +0000 (20:34 +0100)]
resolved: don't return ANY transactions when looking for transactions

This reverts a part of 53fda2bb933694c9bdb1bbf1f5583e39673b74b2:

On classic DNS and LLMNR ANY requests may be replied to with any kind of
RR, and the reply does not have to be comprehensive: these protocols
simply define that if there's an RRset that can answer the question,
then at least one should be sent as reply, but not necessarily all. This
means it's not safe to "merge" transactions for arbitrary RR types into
ANY requests, as the reply might not answer the specific question.

As the merging is primarily an optimization, let's undo this for now.
This logic may be readded later, in a way that only applies to mDNS.

Also, there's an OOM problem with this chunk: dns_resource_key_new()
might fail due to OOM and this is not handled. (This is easily removed
though, by using DNS_RESOURCE_KEY_CONST()).

7 years agoMerge pull request #5331 from namhyung/coredump-reverse
Djalal Harouni [Mon, 13 Feb 2017 18:25:13 +0000 (19:25 +0100)]
Merge pull request #5331 from namhyung/coredump-reverse

Add -r/--reverse option to coredumpctl

7 years agoMerge pull request #5319 from keszybz/test-execute
Lennart Poettering [Mon, 13 Feb 2017 14:29:40 +0000 (15:29 +0100)]
Merge pull request #5319 from keszybz/test-execute

test-execute without capsh

7 years agoMerge pull request #5320 from jwrdegoede/cube-iwork8-air
Lennart Poettering [Mon, 13 Feb 2017 14:00:10 +0000 (15:00 +0100)]
Merge pull request #5320 from jwrdegoede/cube-iwork8-air

Extended evdev keyboard match rule + cube iwork8 air keymap fixup hwdb entry

7 years agocoredumpctl: Add -r/--reverse option
Namhyung Kim [Mon, 13 Feb 2017 13:55:25 +0000 (22:55 +0900)]
coredumpctl: Add -r/--reverse option

Like journalctl, users sometimes want to see coredump list in reverse
order.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
7 years agocoredumpctl: Remove dubious newline in the help message
Namhyung Kim [Mon, 13 Feb 2017 13:35:37 +0000 (22:35 +0900)]
coredumpctl: Remove dubious newline in the help message

It seems the -o opiton and -D option can be printed together.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
7 years agoMerge pull request #5322 from keszybz/silence-gcc-warning
Martin Pitt [Mon, 13 Feb 2017 07:58:57 +0000 (08:58 +0100)]
Merge pull request #5322 from keszybz/silence-gcc-warning

Silence gcc warnings

7 years agoMerge pull request #4832 from rojkov/mdns
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 20:38:51 +0000 (15:38 -0500)]
Merge pull request #4832 from rojkov/mdns

7 years agoseccomp: disable RestrictAddressFamilies= for the ABI we shall block, not the one...
Lennart Poettering [Sun, 12 Feb 2017 20:25:40 +0000 (21:25 +0100)]
seccomp: disable RestrictAddressFamilies= for the ABI we shall block, not the one we are compiled for (#5272)

It's a difference. Not a big one, but let's be correct here.

7 years agoman: busctl: improve capture description (#5321)
Lucas Werkmeister [Sun, 12 Feb 2017 20:20:08 +0000 (21:20 +0100)]
man: busctl: improve capture description (#5321)

7 years agoMerge pull request #5276 from poettering/resolved-cname
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 20:08:19 +0000 (15:08 -0500)]
Merge pull request #5276 from poettering/resolved-cname

a good number of resolved fixes

7 years agocore/dbus: silence gcc warning about unitialized variable
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 18:22:18 +0000 (13:22 -0500)]
core/dbus: silence gcc warning about unitialized variable

src/core/dbus.c: In function 'find_unit':
src/core/dbus.c:334:15: warning: 'u' may be used uninitialized in this function [-Wmaybe-uninitialized]
         *unit = u;
               ^
src/core/dbus.c:301:15: note: 'u' was declared here
         Unit *u;
               ^

7 years agocore/manager: silence gcc warning about unitialized variable
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 17:56:40 +0000 (12:56 -0500)]
core/manager: silence gcc warning about unitialized variable

At -O3, this was printed a hundred times for various callers of
manager_add_job_by_name(). AFAICT, there is no error and `unit` is always
intialized. Nevertheless, add explicit initialization to silence the noise.

src/core/manager.c: In function 'manager_start_target':
src/core/manager.c:1413:16: warning: 'unit' may be used uninitialized in this function [-Wmaybe-uninitialized]
         return manager_add_job(m, type, unit, mode, e, ret);
                ^
src/core/manager.c:1401:15: note: 'unit' was declared here
         Unit *unit;
               ^

7 years agocore/manager: make manager_load_unit*() functions always take output arg
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 17:40:09 +0000 (12:40 -0500)]
core/manager: make manager_load_unit*() functions always take output arg

We were inconsistent, manager_load_unit_prepare() would crash if _ret was ever NULL.
But none of the callers use NULL. So simplify things and require it to be non-NULL.

7 years agohwdb: Cube iwork8 air button keymap fixup
Hans de Goede [Sun, 12 Feb 2017 11:45:21 +0000 (12:45 +0100)]
hwdb: Cube iwork8 air button keymap fixup

The home and power buttons on the Cube iwork8 air tablet are swapped,
add a hwdb entry fixing this up.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
7 years agorules: Add extended evdev/input match rules for event nodes with the same name
Hans de Goede [Sun, 12 Feb 2017 11:33:22 +0000 (12:33 +0100)]
rules: Add extended evdev/input match rules for event nodes with the same name

Sometimes a system may have 2 input event nodes with the same name where
we only want to apply keyboard hwdb rules to 1 of the 2 devices.

This problem happens e.g. on devices where the soc_button_array driver is
used (e.g. intel atom based tablets) which registers 2 event nodes with
the name "gpio-keys".

This commit adds a new extended match rule which extends the match to also
check $attr{phys} and $attr{capabilities/ev}, allowing to differentiate
between devices with an identical name.

Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
7 years agocore: skip ReadOnlyPaths= and other permission-related mounts on PermissionsStartOnly...
Lennart Poettering [Sun, 12 Feb 2017 05:44:46 +0000 (06:44 +0100)]
core: skip ReadOnlyPaths= and other permission-related mounts on PermissionsStartOnly= (#5309)

ReadOnlyPaths=, ProtectHome=, InaccessiblePaths= and ProtectSystem= are
about restricting access and little more, hence they should be disabled
if PermissionsStartOnly= is used or ExecStart= lines are prefixed with a
"+". Do that.

(Note that we will still create namespaces and stuff, since that's about
a lot more than just permissions. We'll simply disable the effect of
the four options mentioned above, but nothing else mount related.)

This also adds a test for this, to ensure this works as intended.

No documentation updates, as the documentation are already vague enough
to support the new behaviour ("If true, the permission-related execution
options…"). We could clarify this further, but I think we might want to
extend the switches' behaviour a bit more in future, hence leave it at
this for now.

Fixes: #5308

7 years agocalendarspec: fix duplicate detection (#5310)
Doug Christman [Sun, 12 Feb 2017 05:39:17 +0000 (00:39 -0500)]
calendarspec: fix duplicate detection (#5310)

a2eb5ea79c added a new field to `CalendarComponent`; update
`normalize_chain` to compare all fields when dropping duplicates

7 years agoshared: pass *unsigned_long to namespace_flag_from_string_many (#5315)
Evgeny Vereshchagin [Sun, 12 Feb 2017 05:38:16 +0000 (08:38 +0300)]
shared: pass *unsigned_long to namespace_flag_from_string_many (#5315)

Fixes:
```
src/shared/bus-unit-util.c: In function ‘bus_append_unit_property_assignment’:
src/shared/bus-unit-util.c:570:65: warning: passing argument 2 of ‘namespace_flag_from_string_many’ from incompatible pointer type [-Wincompatible-pointer-types]
                         r = namespace_flag_from_string_many(eq, &flags);
                                                                 ^
In file included from src/shared/bus-unit-util.c:31:0:
src/shared/nsflags.h:41:5: note: expected ‘long unsigned int *’ but argument is of type ‘uint64_t * {aka long long unsigned int *}’
 int namespace_flag_from_string_many(const char *name, unsigned long *ret);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Closes #5312

7 years agoshared: convert unsigned long to uint64_t explicitly (#5314)
Evgeny Vereshchagin [Sun, 12 Feb 2017 05:36:34 +0000 (08:36 +0300)]
shared: convert unsigned long to uint64_t explicitly (#5314)

Closes #5313

7 years agoMerge pull request #5303 from poettering/deleted-units
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 05:31:39 +0000 (00:31 -0500)]
Merge pull request #5303 from poettering/deleted-units

a small number of install and unit management related fixes

7 years agoIt's now ok to use Google NTP servers (#5311)
Michael Shields [Sun, 12 Feb 2017 05:30:40 +0000 (21:30 -0800)]
It's now ok to use Google NTP servers (#5311)

7 years agoman: systemd.journal-fields: document _SYSTEMD_INVOCATION_ID (#5316)
Lucas Werkmeister [Sun, 12 Feb 2017 05:27:58 +0000 (06:27 +0100)]
man: systemd.journal-fields: document _SYSTEMD_INVOCATION_ID (#5316)

#4067 added documentation to systemd.exec(5), but not systemd.journal-fields(7).

7 years agotest-execute: use __func__ to shorten messages
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 05:26:00 +0000 (00:26 -0500)]
test-execute: use __func__ to shorten messages

7 years agoREADME: document capsh's usefulness
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 05:22:20 +0000 (00:22 -0500)]
README: document capsh's usefulness

7 years agotest-execute: detect missing capsh in all tests
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 05:21:02 +0000 (00:21 -0500)]
test-execute: detect missing capsh in all tests

Fixes #5273.

7 years agoMerge pull request #5250 from ddstreet/test-sys-nodes-script
Zbigniew Jędrzejewski-Szmek [Sat, 11 Feb 2017 00:52:58 +0000 (19:52 -0500)]
Merge pull request #5250 from ddstreet/test-sys-nodes-script

replace test/sys.tar.xz with script to create test/sys/ contents

7 years agonetworkd: add IPv6ProxyNDPAddress support (#5174)
Florian Klink [Fri, 10 Feb 2017 23:47:55 +0000 (00:47 +0100)]
networkd: add IPv6ProxyNDPAddress support (#5174)

IPv6 Neighbor discovery proxy is the IPv6 equivalent to proxy ARP for IPv4.
It is required when ISPs do not unconditional route IPv6 subnets
to their designated target, but expect neighbor solicitation messages
for every address on a link.

A variable IPv6ProxyNDPAddress= is introduced to the [Network] section,
each representing a IPv6 neighbour proxy entry in the neighbour table.

7 years agobasic/architecture: adjust Risc-V ifdef (#5304)
Zbigniew Jędrzejewski-Szmek [Fri, 10 Feb 2017 22:48:22 +0000 (17:48 -0500)]
basic/architecture: adjust Risc-V ifdef (#5304)

https://lists.freedesktop.org/archives/systemd-devel/2017-February/038286.html

Let's keep both the old and new for now, so systemd builds correctly in either
environment. Later on we should drop the old.

7 years agoseccomp: order seccomp ABI list, so that our native ABI comes last (#5306)
Lennart Poettering [Fri, 10 Feb 2017 22:47:50 +0000 (23:47 +0100)]
seccomp: order seccomp ABI list, so that our native ABI comes last (#5306)

this way, we can still call seccomp ourselves, even if seccomp() is
blocked by the filter we are installing.

Fixes: #5300

7 years agotest: remove sys.tar.xz
Dan Streetman [Fri, 10 Feb 2017 20:29:52 +0000 (15:29 -0500)]
test: remove sys.tar.xz

The tarball is no longer needed, as the sys-script.py script creates
all the sys/ contents.

7 years agotest: change Makefile.am to use sys-script.py instead of sys.tar.xz
Dan Streetman [Fri, 10 Feb 2017 20:29:46 +0000 (15:29 -0500)]
test: change Makefile.am to use sys-script.py instead of sys.tar.xz

7 years agotest: create sys-script.py script
Dan Streetman [Fri, 10 Feb 2017 20:29:23 +0000 (15:29 -0500)]
test: create sys-script.py script

The script contains the contents of all sys/ test files, and creates
all dirs/links/files when run.  This replaces the sys.tar.xz tarball
that contained sys/, so changes to sys files only require a simple
commit in git, instead of checking in an entire new tarball for each
sys/ change.

7 years agotest: add script to convert sys/ into sys-script.py
Dan Streetman [Fri, 10 Feb 2017 20:27:18 +0000 (15:27 -0500)]
test: add script to convert sys/ into sys-script.py

Instead of keeping all sys/ nodes in a tarball, use a script
"sys-script.py" to create all the sys/ entries.

This adds a script to create that initial "sys-script.py" script, using
an existing sys/ directory, created from the sys.tar.xz contents.
The "sys-script.py" can then be edited or recreated later, when any sys/
files are added or modified; the change will be only a patch to the
"sys-script.py" script in git, instead of forcing git to store a new
binary tarball.

7 years agopath-lookup: if $HOME can be determined but $XDG_RUNTIME_DIR can't, is it
Lennart Poettering [Fri, 10 Feb 2017 14:18:23 +0000 (15:18 +0100)]
path-lookup: if $HOME can be determined but $XDG_RUNTIME_DIR can't, is it

So far, if either $HOME or $XDG_RUNTIME_DIR is not set we wouldn't use
either, and fail acquire_config_dirs() and acquire_control_dirs() in
their entireties. With this change, let's make use of the variables we
can acquire, and don't bother with the other.

Specifically this means: in both acquire_config_dirs() and
acquire_control_dirs() handle ENXIO from user_config_dir() and
user_runtime_dir() directly, instead of propagating it up and handling
it in the caller.

7 years agopath-lookup: drop redundant strv_isempty() check
Lennart Poettering [Fri, 10 Feb 2017 14:17:18 +0000 (15:17 +0100)]
path-lookup: drop redundant strv_isempty() check

If the strv is empty, then strv_extend_strv_concat() is a NOP anyway,
and hence there is no reason to guard for this explicitly.

7 years agopath-lookup: try harder acquiring them $HOME of a user
Lennart Poettering [Fri, 10 Feb 2017 14:16:11 +0000 (15:16 +0100)]
path-lookup: try harder acquiring them $HOME of a user

Let's use get_home_dir() for figuring out the home directory, so that
there's a good chance we succeed figuring out unit locations even if
$HOME isn't set.

Fixes: #5260

7 years agoinstall: never hit assert() when we can't figure out where to write configuration...
Lennart Poettering [Fri, 10 Feb 2017 14:14:18 +0000 (15:14 +0100)]
install: never hit assert() when we can't figure out where to write configuration symlinks

Under specific circumstances it might happen that we can't figure out
where to place our symlinks, for example because we are supposed to
create them in the runtime directory but $XDG_RUNTIME_DIR is not set. In
this case, return -ENXIO instead of hitting an assert().

(Yeah, the error isn't very descriptive, but for now this should at
least be good enough to remove the assert() being hit.)

7 years agoinstall: when disabling units, do so even if the unit is missing
Lennart Poettering [Fri, 10 Feb 2017 11:23:22 +0000 (12:23 +0100)]
install: when disabling units, do so even if the unit is missing

In some cases there might be unit symlinks in .wants/ or .requires/
directories even though the unit is otherwise fully removed. In this
case, don't fail removal, but still remove the symlinks.

This reworks the symlink marking logic to always add unit files that we
are missing to the changes list, but proceed with any symlink removal
for them. This way we'll still generate useful hints that a unit is
missing if you invoke "systemctl disable idontexist.service", but also
still remove any link to it.

Fixes: #4995

7 years agodbus: check selinux privilege before returning process list
Lennart Poettering [Fri, 10 Feb 2017 10:54:18 +0000 (11:54 +0100)]
dbus: check selinux privilege before returning process list

We protect less interetsing stuff with selinux "status", let's do that
here too.

7 years agocore: make sure to destroy all name watching bus slots when we are kicked off the...
Lennart Poettering [Fri, 10 Feb 2017 02:54:48 +0000 (03:54 +0100)]
core: make sure to destroy all name watching bus slots when we are kicked off the bus (#5294)

Fixes: #4528

7 years agotests: show journal on systemd-resolved.service failures (#5297)
Martin Pitt [Fri, 10 Feb 2017 02:30:44 +0000 (03:30 +0100)]
tests: show journal on systemd-resolved.service failures (#5297)

In networkd-test.py, show resolved's journal on failure, to debug issues
like https://github.com/systemd/systemd/pull/5283.

7 years agoseccomp: add forgotten munmap() syscall to @file-system (#5291)
Lennart Poettering [Fri, 10 Feb 2017 02:29:33 +0000 (03:29 +0100)]
seccomp: add forgotten munmap() syscall to @file-system (#5291)

We added mmap() and mmap2(), but forgot munmap(). Fix that.

Pointed out by @lucaswerkmeister:

https://github.com/systemd/systemd/pull/4537#issuecomment-273275298

7 years agoMerge pull request #5293 from poettering/seccomp-docs
Zbigniew Jędrzejewski-Szmek [Fri, 10 Feb 2017 02:28:12 +0000 (21:28 -0500)]
Merge pull request #5293 from poettering/seccomp-docs

Two doc fixes

7 years agoMerge pull request #5295 from poettering/shutup-canonicalize
Evgeny Vereshchagin [Fri, 10 Feb 2017 01:03:59 +0000 (04:03 +0300)]
Merge pull request #5295 from poettering/shutup-canonicalize

Shut up canonicalize debug log messages

7 years agodbus: permit seeing process list of units whose unit files are missing
Lennart Poettering [Thu, 9 Feb 2017 20:01:28 +0000 (21:01 +0100)]
dbus: permit seeing process list of units whose unit files are missing

Previously, we'd refuse the GetUnitProcesses() bus call if the unit file
couldn't be loaded. Which is wrong, as admins should be able to inspect
services whose unit files was deleted. Change this logic, so that we
permit introspecting the processes of any unit that is loaded,
regardless if it has a unit file or not.

(Note that we won't load unit files in GetUnitProcess(), but only
operate on already loaded ones. That's because only loaded units can
have processes — as that's how our GC logic works — and hence loading
the unit just for the process tree is pointless, as it would be empty).

See: #4995

7 years agodropin: always initialize return parameters on success
Lennart Poettering [Thu, 9 Feb 2017 19:10:03 +0000 (20:10 +0100)]
dropin: always initialize return parameters on success

Just as a matter of coding style: whenever we return successfully, let's
make sure all our return parameters are properly initialized to
something.

7 years agodropin: let's reduce duplicate a bit
Lennart Poettering [Thu, 9 Feb 2017 19:08:58 +0000 (20:08 +0100)]
dropin: let's reduce duplicate a bit

After generating the template name we can shortcut things and just call
unit_file_find_dirs() from inside itself, just with the new name and
save a good number of duplicate lines.

7 years agodropin: let's prefer strjoina() over strjoin()
Lennart Poettering [Thu, 9 Feb 2017 19:08:44 +0000 (20:08 +0100)]
dropin: let's prefer strjoina() over strjoin()

7 years agodropin: downgrade logging about paths we cannot canonicalize
Lennart Poettering [Thu, 9 Feb 2017 19:07:00 +0000 (20:07 +0100)]
dropin: downgrade logging about paths we cannot canonicalize

After all, most units won't have drop-in dirs, hence there's no point in
logging about that.

Fixes: #5252

7 years agoman: update pam_systemd and systemd-logind man pages a bit
Lennart Poettering [Thu, 9 Feb 2017 17:40:42 +0000 (18:40 +0100)]
man: update pam_systemd and systemd-logind man pages a bit

This builds on @utezduyar's #4640, but extends on it.

Fixes: #4550
Replaces: #4640

7 years agoman: improve documentation on seccomp regarding alternative ABIs
Lennart Poettering [Thu, 9 Feb 2017 17:27:02 +0000 (18:27 +0100)]
man: improve documentation on seccomp regarding alternative ABIs

Let's clarify that RestrictAddressFamilies= and MemoryDenyWriteExecute=
are only fully effective if non-native system call architectures are
disabled, since they otherwise may be used to circumvent the filters, as
the filters aren't equally effective on all ABIs.

Fixes: #5277

7 years agoIntroduce '## ' as internal comment prefix in .in files and filter out a comment...
Zbigniew Jędrzejewski-Szmek [Thu, 9 Feb 2017 15:28:37 +0000 (10:28 -0500)]
Introduce '## ' as internal comment prefix in .in files and filter out a comment (#5289)

Sometimes we have comments which don't make sense outside of the systemd
codebase, so let's filter them out from the user-visible files.

Fixes #5286.

7 years agoresolved: if strict DNSSEC mode is selected never downgrade below DNSSEC server featu...
Lennart Poettering [Wed, 8 Feb 2017 19:35:32 +0000 (20:35 +0100)]
resolved: if strict DNSSEC mode is selected never downgrade below DNSSEC server feature level due to packet loss

Fixes: #4315

7 years agoresolved: also synthesize records for the full local hostname
Lennart Poettering [Wed, 8 Feb 2017 19:13:58 +0000 (20:13 +0100)]
resolved: also synthesize records for the full local hostname

Previously, we'd only synthesize RRs for the LLMNR and mDNS versions of
the hostnames (i.e. the first label of the kernel hostname, as well as
the first label of the kernel hostname suffixed with .local). With this
change, we also synthesize an RR for the full hostname, which is
relevant in case it has more than one label.

Fixes: #5041

7 years agonss-myhostname: don't fill scopeid for non-link-local addresses
Lennart Poettering [Wed, 8 Feb 2017 19:00:07 +0000 (20:00 +0100)]
nss-myhostname: don't fill scopeid for non-link-local addresses

Inspired by #4465, we shouldn't do this for nss-myhostname either.

7 years agoresolved: when a server response with REFUSED, try a different one
Lennart Poettering [Wed, 8 Feb 2017 18:55:16 +0000 (19:55 +0100)]
resolved: when a server response with REFUSED, try a different one

Fixes: #4264

7 years agonss-resolve: don't set scopeindex for non-link-local addresses
Lennart Poettering [Wed, 8 Feb 2017 18:40:48 +0000 (19:40 +0100)]
nss-resolve: don't set scopeindex for non-link-local addresses

Apparently some apps don't like that. And given that this isn't
necessary for link-local addresses, let's suppress this information.

Fixes: #4465

7 years agoresolved: when following a CNAME initialize authenticated bit by the weakest answer
Lennart Poettering [Wed, 8 Feb 2017 18:22:49 +0000 (19:22 +0100)]
resolved: when following a CNAME initialize authenticated bit by the weakest answer

When following a CNAME chain, don't set the authenticated bit, unless
all lookups in the chain could be authenticated.

7 years agoresolved: follow CNAMES for DNS stub replies
Lennart Poettering [Wed, 8 Feb 2017 18:12:55 +0000 (19:12 +0100)]
resolved: follow CNAMES for DNS stub replies

Clients expect us to follow CNAMEs for them, hence do so. On the first
iteration start putting together a packet, and then keep adding data we
acquire through CNAMEs to it, until we finally send it off.

Fixes: #3826

7 years agotree-wide: make bus_map_all_properties return a proper sd_bus_error
Lennart Poettering [Wed, 8 Feb 2017 16:59:58 +0000 (17:59 +0100)]
tree-wide: make bus_map_all_properties return a proper sd_bus_error

And then show it, to make things a bit friendlier to the user if we fail
acquiring some props.

In fact, this fixes a number of actual bugs, where we used an error
structure for output that we actually never got an error in.

7 years agocore: fix minor memory leak
Lennart Poettering [Wed, 8 Feb 2017 16:59:18 +0000 (17:59 +0100)]
core: fix minor memory leak

7 years agoMerge pull request #5287 from poettering/exit-codes
Zbigniew Jędrzejewski-Szmek [Thu, 9 Feb 2017 14:42:43 +0000 (09:42 -0500)]
Merge pull request #5287 from poettering/exit-codes

rework WorkingDirectory= and RootDirectory= management for services

7 years agoMerge pull request #5255 from poettering/percent-escape
Zbigniew Jędrzejewski-Szmek [Thu, 9 Feb 2017 14:18:41 +0000 (09:18 -0500)]
Merge pull request #5255 from poettering/percent-escape

fstab-generator: Options= applies specifier expansion

7 years agoexecute: set the right exit status for CHDIR vs. CHROOT
Lennart Poettering [Thu, 9 Feb 2017 12:17:00 +0000 (13:17 +0100)]
execute: set the right exit status for CHDIR vs. CHROOT

Fixes: #5125

7 years agoexecute: use prefix_roota() where appropriate
Lennart Poettering [Thu, 9 Feb 2017 12:16:51 +0000 (13:16 +0100)]
execute: use prefix_roota() where appropriate

7 years agoexecute: set working directory to /root if User= is not set, but WorkingDirectory...
Lennart Poettering [Thu, 9 Feb 2017 10:58:39 +0000 (11:58 +0100)]
execute: set working directory to /root if User= is not set, but WorkingDirectory=~ is

Or actually, try to to do the right thing depending on what is
available:

- If we know $HOME from User=, then use that.
- If the UID for the service is 0, hardcode that WorkingDirectory=~ means WorkingDirectory=/root
- In any other case (which will be the unprivileged --user case), use
  get_home_dir() to find the $HOME of the user we are running as.
- Otherwise fail.

Fixes: #5246 #5124

7 years agoRevert "core/execute: set HOME, USER also for root users"
Lennart Poettering [Thu, 9 Feb 2017 10:43:44 +0000 (11:43 +0100)]
Revert "core/execute: set HOME, USER also for root users"

This reverts commit 8b89628a10af3863bfc97872912e9da4076a5929.

This broke #5246

7 years agonetworkd: add multicast membership to lldp socket (#5282)
27o [Thu, 9 Feb 2017 09:36:13 +0000 (10:36 +0100)]
networkd: add multicast membership to lldp socket (#5282)

7 years agodhcp-server: always save the ACKed lease address (#5281)
27o [Thu, 9 Feb 2017 09:15:21 +0000 (10:15 +0100)]
dhcp-server: always save the ACKed lease address (#5281)

7 years agoMerge pull request #5279 from keszybz/man-reverts
Martin Pitt [Thu, 9 Feb 2017 07:35:28 +0000 (08:35 +0100)]
Merge pull request #5279 from keszybz/man-reverts

A revert and some other tweaks for the man pages

7 years agoMerge pull request #4962 from poettering/root-directory-2
Zbigniew Jędrzejewski-Szmek [Thu, 9 Feb 2017 04:05:05 +0000 (23:05 -0500)]
Merge pull request #4962 from poettering/root-directory-2

Add new MountAPIVFS= boolean unit file setting + RootImage=

7 years agoman: add more commas for clarify and reword a few sentences
Zbigniew Jędrzejewski-Szmek [Thu, 9 Feb 2017 03:53:16 +0000 (22:53 -0500)]
man: add more commas for clarify and reword a few sentences

7 years agoman: revert documentation about RequiresMountsFor= honoring noauto
Zbigniew Jędrzejewski-Szmek [Thu, 9 Feb 2017 01:23:12 +0000 (20:23 -0500)]
man: revert documentation about RequiresMountsFor= honoring noauto

This effectively reverts commit 5d2abc04fc95f5c5f6d0eaf2f:
Author: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Date:   Wed Apr 16 22:15:42 2014 -0400

    man: document relationship between RequiresMountsFor and noauto

    https://bugzilla.redhat.com/show_bug.cgi?id=1088057

Fixes #5249.

7 years agoman: break long lines and update Fedora versions
Zbigniew Jędrzejewski-Szmek [Thu, 9 Feb 2017 01:13:57 +0000 (20:13 -0500)]
man: break long lines and update Fedora versions

We should try to keep the unbreakable lines below 80 columns.
It's not always possible of course.

Also, use the dl.fp.o alias instead of a specific mirror.

7 years agoMerge pull request #5270 from poettering/seccomp-namespace-fix
Evgeny Vereshchagin [Thu, 9 Feb 2017 00:31:22 +0000 (03:31 +0300)]
Merge pull request #5270 from poettering/seccomp-namespace-fix

swap seccomp filter params on s390

7 years agoman: fix docs for swap's DefaultDependencies= (#5278)
David Glasser [Wed, 8 Feb 2017 23:12:36 +0000 (15:12 -0800)]
man: fix docs for swap's DefaultDependencies= (#5278)

There was a missing dependency and one with the wrong type. Additionally, refer
to DefaultDependencies= once instead of twice, without a vague reference in the
first one that doesn't mention that the value matters.

Fixes #5226.

7 years agoupdate TODO
Lennart Poettering [Wed, 8 Feb 2017 15:29:05 +0000 (16:29 +0100)]
update TODO

7 years agoseccomp: on s390 the clone() parameters are reversed
Lennart Poettering [Wed, 8 Feb 2017 15:21:11 +0000 (16:21 +0100)]
seccomp: on s390 the clone() parameters are reversed

Add a bit of code that tries to get the right parameter order in place
for some of the better known architectures, and skips
restrict_namespaces for other archs.

This also bypasses the test on archs where we don't know the right
order.

In this case I didn't bother with testing the case where no filter is
applied, since that is hopefully just an issue for now, as there's
nothing stopping us from supporting more archs, we just need to know
which order is right.

Fixes: #5241

7 years agosystemctl: make sure that --now is carried out (#5209)
Jan Synacek [Wed, 8 Feb 2017 19:57:08 +0000 (20:57 +0100)]
systemctl: make sure that --now is carried out (#5209)

When services are already enabled/disabled/masked, make sure
that --now still enforces start/stop.

7 years agosd-event: "when exiting no signal event are pending" is a wrong assertion (#5271)
Franck Bui [Wed, 8 Feb 2017 19:56:22 +0000 (20:56 +0100)]
sd-event: "when exiting no signal event are pending" is a wrong assertion (#5271)

The code make the following assertion: when freeing a event loop object
(usually it's done after exiting from the main event loop), no signal events
are still queued and are pending.

This assertion can be found in event_unmask_signal_data() with
"assert(!d->current);" assertion.

It appears that this assertion can be wrong at least in a specific case
described below.

Consider the following example which is inspired from udev: a process defines 3
source events: 2 are created by sd_event_add_signal() and 1 is created by
sd_event_add_post().

 1. the process receives the 2 signals consecutively so that signal 'A' source
     event is queued and pending. Consequently the post source event is also
     queued and pending. This is done by sd_event_wait().

 2. The callback for signal 'A' is called by sd_event_dispatch().

 3. The next call to sd_event_wait() will queue signal 'B' source event.

 4. The callback for the post source event is called and calls sd_event_exit().

 5. the event loop is exited.

 6. freeing the event loop object will lead to the assertion failure in
     event_unmask_signal_data().

This patch simply removes this assertion as it doesn't seem to be a
bug if the signal data still reference a signal source at this point.

7 years agosysctl.d: replace URL of SysRq key documentation (#5274)
Peter Körner [Wed, 8 Feb 2017 18:42:43 +0000 (19:42 +0100)]
sysctl.d: replace URL of SysRq key documentation (#5274)

The kernel documentation page is not distribution specific and also more
likely to be up to date than the Fedora wiki page referenced previously.

7 years agofstab-generator: also convert % → %% for What=
Lennart Poettering [Wed, 8 Feb 2017 16:14:58 +0000 (17:14 +0100)]
fstab-generator: also convert % → %% for What=

Same reasons as the previous patch.

7 years agofstab-generator: Options= applies specifier expansion
Lennart Poettering [Tue, 7 Feb 2017 12:08:56 +0000 (13:08 +0100)]
fstab-generator: Options= applies specifier expansion

Let's document that this is the case, and properly escape % when we
generate Options= in the generator.

Fixes: #5086

7 years agonspawn: Add support for sysroot pivoting (#5258)
Philip Withnall [Wed, 8 Feb 2017 15:54:31 +0000 (15:54 +0000)]
nspawn: Add support for sysroot pivoting (#5258)

Add a new --pivot-root argument to systemd-nspawn, which specifies a
directory to pivot to / inside the container; while the original / is
pivoted to another specified directory (if provided). This adds
support for booting container images which may contain several bootable
sysroots, as is common with OSTree disk images. When these disk images
are booted on real hardware, ostree-prepare-root is run in conjunction
with sysroot.mount in the initramfs to achieve the same results.

7 years agotest: Fix a maybe-uninitialised compiler warning (#5269)
Philip Withnall [Wed, 8 Feb 2017 15:53:01 +0000 (15:53 +0000)]
test: Fix a maybe-uninitialised compiler warning (#5269)

The compiler warning is a false positive, since n_addresses is always
initialised on the success path from parse_argv(), but the compiler
obviously can’t work that out.

Fixes:
   src/test/test-nss.c:426:9: warning: 'n_addresses' may be used uninitialized in this function [-Wmaybe-uninitialized]

7 years agoseccomp: MemoryDenyWriteExecute= should affect both mmap() and mmap2() (#5254)
Lennart Poettering [Wed, 8 Feb 2017 14:14:02 +0000 (15:14 +0100)]
seccomp: MemoryDenyWriteExecute= should affect both mmap() and mmap2() (#5254)

On i386 we block the old mmap() call entirely, since we cannot properly
filter it. Thankfully it hasn't been used by glibc since quite some
time.

Fixes: #5240

7 years agoMerge pull request #5231 from keszybz/mask-wants
Lennart Poettering [Wed, 8 Feb 2017 13:50:56 +0000 (14:50 +0100)]
Merge pull request #5231 from keszybz/mask-wants

Mask individual .wants/.requires symlinks

7 years agodissect: don't honour NOAUTO flags when looking for ESP (#5224)
Lennart Poettering [Wed, 8 Feb 2017 03:10:48 +0000 (04:10 +0100)]
dissect: don't honour NOAUTO flags when looking for ESP (#5224)

The flag is originally defined for "basic data partitions", but not for the
ESP. We reuse it for the various partitions defined by the Discoverable
Partitions Spec, but it isn't defined for the ESP, hence don't check for
it. Instead, do check for GPT_FLAG_NO_BLOCK_IO_PROTOCOL, as that flag
actually is defined for all partition types, and recommended to use by
the UEFI spec.

Fixes: #5218

7 years agotests: add dropin dependency tests
Franck Bui [Fri, 27 Jan 2017 15:02:22 +0000 (16:02 +0100)]
tests: add dropin dependency tests

[zj: tests assertions adjusted to the different logic in which masking
     of a dependency through one name, does not forbid the dependency
     being added through another name.]

7 years agocore/load-dropin: add more sanity checks on .wants/.requires symlinks
Zbigniew Jędrzejewski-Szmek [Sun, 5 Feb 2017 03:36:17 +0000 (22:36 -0500)]
core/load-dropin: add more sanity checks on .wants/.requires symlinks

Feb 04 22:35:42 systemd[1462]: foo.service: Wants dependency dropin /home/zbyszek/.config/systemd/user/foo.service.wants/diffname.service target ../barbar.service has different name
Feb 04 22:35:42 systemd[1462]: foo.service: Wants dependency dropin /home/zbyszek/.config/systemd/user/foo.service.wants/wrongname is not a valid unit name, ignoring

7 years agocore: drop code that is now unused
Zbigniew Jędrzejewski-Szmek [Sun, 5 Feb 2017 02:32:08 +0000 (21:32 -0500)]
core: drop code that is now unused

7 years agocore: implement masking of .wants/.requires symlinks
Zbigniew Jędrzejewski-Szmek [Sun, 5 Feb 2017 01:50:44 +0000 (20:50 -0500)]
core: implement masking of .wants/.requires symlinks

Fixes #1169.
Fixes #4830.

Example log errors:
Feb 04 22:13:28 systemd[1462]: foo.service: Wants dependency on empty_file.service is masked by /home/zbyszek/.config/systemd/user/foo.service.wants/empty_file.service, ignoring
Feb 04 22:13:28 systemd[1462]: foo.service: Wants dependency on masked.service is masked by /home/zbyszek/.config/systemd/user/foo.service.wants/masked.service, ignoring

7 years agocore: when loading .wants and .requires, follow the same logic as .d conf dropins
Zbigniew Jędrzejewski-Szmek [Sun, 5 Feb 2017 01:50:44 +0000 (20:50 -0500)]
core: when loading .wants and .requires, follow the same logic as .d conf dropins

Essentially, instead of sequentially adding deps based on all symlinks
encountered in .wants and .requires dirs for each name and each unit file load
path, iteratate over the load paths and unit names gathering symlinks, then
order them based on priority, and then iterate over the final list, adding
dependencies.

This patch doesn't change the logic too much, except that the order in which
dependencies are applied might be different. It wasn't defined before, so that
not really a change. Adding filtering on the symlinks is left for later
patches.

7 years agobasic/dirent-util: allow suffix to be omitted for dirent_is_file_with_suffix
Zbigniew Jędrzejewski-Szmek [Wed, 8 Feb 2017 02:06:38 +0000 (21:06 -0500)]
basic/dirent-util: allow suffix to be omitted for dirent_is_file_with_suffix

7 years agoman: s/--unmount/--umount/g (#5243)
Lennart Poettering [Wed, 8 Feb 2017 00:54:37 +0000 (01:54 +0100)]
man: s/--unmount/--umount/g (#5243)

The --help text currently uses the "--umount" spelling, hence to the
same in the man page too.

And let's settle on "umount" instead of "unmount" here, since most folks
probably expect that when typing in a command, as util-linux' tool is
called "umount" after all, and so is the symlink "systemd-umount" we
install.

7 years agoMerge pull request #5263 from poettering/install-alias
Zbigniew Jędrzejewski-Szmek [Wed, 8 Feb 2017 00:50:20 +0000 (19:50 -0500)]
Merge pull request #5263 from poettering/install-alias

7 years agoRevert "fix handling of templates instantiated in /usr/lib (#5263)"
Zbigniew Jędrzejewski-Szmek [Wed, 8 Feb 2017 00:49:47 +0000 (19:49 -0500)]
Revert "fix handling of templates instantiated in /usr/lib  (#5263)"

This reverts commit 0698b674920aa8a56dbd6a625729a35e5ae9c5df.

It was supposed to be merged, not squashed.

7 years agofix handling of templates instantiated in /usr/lib (#5263)
Lennart Poettering [Wed, 8 Feb 2017 00:48:56 +0000 (01:48 +0100)]
fix handling of templates instantiated in /usr/lib  (#5263)

Fix handling of templates instantiated in /usr/lib.
All work to fix #5136.