Commit graph

16724 commits

Author SHA1 Message Date
Daniel Mack 8f2807bab5 memfd: reduce name escaping logic to utf-8 checks
As memfds are now created by proper kernel API, and not by our functions, we
can't rely on names being escaped/unescaped according to our current logic.

Thus, the only safe way is to remove the escaping and when reading names,
just escape names that are not properly encoded in UTF-8.

Also, remove assert(name) lines from the memfd creation functions, as we
explictly allow name to be NULL.
2014-08-19 21:49:05 +02:00
Lennart Poettering 4531a9bc20 memfd: simplify API
Now, that the memfd stuff is not exported anymore, we can simplify a few
things:

Use assert() instead of assert_return(), since this is used internally
only, and we should be less permissive then.

No need to pass an allocated fd back by call-by-reference, we can just
directly return it.
2014-08-19 19:39:16 +02:00
Lennart Poettering 8a0dec98a3 update TODO 2014-08-19 19:22:40 +02:00
Lennart Poettering 3bb07b7680 Revert "socket: introduce SELinuxLabelViaNet option"
This reverts commit cf8bd44339.

Needs more discussion on the mailing list.
2014-08-19 19:16:08 +02:00
Lennart Poettering 8530dc4467 tmpfiles: add new 'r' line type to add UIDs/GIDs to the pool to allocate UIDs/GIDs from
This way we can guarantee a limited amount of compatibility with
login.defs, by generate an appopriate "r" line out of it, on package
installation.
2014-08-19 19:06:39 +02:00
Tom Gundersen 81163121e6 networkd: don't consider deprecated or tentative addresses when determining operstate
https://bugs.freedesktop.org/show_bug.cgi?id=81287
2014-08-19 19:01:38 +02:00
Michal Sekletar cf8bd44339 socket: introduce SELinuxLabelViaNet option
This makes possible to spawn service instances triggered by socket with
MLS/MCS SELinux labels which are created based on information provided by
connected peer.

Implementation of label_get_child_label derived from xinetd.

Reviewed-by: Paul Moore <pmoore@redhat.com>
2014-08-19 18:57:12 +02:00
Tom Gundersen 6c3e68e7c1 networkd: netdev - add missing callback when adding stacked devices
As the comment says, the passed in callback must always be invoked, or the underlying link
will hang. This was missed when reworking the code, so add it back in.
2014-08-19 17:55:34 +02:00
Tom Gundersen 2a5948f715 networkd: link - don't enforce ENSLAVING state
We are only guaranteed to stay in ENSLAVING state whilst enslaving by bridges/bonds, not
when adding stacked devices (as then the underlying device can be IFF_UP'ed and configured
in parallel), so drop these asserts.
2014-08-19 17:55:34 +02:00
Lennart Poettering 14a32924c9 update TODO 2014-08-19 16:47:52 +02:00
Lennart Poettering 60e6abf16b util: remove unused FOREACH_WORD_SEPARATOR_QUOTED 2014-08-19 16:47:52 +02:00
Lennart Poettering 22f21c0f3b sysusers: realign sysusers snippets 2014-08-19 16:47:52 +02:00
Lennart Poettering 20fcf3aba5 sysusers: set home directory for root to /root 2014-08-19 16:47:52 +02:00
Lennart Poettering 7629889c86 sysusers: add another column to sysusers files for the home directory 2014-08-19 16:47:52 +02:00
Tom Gundersen 2c36be2f4b networkd: fix use-after-free
Elements must be removed from the hashtable before they are freed.
2014-08-19 15:41:23 +02:00
Lennart Poettering 93aef81600 update TODO 2014-08-19 02:19:10 +02:00
Lennart Poettering 0e77023ea0 sysusers: add a new RPM macro for creating users directly from data passed in via stdin
This allows encoding users to create directly in %pre, which is
necessary so that files owned by the RPM can be assigned to the right
users/groups.

