1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-08 11:27:32 +03:00
Commit Graph

21920 Commits

Author SHA1 Message Date
Marcel Holtmann
da1d9fc2cc hwdb: Update database of Bluetooth company identifiers 2015-08-26 09:21:02 +02:00
HATAYAMA Daisuke
9fa7c1aeb9 selinux: fix regression of systemctl subcommands when absolute unit file paths are specified
The commit 4938696301 overlooked the
fact that unit files can be specified as unit file paths, not unit
file names, wrongly passing a unit file path to the 1st argument of
manager_load_unit() that handles it as a unit file name. As a result,
the following 4 systemctl subcommands:

    enable
    disable
    reenable
    link
    mask
    unmask

fail with the following error message:

    # systemctl enable /usr/lib/systemd/system/kdump.service
    Failed to execute operation: Unit name /usr/lib/systemd/system/kdump.service is not valid.
    # systemctl disable /usr/lib/systemd/system/kdump.service
    Failed to execute operation: Unit name /usr/lib/systemd/system/kdump.service is not valid.
    # systemctl reenable /usr/lib/systemd/system/kdump.service
    Failed to execute operation: Unit name /usr/lib/systemd/system/kdump.service is not valid.
    # cp /usr/lib/systemd/system/kdump.service /tmp/
    # systemctl link /tmp/kdump.service
    Failed to execute operation: Unit name /tmp/kdump.service is not valid.
    # systemctl mask /usr/lib/systemd/system/kdump.service
    Failed to execute operation: Unit name /usr/lib/systemd/system/kdump.service is not valid.
    # systemctl unmask /usr/lib/systemd/system/kdump.service
    Failed to execute operation: Unit name /usr/lib/systemd/system/kdump.service is not valid.

To fix the issue, first check whether a unit file is passed as a unit
file name or a unit file path, and then pass the unit file to the
appropreate argument of manager_load_unit().

By the way, even with this commit mask and unmask reject unit file
paths as follows and this is a correct behavior:

    # systemctl mask /usr/lib/systemd/system/kdump.service
    Failed to execute operation: Invalid argument
    # systemctl unmask /usr/lib/systemd/system/kdump.service
    Failed to execute operation: Invalid argument
2015-08-26 15:00:05 +09:00
Daniel Mack
7c268a0489 Merge pull request #1043 from phomes/master
test-util: fix a memleak
2015-08-26 00:05:33 +02:00
Daniel Mack
487ebe593c Merge pull request #1039 from poettering/nspawn-machine-template
nspawn: make sure --template= and --machine= my be combined
2015-08-25 23:58:40 +02:00
Daniel Mack
6a18bd1616 Merge pull request #1038 from poettering/coredumpctl-directory
Add --directory= option for reading alternate journal
2015-08-25 23:58:03 +02:00
Daniel Mack
a0cb22c475 Merge pull request #1040 from poettering/cgroup-path-fix
fix "systemctl status idontexist.service" showing the full cgroup tree
2015-08-25 23:57:28 +02:00
Thomas Hindoe Paaboel Andersen
21e5a0bea0 test-util: fix a memleak 2015-08-25 23:52:18 +02:00
Daniel Mack
d8b7e75f51 resolve: fix regression in dns-scope
Bring back a return statement 106784eb errornously removed.

Thanks to @phomes for reporting.
2015-08-25 23:51:34 +02:00
Daniel Mack
13918f62ff Merge pull request #1041 from phomes/master
trivial cleanups
2015-08-25 23:48:07 +02:00
Daniel Mack
4ece412faf Merge pull request #1034 from poettering/resolved-fixes-2
various resolved fixes
2015-08-25 23:47:30 +02:00
Thomas Hindoe Paaboel Andersen
c615b4ba9f machinectl: remove unused variable 2015-08-25 21:15:54 +02:00
Thomas Hindoe Paaboel Andersen
2307f37e46 execute: make the invalid entry of the enum -1
Set _EXEC_UTMP_MODE_INVALID to -1. This matches the return value from
string_table_lookup.
2015-08-25 21:15:54 +02:00
Lennart Poettering
98bac6058c core: report root cgroup as "/" over the bus
Internally, the root cgroup is stored as the empty string in
Unit.cgroup_path, and "no cgroup" as NULL. Unfortunately, D-Bus does not
know a NULL concept, hence when reporting the cgroup to clients we
should turn the root cgroup into "/", and leave the empty string for the
"no cgroup" case.