This new macro does create a redundancy, as user definitions for all
users that shall own files need to to be listed twice, once with this
new macro, and then secondly, in the sysusers file shipped with the
package. But there's little way around that, as the users of this type
need to exist before we install the first file, but we actually want to
ship the user information in a file.
2014-08-19 02:16:27 +02:00
Lennart Poettering dfc87cbfe5 sysusers: optionally, read sysuers configuration from standard input 2014-08-19 02:14:32 +02:00
Lennart Poettering d61bb44a89 update TODO 2014-08-19 02:09:14 +02:00
Lennart Poettering 9ab315ccf2 sysusers: also update /etc/shadow and /etc/gshadow when creating new system users
This should resolve problems with tools like "grpck" and suchlike.
2014-08-19 01:57:24 +02:00
Lennart Poettering de99c9dcba hashmap: try to use the existing 64bit hash functions for dev_t if it is 64bit 2014-08-19 00:04:55 +02:00
David Herrmann 1ac36c67dd bus: map sealed memfds as MAP_PRIVATE
Mapping files as MAP_SHARED is handled by the kernel as 'writable'
mapping. Always! Even with PROT_READ. Reason for that is,
mprotect(PROT_WRITE) could change the mapping underneath and currently
there is no kernel infrastructure to add protection there. This might
change in the future, but until then, map sealed files as MAP_PRIVATE so
we don't get EPERM.
2014-08-18 23:56:36 +02:00
Lennart Poettering 9da465df2a Update TODO 2014-08-18 23:16:44 +02:00
Lennart Poettering 70421bdce2 util: try to be a bit more NFS compatible when checking whether an FS is writable
https://bugs.freedesktop.org/show_bug.cgi?id=81169
2014-08-18 23:16:36 +02:00
Lennart Poettering 3f3cc39704 core: minor modernizations 2014-08-18 22:25:24 +02:00
Lennart Poettering ff50244582 units: fix BindsTo= logic when applied relative to services with Type=oneshot
Start jobs for Type=oneshot units are successful when the unit state
transition activating → inactive took place. In such a case all units
that BindsTo= on it previously would continue to run, even though the unit
they dependet on was actually already gone.
2014-08-18 22:21:42 +02:00
Ronny Chevalier 8257df2767 man: fix typo 2014-08-18 21:02:07 +02:00
Ronny Chevalier ece74070c7 bootchart: use NSEC_PER_SEC 2014-08-18 21:02:04 +02:00
Denis Kenzior fe3f22d116 bus-control: Fix cgroup handling
On systems without properly setup systemd, cg_get_root_path returns
-ENOENT.  This means that busctl doesn't display much information.

busctl monitor also fails whenever it intercepts messages.

This fix fakes creates a fake "/" root cgroup which lets busctl work
on such systems.
2014-08-18 21:01:57 +02:00
Lennart Poettering a1d4404f9a man: mention that "units" are commonly system services
Also, provide an example for -u.
2014-08-18 19:08:03 +02:00
Lennart Poettering ea352b409e networkd: fix how we generate lists in link_save()
https://bugs.freedesktop.org/show_bug.cgi?id=82721
2014-08-18 18:59:48 +02:00
Ronny Chevalier 8aa209ee14 tests: add missing entry to test-tables 2014-08-18 18:44:03 +02:00
Ronny Chevalier 6accc7a24c tests: add tests for time-util.c
add tests for:
- timezone_is_valid
- get_timezones
2014-08-18 18:44:00 +02:00
Ronny Chevalier b08f2be60a tests: add test-condition-util 2014-08-18 18:43:58 +02:00
Ronny Chevalier 8852362bfc tests: add tests for util.c
add tests for:
- is_symlink
- pid_is_unwaited
- pid_is_alive
- search_and_fopen
- search_and_fopen_nulstr
- glob_exists
- execute_directory
2014-08-18 18:43:55 +02:00
Ronny Chevalier d7aeffea14 tests: add test for fdset_iterate 2014-08-18 18:43:52 +02:00
Ronny Chevalier 0709b74374 tests: add tests for fileio.c
add tests for:
- write_string_stream
- write_string_file
- sendfile_full
2014-08-18 18:43:50 +02:00
Ronny Chevalier 1f532d7ef3 tests: add missing unlink 2014-08-18 18:43:48 +02:00
Ronny Chevalier 43dc004336 tests: add tests for socket-util.c
add tests for:
- socket_address_is
- socket_address_is_netlink
- sockaddr_equal
2014-08-18 18:43:45 +02:00
Ronny Chevalier c16d01af57 man: fix typo 2014-08-18 18:29:27 +02:00
Michael Olbrich 1924a97db5 tmpfiles: only execute chmod()/chown() when needed
This avoids errors like this, when the paths are already there with the
correct permissions and owner:

chmod(/var/spool) failed: Read-only file system
2014-08-18 18:25:30 +02:00
Lennart Poettering 630a4d9ea7 Merge remote-tracking branch 'origin/master' 2014-08-18 18:12:55 +02:00
Tom Gundersen e0fbf1fcff networkd: warn when ignoring unsupported tuntap options
The interface for creating tuntap devices should be ported to rtnl so it would support the same settings
as other kinds. In the meantime, the best one can do is to drop in a .link file to set the desired options.
2014-08-18 18:11:42 +02:00
Stef Walter 283868e1dc core: Verify systemd1 DBus method callers via polkit
DBus methods that retrieve information can be called by anyone.

DBus methods that modify state of units are verified via polkit
action: org.freedesktop.systemd1.manage-units

DBus methods that modify state of unit files are verified via polkit
action: org.freedesktop.systemd1.manage-unit-files

DBus methods that reload the entire daemon state are verified via polkit
action: org.freedesktop.systemd1.reload-daemon

DBus methods that modify job state are callable from the clients
that started the job.

root (ie: CAP_SYS_ADMIN) can continue to perform all calls, property
access etc. There are several DBus methods that can only be
called by root.

Open up the dbus1 policy for the above methods.

(Heavily modified by Lennart, making use of the new
bus_verify_polkit_async() version that doesn't force us to always
pass the original callback around. Also, interactive auhentication must
be opt-in, not unconditional, hence I turned this off.)
2014-08-18 18:08:28 +02:00
Lennart Poettering f38857914a bus-util: simplify bus_verify_polkit_async() a bit
First, let's drop the "bus" argument, we can determine it from the
message anyway.

Secondly, determine the right callback/userdata pair automatically from
what is currently is being dispatched. This should simplify things a lot
for us, since it makes it unnecessary to pass pointers through the
original handlers through all functions when we process messages, which
might require authentication.
2014-08-18 17:49:53 +02:00
Lennart Poettering caa829849d sd-bus: add API to query which handler/callback is currently being dispatched 2014-08-18 17:49:53 +02:00
Daniel Mack fac9c0d508 memfd: internalize functions, drop sd_memfd type
Remove the sd_ prefix from internal functions and get rid of the sd_memfd
type. As a memfd is now just a native file descriptor, we can get rid of our
own wrapper type, and also use close() and dup() on them directly.
2014-08-18 13:32:08 +02:00
David Herrmann 8a02decaf1 memfd: use _cleanup_ if applicable
We now have a sd_memfd_freep helper, use it if applicable.
2014-08-18 13:07:43 +02:00
David Herrmann 23972f4244 memfd: map unsealed files as MAP_SHARED
We need to map sealed files as MAP_PRIVATE so far as the kernel treats
MAP_SHARED as writable mapping (you can run mprotect(PROT_WRITE) at any
time on those). However, unsealed files must be mapped as MAP_SHARED.
Otherwise, we never end up writing to the real file.
2014-08-18 13:05:48 +02:00
David Herrmann c7dab73a5f memfd: disallow importing memfds without sealing
We use memfds for sealing. Lets not bother with memfds created without
MFD_ALLOW_SEALING for now. They're equivalent to random shmem files, so
don't bother treating them as sealable memfds.
2014-08-18 13:03:09 +02:00