This should make sure that "systemctl status -- -.slice" works correctly
and shows the entire cgroup tree.
2015-08-25 20:42:50 +02:00
Lennart Poettering
37a0d5bf21 Revert "systemctl: properly handle empty control group paths in "status""
This reverts commit b04c25f9ef.
2015-08-25 20:37:54 +02:00
Lennart Poettering
c1521918b4 nspawn: make sure --template= and --machine= my be combined
Fixes #1018.

Based on a patch from Seth Jennings.
2015-08-25 20:28:31 +02:00
Lennart Poettering
f6a4dae6a5 man: minor fixes to coredumpctl(1) 2015-08-25 20:06:46 +02:00
Stef Walter
b73e9a024b coredumpctl: Add --directory option for reading alternate journal
In the Cockpit integration tests we hang onton the journal files
for a failed test and would like to inspect them using coredumpctl.

This commit adds the ability to specify an alternate directory
for coredumpctl to read the journal from.
2015-08-25 20:06:43 +02:00
Lennart Poettering
eccd47c5be sd-bus: introduce new match type "arg0has=" for matching arrays of strings
Previously, sd-bus inofficially already supported bus matches that
tested a string against an array of strings ("as"). This was done via an
enhanced way to interpret "arg0=" matches. This is problematic however,
since clients have no way to determine if their respective
implementation understood strv matches or not, thus allowing invalid
matches to be installed without a way to detect that.

This patch changes the logic to only allow such matches with a new
"arg0has=" syntax. This has the benefit that non-conforming
implementations will return a parse error and a client application may
thus efficiently detect support for the match type.

Matches of this type are useful for "udev"-like systems that "tag" objects
with a number of strings, and clients need to be able to match against
any of these "tags".

The name "has" takes inspiration from Python's ".has_key()" construct.
2015-08-25 19:28:30 +02:00
Lennart Poettering
f0258e4736 resolved: add comments to DNS_PACKET_MAKE_FLAGS() clarifying DNS vs LLMNR
Some flags are defined differently on unicast DNS and LLMNR, let's
document this in the DNS_PACKET_MAKE_FLAGS() macro.
2015-08-25 19:04:04 +02:00
Lennart Poettering
069360a66a resolved: make packet flags logic more expressive again
This partially reverts 106784ebb7, ad
readds separate DNS_PACKET_MAKE_FLAGS() invocations for the LLMNR and
DNS case. This is important since SOme flags have different names and
meanings on LLMNR and on DNS and we should clarify that via the comments
and how we put things together.
2015-08-25 18:54:55 +02:00
Lennart Poettering
4667e00a61 resolved: rename DNS UDP socket to 'dns_udp_fd'
This hopefully makes this a bit more expressive and clarifies that the
fd is not used for the DNS TCP socket. This also mimics how the LLMNR
UDP fd is named in the manager object.
2015-08-25 18:51:23 +02:00
Tom Gundersen
33c1c9745c Merge pull request #1033 from poettering/machine-fixes
misc machine fixes
2015-08-25 18:50:44 +02:00
Lennart Poettering
8bed4cbcc0 bus-util: make more properties settable in --property=
Add a couple of new properties to the supported set we can pass in
systemd-run's and systemd-nspawn's --property= switch.
2015-08-25 18:39:50 +02:00
Lennart Poettering
6cd16034fc man: add hyphen to improve man text 2015-08-25 18:37:53 +02:00
Lennart Poettering
7e9cc4361d core: drop spurious new line 2015-08-25 18:37:31 +02:00
Lennart Poettering
a1104deef0 machine: policykit string fixes 2015-08-25 18:37:16 +02:00
Tom Gundersen
498fb56739 Merge pull request #1022 from poettering/machinectl-shell
Add new "machinectl shell" command for su(1)-like behaviour
2015-08-25 16:46:27 +02:00
Lennart Poettering
3ad216b44f Merge pull request #1029 from jsynacek/unprivileged-wall-message-v2
logind/systemctl: introduce SetWallMessage and --message
2015-08-25 15:54:23 +02:00
Daniel Mack
ec5249a27a NEWS: preparations for v225 release 2015-08-25 15:01:51 +02:00
Tom Gundersen
1c76020aa5 Merge pull request #1030 from zonque/resolve
resolve: minor cleanups
2015-08-25 14:33:41 +02:00
Daniel Mack
eff91ee007 resolved: allow dns_cache_put() without a question
Currently, dns_cache_put() does a number of things:

1) It unconditionally removes all keys contained in the passed
   question before adding keys from the newly arrived answers.

2) It puts positive entries into the cache for all RRs contained
   in the answer.

3) It creates negative entries in the cache for all keys in the
   question that are not answered.

Allow passing q = NULL in the parameters and skip 1) and 3), so
we can use that function for mDNS responses. In this case, the
question is irrelevant, we are interested in all answers we got.
2015-08-25 14:26:18 +02:00
Daniel Mack
a7e5da6e33 sd-network: make LLMNR specific config parser generic
Rename the enum, the lookup functions and the parser for LLMNRSupport so
the type can be reused for mDNS.
2015-08-25 14:26:01 +02:00
Daniel Mack
9c56a6f3e2 resolved: move assertion
Make a scope with invalid protocol state fail as soon as possible.
2015-08-25 14:25:58 +02:00
Daniel Mack
106784ebb7 resolved: use switch-case statements for protocol details
With more protocols to come, switch repetitive if-else blocks with a
switch-case statements.
2015-08-25 14:25:56 +02:00
Jan Synacek
9ef15026c0 logind/systemctl: introduce SetWallMessage and --message
Enable unprivileged users to set wall message on a shutdown
operation. When the message is set via the --message option,
it is logged together with the default shutdown message.

$ systemctl reboot --message "Applied kernel updates."

$ journalctl -b -1
...
systemd-logind[27]: System is rebooting. (Applied kernel updates.)
...
2015-08-25 13:52:44 +02:00
Daniel Mack
8326c7f789 resolved: remove runtime check for previously asserted condition 2015-08-25 10:18:45 +02:00
Tom Gundersen
dd42560795 Merge pull request #1023 from poettering/resolved-fixes
A variety of resolved fixes
2015-08-25 10:18:16 +02:00
Lennart Poettering
337020515d sd-bus: introduce new SD_BUS_VTABLE_PROPERTY_EXPLICIT flag
This allows marking properties as "explicit". Properties marked like
this are included in the introspection, but are avoided in GetAll()
property queries, PropertiesChanged() signals and in in GetManaged()
object manager calls and InterfacesAdded() signals.

Expensive properties may be marked that way, and they will be
retrievable when explicitly being requested, but never in "blanket"
all-property queries and signals.

This flag may be combined with the flags for "const" and
"emit-validation" properties, but not with "emit-validation", as that
is only useful for properties whose value shall be sent in "blanket"
all-property signals.

The "explicit" flag is also exposed in the introspection data via a new
annotation.
2015-08-25 01:50:59 +02:00
Lennart Poettering
9318cdd374 resolved: change error code when trying to resolve direct LLMNR PTR RRs
If we try to resoolve an LLMNR PTR RR we shall connect via TCP directly
to the specified IP address. We already refuse to do this if the address
to resolve is of a different address family as the transaction's scope.
The error returned was EAFNOSUPPORT. Let's change this to ESRCH which is
how we indicate "not server available" when connecting for LLMNR or DNS,
since that's what this really is: we have no server we could connect to
in this address family.

This allows us to ensure that no server errors are always handled the same
way.
2015-08-24 23:47:28 +02:00
Lennart Poettering
3fa4999b5d resolve-host: support parsing numeric interface names
If the user specifies an interface by its ifindex we should handle this
nicely. Hence let's try to parse the ifindex as a number before we try
to resolve it as an interface name.
2015-08-24 23:46:24 +02:00
Lennart Poettering
d634711b26 resolved: remove duplicate handling of "no servers" query result
So far we handled immediate "no server" query results differently from
"no server" results we ran into during operation: the former would cause
the dns_query_go() call to fail with ESRCH, the later would result in
the query completion callback to be called.

Remove the duplicate codepaths, by always going through the completion
callback. This allows us to remove quite a number of lines for handling
the ESRCH.

This commit should not alter behaviour at all.
2015-08-24 23:44:33 +02:00
Lennart Poettering
da0c630e14 resolved: replace transaction list by hashmap
Right now we keep track of ongoing transactions in a linked listed for
each scope. Replace this by a hashmap that is indexed by the RR key.
Given that all ongoing transactions will be placed in pretty much the
same scopes usually this should optimize behaviour.

We used to require a list here, since we wanted to do "superset" query
checks, but this became obsolete since transactions are now single-key
instead of multi-key.
2015-08-24 23:15:51 +02:00
Lennart Poettering
ef3100e963 machinectl: extend the "shell" syntax to take user@container names
In order to make "machinectl shell" more similar to ssh, allow the
following syntax to connect to a container under a specific username:

        machinectl shell lennart@fedora

Also beefs up related man page documentation.
2015-08-24 22:46:46 +02:00
Lennart Poettering
91913f584a machinectl: make machine name parameters for "shell" and "login" optional
If no machine name is specified, imply that we connect to ".host", i.e.
the local host.
2015-08-24 22:46:45 +02:00
Lennart Poettering
4289c3a725 machined: beef up PolicyKit actions
Introduce separate actions for creating login or shell sessions for
the local host or a local container. By default allow local unprivileged
clients to create new login sessions (which is safe, since getty will
ask for username and authentication).

Also, imply login privs from shell privs, as well as shell and login
privs from manage privs.
2015-08-24 22:46:45 +02:00
Lennart Poettering
b04c25f9ef systemctl: properly handle empty control group paths in "status"
When showing the status of the "-.slice" slice root unit (whose reported
cgroup path is ""), we suppressed the cgroup tree so far, because
skipped it for all unit with an empty cgroup path. Let's fix that, and
properly handle the empty cgroup path.
2015-08-24 22:46:45 +02:00
Lennart Poettering
a79366e22a machined: userns is only supported for container-class machines
We do not support userns for VM machines or for the host itself.
2015-08-24 22:46:45 +02:00
Lennart Poettering
fee6d013d8 machinectl: don't show ".host" pseudo-machine in list by default
Let's hide all machines whose name begins with "." by default, thus
hiding the ".host" pseudo-machine, unless --all is specified. This
takes inspiration from the ".host" image handling in "machinectl
list-images" which also hides all images whose name starts with ".".
2015-08-24 22:46:45 +02:00
Lennart Poettering
fbe550738d machined: introduce pseudo-machine ".host" refererring to the host system
Some of the operations machined/machinectl implement are also very
useful when applied to the host system (such as machinectl login,
machinectl shell or machinectl status), hence introduce a pseudo-machine
by the name of ".host" in machined that refers to the host system, and
may be used top execute operations on the host system with.

This copies the pseudo-image ".host" machined already implements for
image related commands.

(This commit also adds a PK privilege for opening a PTY in a container,
which was previously not accessible for non-root.)
2015-08-24 22:46:45 +02:00
Lennart Poettering
b9a8d25081 machined: validate machine names at more places
When enumerating machines from /run, and when accepting machine names
for operations, be more strict and always validate.

Note that these checks are strictly speaking unnecessary, since
enumeration happens only on the trusted /run...
2015-08-24 22:46:45 +02:00