chiark / gitweb /
elogind.git
7 years agologin: fix potential null pointer dereference
Ronny Chevalier [Fri, 12 Jun 2015 09:37:11 +0000 (11:37 +0200)]
login: fix potential null pointer dereference

Fix CID 1304686: Dereference after null check (FORWARD_NULL)

However, this commit does not fix any bug in logind. It helps to keep
the elect_display_compare() function generic.

7 years agosd-rtnl: make joining broadcast groups implicit
Tom Gundersen [Thu, 11 Jun 2015 13:55:37 +0000 (15:55 +0200)]
sd-rtnl: make joining broadcast groups implicit

7 years agosd-network: fix CID 1306198
Susant Sahani [Thu, 11 Jun 2015 08:37:15 +0000 (14:07 +0530)]
sd-network: fix CID 1306198

7 years agoAll languages .po files - general update
Daniele Medri [Wed, 10 Jun 2015 21:27:59 +0000 (23:27 +0200)]
All languages .po files - general update

7 years agoItalian .po updates
Daniele Medri [Wed, 10 Jun 2015 21:19:26 +0000 (23:19 +0200)]
Italian .po updates

7 years agobus: we now support path_namespace=/
David Herrmann [Wed, 10 Jun 2015 18:14:56 +0000 (20:14 +0200)]
bus: we now support path_namespace=/

Our bloom-filters support root-path matching. Make sure we properly add
the path_namespace= tag.

7 years agobus: fix arg0path= two-way matching
David Herrmann [Wed, 10 Jun 2015 18:04:53 +0000 (20:04 +0200)]
bus: fix arg0path= two-way matching

DBus spec clearly defines arg0path= to be a two-way matching. That is,
either the matcher or the matchee can be a prefix of the other to match.
This is not possible to implement with bloom-filters. Instead, we'd have
to add a separate filter for each prefix. This is non-trivial, though.
Hence, just skip the match for now and match locally.

7 years agobus: fix pattern matching
David Herrmann [Wed, 10 Jun 2015 17:34:05 +0000 (19:34 +0200)]
bus: fix pattern matching

DBus-spec defines two different pattern matchings:

  1) Path and namespace prefix matching. In this case, A matches B either
     if both are equal, or if B is fully included in the namespace of A.
     In other words, A has to be a prefix of B, but end with a separator
     character (or the following character in B must be one).

     This is used for path_namespace= and arg0namespace=

  2) The other pattern matching is used for arg0path= which does a two-way
     matching. That is, A must be a prefix of B, or B a prefix of A.
     Furthermore, the prefix must end with a separator.

Fix the sd-bus helpers to reflect that. The 'simple_' and 'complex_'
prefixes don't make any sense now, but.. eh..

7 years agoutil: introduce CMSG_FOREACH() macro and make use of it everywhere
Lennart Poettering [Wed, 10 Jun 2015 17:10:47 +0000 (19:10 +0200)]
util: introduce CMSG_FOREACH() macro and make use of it everywhere

It's only marginally shorter then the usual for() loop, but certainly
more readable.

7 years agosd-network: allow the state dir to be created after the monitor
Tom Gundersen [Wed, 10 Jun 2015 17:00:39 +0000 (19:00 +0200)]
sd-network: allow the state dir to be created after the monitor

We now listen for new subdirs of /run/systemd, and /run/systemd/netif in case
/run/systemd/netif/links does not exist.

7 years agobus: fix test-bus-kerne-bloom.c to match properly
David Herrmann [Wed, 10 Jun 2015 16:47:31 +0000 (18:47 +0200)]
bus: fix test-bus-kerne-bloom.c to match properly

Make sure we actually verify our match-rules are executed properly. Right
now all we test is the bloom-matches, which are non-reliable as they leave
through false-positives.

7 years agobus: fix bloom_add_prefixes() to add all required data
David Herrmann [Wed, 10 Jun 2015 16:26:16 +0000 (18:26 +0200)]
bus: fix bloom_add_prefixes() to add all required data

Lets look at an example where we add arg0="/foo/bar/waldo" to a
bloom-filter. The following strings are added:
  "arg0:/foo/bar/waldo"
  "arg0-slash-prefix:/foo/bar"
  "arg0-slash-prefix:/foo"

Two problems arise:

1) If we match on "arg0path=/foo/bar/waldo", the dbus-spec explicitly
states that equal strings are also considered prefixes. However, in the
bloom-match, we can only provide a single match-filter. Therefore, we have
to add "arg0-slash-prefix:/foo/bar/waldo" there, but this never occured in
the bloom-mask of the message.
Hence, this patch makes sure bloom_add_prefixes() adds the full path as
prefix, too.

2) If we match on "arg0path=/foo/", the dbus-spec states that arg0path
does prefix-matching with the trailing slash _included_, unlike
path_namespace= matches, which does *not* include them. This is
inconsistent, but we have to support the specs. Therefore, we must add
prefixes with _and_ without trailing separators.
Hence, this patch makes sure bloom_add_prefixes() adds all prefixes with
the trailing slash included.

The final set of strings added therefore is:
  "arg0:/foo/bar/waldo"
  "arg0-slash-prefix:/foo/bar/waldo"
  "arg0-slash-prefix:/foo/bar/"
  "arg0-slash-prefix:/foo/bar"
  "arg0-slash-prefix:/foo/"
  "arg0-slash-prefix:/foo"
  "arg0-slash-prefix:/"

7 years agopo,catalog: add zh_TW translation.
Jeff Huang [Wed, 10 Jun 2015 14:39:44 +0000 (22:39 +0800)]
po,catalog: add zh_TW translation.

7 years agosd-network: allow NULL in sd_network_monitor_unref
Tom Gundersen [Wed, 10 Jun 2015 13:55:09 +0000 (15:55 +0200)]
sd-network: allow NULL in sd_network_monitor_unref

Match rest of codebase, we always allow unref'ing NULL.

7 years agosd-bus: remove ucred parameter from bus_message_from_header() since we don't use...
Lennart Poettering [Wed, 10 Jun 2015 13:52:14 +0000 (15:52 +0200)]
sd-bus: remove ucred parameter from bus_message_from_header() since we don't use it anymore

7 years agobus-message: remove shadow warning with log_debug_bus_message()
Lennart Poettering [Wed, 10 Jun 2015 13:51:14 +0000 (15:51 +0200)]
bus-message: remove shadow warning with log_debug_bus_message()

7 years agosd-bus: Correct typo
Torstein Husebø [Wed, 10 Jun 2015 11:08:31 +0000 (13:08 +0200)]
sd-bus: Correct typo

7 years agologind,sd-event: drop spurious new-lines
Lennart Poettering [Tue, 9 Jun 2015 23:27:32 +0000 (01:27 +0200)]
logind,sd-event: drop spurious new-lines

7 years agopath-util: Fix path_is_mount_point for parent mount points in symlink mode
Martin Pitt [Tue, 9 Jun 2015 14:16:56 +0000 (16:16 +0200)]
path-util: Fix path_is_mount_point for parent mount points in symlink mode

When we have a structure like this:

  /bin -> /usr/bin
  /usr is a mount point

Then path_is_mount_point("/bin", AT_SYMLINK_FOLLOW) needs to look at the pair
/usr/bin and /usr, not at the pair / and /usr/bin, as the latter have different
mount IDs. But we only want to consider the base name, not any parent.

Thus we have to resolve the given path first to get the real parent when
allowing symlinks.

Bug: https://github.com/systemd/systemd/issues/61

7 years agoutil: Introduce unquote_first_word_and_warn
Filipe Brandenburger [Tue, 9 Jun 2015 04:31:43 +0000 (21:31 -0700)]
util: Introduce unquote_first_word_and_warn

It will try to unquot_first_word, but if it runs into escaping problems
it will retry it adding UNQUOTE_CUNESCAPE_RELAX to the flags.  If it
succeeds on the second try, it will log a warning about it.  If it fails
both times, it will log an error.

Add test cases to confirm it behaves as expected.

7 years agologind: fix delayed execution regression
Daniel Mack [Mon, 8 Jun 2015 20:58:50 +0000 (22:58 +0200)]
logind: fix delayed execution regression

Commit c0f32805 ("logind: use sd_event timer source for inhibitor
logic") reworked the main loop logic of logind so that it uses a
real timeout callback handler to execute delayed functions.

What the old code did, however, was to call those functions on
every iteration in the main loop, not only when the timeout
expired.

Restore that behavior by bringing back manager_dispatch_delayed(),
and call it from manager_run(). The internal event source callback
manager_inhibit_timeout_handler() was turned into a wrapper of
manager_dispatch_delayed() now.

7 years agosd-bus: add async convenience method call API
Umut Tezduyar Lindskog [Mon, 8 Jun 2015 08:00:17 +0000 (10:00 +0200)]
sd-bus: add async convenience method call API

7 years agosd-bus: store selinux context at connection time
Zbigniew Jędrzejewski-Szmek [Sun, 7 Jun 2015 01:24:45 +0000 (21:24 -0400)]
sd-bus: store selinux context at connection time

This appears to be the right time to do it for SOCK_STREAM
unix sockets.

Also: condition bus_get_owner_creds_dbus1 was reversed. Split
it out to a separate variable for clarity and fix.

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

7 years agosd-bus: do not use per-datagram auxiliary information
Zbigniew Jędrzejewski-Szmek [Sat, 6 Jun 2015 22:59:27 +0000 (18:59 -0400)]
sd-bus: do not use per-datagram auxiliary information

SELinux information cannot be retrieved this way, since we are
using stream unix sockets and SCM_SECURITY does not work for
them.

SCM_CREDENTIALS use dropped to be consistent. We also should
get this information at connection time.

https://bugzilla.redhat.com/show_bug.cgi?id=1224211
"SCM_SECURITY was only added for datagram sockets."

7 years agobus: don't force send-masks on kdbus buses
David Herrmann [Fri, 5 Jun 2015 13:23:03 +0000 (15:23 +0200)]
bus: don't force send-masks on kdbus buses

Right now we always pass KDBUS_ITEM_ATTACH_FLAGS_RECV to
KDBUS_CMD_BUS_MAKE, effectively forcing every bus connection to do the
same during KDBUS_CMD_HELLO. This used to be a workaround to make sure all
metadata is always present. However, we refrained from that approach and
intend to make all metadata collection solely rely on /proc access
restrictions. Therefore, there is no need to force the send-flags mask on
newly created buses.

7 years agobus: update kdbus.h
David Herrmann [Thu, 4 Jun 2015 18:26:03 +0000 (20:26 +0200)]
bus: update kdbus.h

Sync with upstream.

7 years agosd-event: don't touch fd's accross forks
Tom Gundersen [Thu, 4 Jun 2015 14:54:45 +0000 (16:54 +0200)]
sd-event: don't touch fd's accross forks

We protect most of the API from use accross forks, but we still allow both
sd_event and sd_event_source objects to be unref'ed. This would cause
problems as it would unregister sources from the underlying eventfd, hence
also affecting the original instance in the parent process.

This fixes the issue by not touching the fds on unref when done accross a fork,
but still free the memory.

This fixes a regression introduced by
        "udevd: move main-loop to sd-event": 693d371d30fee

where the worker processes were disabling the inotify event source in the
main daemon.

7 years agokdbus: remove attach_flags_mask module parameter setting
Kay Sievers [Wed, 3 Jun 2015 20:24:16 +0000 (22:24 +0200)]
kdbus: remove attach_flags_mask module parameter setting

7 years agolibudev: enumerate - accept NULL parameters in add_match()
Tom Gundersen [Wed, 3 Jun 2015 20:08:46 +0000 (22:08 +0200)]
libudev: enumerate - accept NULL parameters in add_match()

This was a regression introduced when moving to sd-device.

7 years agofstab-generator: cescape device name in root-fsck service
Andrei Borzenkov [Wed, 3 Jun 2015 17:50:59 +0000 (20:50 +0300)]
fstab-generator: cescape device name in root-fsck service

We unescape ExecStart line when parsing it, so escape device name
before adding it to unit file.

fixes #50

7 years agoutil: New flag UNQUOTE_UNESCAPE_RELAX for unquote_first_word
Filipe Brandenburger [Wed, 3 Jun 2015 04:08:24 +0000 (21:08 -0700)]
util: New flag UNQUOTE_UNESCAPE_RELAX for unquote_first_word

The new flag UNQUOTE_UNESCAPE_RELAX preserves unrecognized escape
sequences verbatim in unquote_first_word, either when it's a trailing
backslash (similar to UNQUOTE_RELAX, but in this case keep the extra
backslash in the output) or in the middle of a sequence string.

Add unit test cases to ensure the new flag works as expected and to
prevent regressions from being introduced.

Tested with a follow up commit converting config_parse_exec() to start
using unquote_first_word, in which case this flags makes it possible to
preserve unrecognized escape sequences.

Relevant bug: https://bugs.freedesktop.org/show_bug.cgi?id=90794

7 years agoremove gudev and gtk-doc
Kay Sievers [Tue, 2 Jun 2015 22:09:23 +0000 (00:09 +0200)]
remove gudev and gtk-doc

The library moved to:
  https://git.gnome.org/browse/libgudev/

7 years agofix double semicolon typo
Thomas Hindoe Paaboel Andersen [Tue, 2 Jun 2015 21:20:15 +0000 (23:20 +0200)]
fix double semicolon typo

7 years agoresolve: move dns routines into shared
Nick Owens [Tue, 2 Jun 2015 18:49:43 +0000 (11:49 -0700)]
resolve: move dns routines into shared

7 years agobuild-sys: Normalize paths of configure options
Michael Biebl [Sat, 30 May 2015 01:04:55 +0000 (03:04 +0200)]
build-sys: Normalize paths of configure options

Strip trailing slashes from options such as --with-rootprefix, so that building
with rootprefix="/" results in paths like "/lib" instead of "//lib".

Also handle paths such as "/usr/" gracefully.

Use m4/ax_normalize_path.m4 from the autoconf-archive project, which is now
included in our tree as per usual practices in using autoconf-archive macros.

Tested with the following configure options:
  ./configure \
        --with-rootprefix=/ \
        --with-rootlibdir=/lib64/ \
        --prefix=/usr/ \
        --libdir=/lib/ \
        --with-bashcompletiondir=/bash-completion/completions/

(The "prefix" and "libdir" are already automatically normalized by Autoconf,
this command is testing the others.)

Compared the config.log and resulting trees (in particular man pages) to
confirm double slashes were not present in the latter.

Also tested that a configuration using default options is not affected and that
`make distcheck` still works as expected.

7 years agologind: Add a udev rule to tag all DRM cards with master-of-seat
Philip Withnall [Tue, 2 Jun 2015 14:24:48 +0000 (15:24 +0100)]
logind: Add a udev rule to tag all DRM cards with master-of-seat

This is needed for generic DRM devices like the VirtualBox vboxvideo
driver, which exposes itself as a generic, ID-less DRM device at
/dev/dri/card0 (after applying this commit):
   $ udevadm info --query=all --path \
      /sys/devices/pci0000:00/0000:00:02.0/drm/card0
   P: /devices/pci0000:00/0000:00:02.0/drm/card0
   N: dri/card0
   E: DEVNAME=/dev/dri/card0
   E: DEVPATH=/devices/pci0000:00/0000:00:02.0/drm/card0
   E: DEVTYPE=drm_minor
   E: ID_FOR_SEAT=drm-pci-0000_00_02_0
   E: ID_PATH=pci-0000:00:02.0
   E: ID_PATH_TAG=pci-0000_00_02_0
   E: MAJOR=226
   E: MINOR=0
   E: SUBSYSTEM=drm
   E: TAGS=:master-of-seat:seat:uaccess:
   E: USEC_INITIALIZED=59893

Without this patch, the capabilities for a seat on a VirtualBox
installation of systemd v219 incorrectly show it as non-graphical, even
though I can type these commands from an xterm:
   $ loginctl show-seat seat0
   Id=seat0
   CanMultiSession=yes
   CanTTY=yes
   CanGraphical=no
   …

https://bugs.freedesktop.org/show_bug.cgi?id=90822

7 years agologind: Save the user’s state when a session enters SESSION_ACTIVE
Philip Withnall [Tue, 2 Jun 2015 13:17:10 +0000 (14:17 +0100)]
logind: Save the user’s state when a session enters SESSION_ACTIVE

When (for example) switching from X11 to a new VT and logging in there,
creating a new session, the user state file (/run/systemd/users/$uid) is
not updated after the session becomes active. The latest time it is
saved is when the session is in SESSION_OPENING.

This results in a /run/systemd/users/$uid file which contains
STATE=online for the current user on the current active VT, which is
obviously wrong.

As functions like sd_uid_get_state() use this file to get the user’s
state, this could result in things like PolicyKit making incorrect
decisions about the user’s state. (See
https://bugs.freedesktop.org/show_bug.cgi?id=76358.)

Fix this by re-saving the state for a session’s user after completing
the state_job for that session.

https://bugs.freedesktop.org/show_bug.cgi?id=90818

7 years agosd-device: get_driver - remember if a device does not have a driver
Tom Gundersen [Mon, 1 Jun 2015 21:53:37 +0000 (23:53 +0200)]
sd-device: get_driver - remember if a device does not have a driver

Don't try to read it again.

7 years agosd-device: get_subsystem - don't complain if a device does not have a subsystem
Tom Gundersen [Mon, 1 Jun 2015 21:51:37 +0000 (23:51 +0200)]
sd-device: get_subsystem - don't complain if a device does not have a subsystem

7 years agosd-device: ensure update_properties_buf() is a noop on failure
Tom Gundersen [Mon, 1 Jun 2015 14:28:58 +0000 (16:28 +0200)]
sd-device: ensure update_properties_buf() is a noop on failure

Don't clobber the sd_device struct, and don't leak memory when memory allocation fails.

7 years agoshared: Drop 'name=' prefix from SYSTEMD_CGROUP_CONTROLLER define.
Dimitri John Ledkov [Mon, 1 Jun 2015 11:46:52 +0000 (12:46 +0100)]
shared: Drop 'name=' prefix from SYSTEMD_CGROUP_CONTROLLER define.

In cgtop,mount-setup,nspawn the name= prefix is hard-coded in the
mount options, and the define is not used.

Everywhere else, we explicitly white-list allow 'name=' prefix to be
used with all controllers, and strip it out to 'normalise' the
controller name. That work is mostly inflicted on us due to 'name='
prefix in the define. Dropping this prefix makes everything more sane
overall.

7 years agosd-device: fix invalid property strv pointers
Martin Pitt [Mon, 1 Jun 2015 09:32:39 +0000 (11:32 +0200)]
sd-device: fix invalid property strv pointers

In device_update_properties_bufs(), the strv is built from pointers into the
single nul-terminated buf_nulstr string, to avoid allocating the key=value
strings twice. However, we must not do that while building and
GREEDY_REALLOC0()'ing buf_nulstr, as each time when this actually reallocates
memory the pointers we wrote into buf_strv so far become invalid.

So change the logic to first completely build the new buf_nulstr, and then
iterate over it to pick out the pointers to the individual key=value strings
for properties_strv.

This fixes invalid environment for udev callouts.

7 years agotree-wide: whenever we fork off a foreign child process reset signal mask/handlers
Lennart Poettering [Sun, 31 May 2015 21:55:55 +0000 (23:55 +0200)]
tree-wide: whenever we fork off a foreign child process reset signal mask/handlers

Also, when the child is potentially long-running make sure to set a
death signal.

Also, ignore the result of the reset operations explicitly by casting
them to (void).

7 years agoconf-parser: parsing error logs should show a type not a vartype
Ronny Chevalier [Sat, 30 May 2015 10:21:26 +0000 (12:21 +0200)]
conf-parser: parsing error logs should show a type not a vartype

Instead of this:
[filename:1] Failed to parse nsec_t value, ignoring: garbage

we show this:
[filename:1] Failed to parse nsec value, ignoring: garbage

7 years agoutil: split out signal-util.[ch] from util.[ch]
Lennart Poettering [Fri, 29 May 2015 18:14:11 +0000 (20:14 +0200)]
util: split out signal-util.[ch] from util.[ch]

No functional changes.

7 years agopath-util: Change path_is_mount_point() symlink arg from bool to flags
Martin Pitt [Fri, 29 May 2015 15:13:12 +0000 (17:13 +0200)]
path-util: Change path_is_mount_point() symlink arg from bool to flags

This makes path_is_mount_point() consistent with fd_is_mount_point() wrt.
flags.

7 years agologind: Fix user_elect_display() to be more stable
Philip Withnall [Fri, 29 May 2015 09:49:21 +0000 (10:49 +0100)]
logind: Fix user_elect_display() to be more stable

The previous implementation of user_elect_display() could easily end up
overwriting the user’s valid graphical session with a new TTY session.
For example, consider the situation where there is one session:
   c1, type = SESSION_X11, !stopping, class = SESSION_USER
it is initially elected as the user’s display (i.e. u->display = c1).

If another session is started, on a different VT, the sessions_by_user
list becomes:
   c1, type = SESSION_X11, !stopping, class = SESSION_USER
   c2, type = SESSION_TTY, !stopping, class = SESSION_USER

In the previous code, graphical = c1 and text = c2, as expected.
However, neither graphical nor text fulfil the conditions for setting
u->display = graphical (because neither is better than u->display), so
the code falls through to check the text variable. The conditions for
this match, as u->display->type != SESSION_TTY (it’s actually
SESSION_X11). Hence u->display is set to c2, which is incorrect, because
session c1 is still valid.

Refactor user_elect_display() to use a more explicit filter and
pre-order comparison over the sessions. This can be demonstrated to be
stable and only ever ‘upgrade’ the session to a more graphical one.

https://bugs.freedesktop.org/show_bug.cgi?id=90769

7 years agosd-bus: dump sync messages in debug mode
Umut Tezduyar Lindskog [Fri, 29 May 2015 07:48:11 +0000 (09:48 +0200)]
sd-bus: dump sync messages in debug mode

7 years agosd-device: enumerator - fix matching on properties and sysattrs
Tom Gundersen [Thu, 28 May 2015 15:18:33 +0000 (17:18 +0200)]
sd-device: enumerator - fix matching on properties and sysattrs

This was a regression that broke

  $ udevadm trigger -nv --property-match=DEVNAME=/dev/sda1 --attr-match=size=409600

Reported by David Reisner.

7 years agosd-device: fix device_get_properties_strv()
Tom Gundersen [Wed, 27 May 2015 21:26:39 +0000 (23:26 +0200)]
sd-device: fix device_get_properties_strv()

A NULL pointer was inserted as the first element of the strv.

This had the effect of always passing the empty environment to processes
spawned by udev.

Reported by Michał Bartoszkiewicz.

7 years agosystemctl: drop hardcoded chkconfig invocation
Martin Pitt [Wed, 27 May 2015 15:04:49 +0000 (17:04 +0200)]
systemctl: drop hardcoded chkconfig invocation

Introduce /usr/lib/systemd/systemd-sysv-install [--root=] <action> <name>
abstraction, replacing the direct calling of chkconfig. This allows
distributions to call their specific tools like update-rc.d without patching
systemd.

Ship systemd-sysv-install.SKELETON as an example for packagers how to implement
this.

Drop the --enable-chkconfig configure option.

Document this in README and point to it in NEWS.

7 years agologind: prefix some calls to unlink with (void)
Daniel Mack [Wed, 27 May 2015 13:20:58 +0000 (15:20 +0200)]
logind: prefix some calls to unlink with (void)

Make Coverity happy and tell it we're not interested in the return
value of these two calls.

7 years agoman: generate configured paths in manpages
Filipe Brandenburger [Wed, 27 May 2015 09:38:19 +0000 (02:38 -0700)]
man: generate configured paths in manpages

In particular, use /lib/systemd instead of /usr/lib/systemd in distributions
like Debian which still have not adopted a /usr merge setup.

Use XML entities from man/custom-entities.ent to replace configured paths while
doing XSLT processing of the original XML files. There was precedent of some
files (such as systemd.generator.xml) which were already using this approach.

This addresses most of the (manual) fixes from this patch:
http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/tree/debian/patches/Fix-paths-in-man-pages.patch?h=experimental-220

The idea of using generic XML entities was presented here:
http://lists.freedesktop.org/archives/systemd-devel/2015-May/032240.html

This patch solves almost all the issues, with the exception of:
- Path to /bin/mount and /bin/umount.
- Generic statements about preference of /lib over /etc.

These will be handled separately by follow up patches.

Tested:
- With default configure settings, ran "make install" to two separate
  directories and compared the output to confirm they matched exactly.
- Used a set of configure flags including $CONFFLAGS from Debian:
  http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/tree/debian/rules
  Installed the tree and confirmed the paths use /lib/systemd instead of
  /usr/lib/systemd and that no other unexpected differences exist.
- Confirmed that `make distcheck` still passes.

7 years agopath-util: Fix path_is_mount_point for files
Martin Pitt [Wed, 27 May 2015 07:56:03 +0000 (09:56 +0200)]
path-util: Fix path_is_mount_point for files

Commits 27cc6f166 and f25afeb broke path_is_mount_point() for files (such as
/etc/machine-id → /run/machine-id bind mounts) as with the factorization of
fd_is_mount_point() we lost the parent directory. We cannot determine that from
an fd only as openat(fd, "..") only works for directory fds.

Change fd_is_mount_point() to behave like openat(): It now takes a file
descriptor of the containing directory, a file name in it, and flags (which can
be 0 or AT_SYMLINK_FOLLOW). Unlike name_to_handle_at() or openat(), fstatat()
only accepts the inverse flag AT_SYMLINK_NOFOLLOW and complains with EINVAL
about AT_SYMLINK_FOLLOW; so we need to transform the flags for that fallback.

Adjust rm_rf_children() accordingly (only other caller of fd_is_mount_point()
aside from path_is_mount_point()).

Add test cases for files, links, and file bind mounts (the latter will only
work when running as root). Split out a new test_path_is_mount_point() test
case function as it got significantly larger now.

7 years agotreewide: fix typos
Torstein Husebø [Tue, 26 May 2015 17:17:30 +0000 (19:17 +0200)]
treewide: fix typos

7 years agologind: unlink /run/nologin when shutdown is cancelled
Daniel Mack [Tue, 26 May 2015 16:56:40 +0000 (18:56 +0200)]
logind: unlink /run/nologin when shutdown is cancelled

When a scheduled is cancelled, make sure to remove /run/nologin.
This is a regression from the recent shutdownd removal and logind rework.

7 years agobus-creds: always set SD_BUS_CREDS_PID when we set pid in the mask
Zbigniew Jędrzejewski-Szmek [Mon, 25 May 2015 00:20:06 +0000 (20:20 -0400)]
bus-creds: always set SD_BUS_CREDS_PID when we set pid in the mask

Also reorder the code a bit to be easier to parse.

7 years agoshared: generator - correct path to systemd-fsck
Mike Gilbert [Sun, 24 May 2015 20:33:35 +0000 (16:33 -0400)]
shared: generator - correct path to systemd-fsck

In generated systemd-fsck-root.service. This would break if rootprefix
is not /usr/lib/systemd.

[tomegun: flesh out commit message]

7 years agosd-bus,sd-event: make public APIs
Lennart Poettering [Fri, 22 May 2015 12:32:51 +0000 (14:32 +0200)]
sd-bus,sd-event: make public APIs

With the v221 release these APIs should be public, stable APIs, hence
let's install their headers by default now, and add their symbols to the
.sym file.

7 years agoRename systemd-logind to logind.
Ricardo Wurmus [Sun, 3 May 2015 20:26:52 +0000 (22:26 +0200)]
Rename systemd-logind to logind.

7 years agoRemove unused and invalid udev definitions
Andy Wingo [Mon, 20 Apr 2015 19:10:49 +0000 (21:10 +0200)]
Remove unused and invalid udev definitions

These definitions were not valid when compiling against eudev.

7 years agoGet rid of some more unused defines and dirs
Andy Wingo [Sun, 19 Apr 2015 15:02:47 +0000 (17:02 +0200)]
Get rid of some more unused defines and dirs

7 years agologind will always be built
Andy Wingo [Sun, 19 Apr 2015 13:58:17 +0000 (15:58 +0200)]
logind will always be built

7 years agoCompiling.
Andy Wingo [Wed, 8 Apr 2015 09:08:16 +0000 (11:08 +0200)]
Compiling.

7 years agoRemove SysV compat
Andy Wingo [Wed, 8 Apr 2015 06:45:34 +0000 (08:45 +0200)]
Remove SysV compat

7 years agoremove non-login things from man
Andy Wingo [Wed, 8 Apr 2015 06:11:45 +0000 (08:11 +0200)]
remove non-login things from man

7 years agojson: minor style fixes
Lennart Poettering [Thu, 21 May 2015 21:30:37 +0000 (23:30 +0200)]
json: minor style fixes

7 years agotmpfiles: create /etc/resolv.conf symlink only on boot
Zbigniew Jędrzejewski-Szmek [Thu, 21 May 2015 18:22:30 +0000 (14:22 -0400)]
tmpfiles: create /etc/resolv.conf symlink only on boot

We will create the symlink on boot as a fallback to provide name
resolution. But if the symlink was removed afterwards, it most likely
should not be recreated. Creating it only on boot also solves the
issue where it would be created prematurely during installation,
before the system was actually booted.

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

7 years agoutil: an array with one entry is always ordered
Lennart Poettering [Thu, 21 May 2015 17:49:03 +0000 (19:49 +0200)]
util: an array with one entry is always ordered

7 years agoutil: introduce PERSONALITY_INVALID as macro for 0xffffffffLU
Lennart Poettering [Thu, 21 May 2015 17:48:49 +0000 (19:48 +0200)]
util: introduce PERSONALITY_INVALID as macro for 0xffffffffLU

7 years agonspawn: finish user namespace support
Lennart Poettering [Thu, 21 May 2015 14:30:58 +0000 (16:30 +0200)]
nspawn: finish user namespace support

7 years agosd-device: fix return codes on error
Zbigniew Jędrzejewski-Szmek [Thu, 21 May 2015 03:34:12 +0000 (23:34 -0400)]
sd-device: fix return codes on error

asprintf() does not set errno.

7 years agojson: avoid cleanup of unitialized variable
Zbigniew Jędrzejewski-Szmek [Thu, 21 May 2015 03:25:48 +0000 (23:25 -0400)]
json: avoid cleanup of unitialized variable

7 years agounits: conditionalize audit multicast socket on CAP_AUDIT_READ
Lennart Poettering [Wed, 20 May 2015 15:40:05 +0000 (17:40 +0200)]
units: conditionalize audit multicast socket on CAP_AUDIT_READ

The multicast logic can only work if the capability is available, hence
require it.

7 years agoutil: introduce reset_uid_gid() for resetting all uids and gids to 0
Lennart Poettering [Wed, 20 May 2015 12:41:39 +0000 (14:41 +0200)]
util: introduce reset_uid_gid() for resetting all uids and gids to 0

7 years agojson: fix a mem leak
Thomas Hindoe Paaboel Andersen [Tue, 19 May 2015 21:19:29 +0000 (23:19 +0200)]
json: fix a mem leak

7 years agocore,nspawn: unify code that moves the root dir
Lennart Poettering [Tue, 19 May 2015 18:32:44 +0000 (20:32 +0200)]
core,nspawn: unify code that moves the root dir

7 years agoimport/pull-dkr: V2 image specification and manifest support
Pavel Odvody [Tue, 19 May 2015 14:30:33 +0000 (16:30 +0200)]
import/pull-dkr: V2 image specification and manifest support

The maximum number of layers changed to 127, as in Dkr.

7 years agoshared/json: Added DOM-like JSON parser
Pavel Odvody [Tue, 19 May 2015 14:29:42 +0000 (16:29 +0200)]
shared/json: Added DOM-like JSON parser

This makes working with complexly structured documents easy
and more reliable as the parser is not susceptible to
element re-ordering.

Also fixes a bug when the tokenizer would choke after reading
a number.

7 years agoshared/import-util: Tag renamed to reference
Pavel Odvody [Tue, 19 May 2015 14:29:29 +0000 (16:29 +0200)]
shared/import-util: Tag renamed to reference

Added (sha256) digest validation function

7 years agoutil: fix typo
Jan Synacek [Tue, 19 May 2015 12:26:09 +0000 (14:26 +0200)]
util: fix typo

7 years agohostname: Allow comments in /etc/hostname
Martin Pitt [Tue, 19 May 2015 05:49:56 +0000 (07:49 +0200)]
hostname: Allow comments in /etc/hostname

The hostname(1) tool allows comments in /etc/hostname. Introduce a new
read_hostname_config() in hostname-util which reads a hostname configuration
file like /etc/hostname, strips out comments, whitespace, and cleans the
hostname. Use it in hostname-setup.c and hostnamed and remove duplicated code.

Update hostname manpage. Add tests.

https://launchpad.net/bugs/1053048

7 years agocore: introduce seperate reverse dependencies for Requires= and Requisite=
Lennart Poettering [Mon, 18 May 2015 23:24:28 +0000 (01:24 +0200)]
core: introduce seperate reverse dependencies for Requires= and Requisite=

This allows us to ensure that Requisite= dependencies never cause
propagation between units, while Requires= dependencies might.

http://lists.freedesktop.org/archives/systemd-devel/2015-May/031742.html

7 years agojournalctl: clean up how we log errors
Lennart Poettering [Mon, 18 May 2015 22:25:45 +0000 (00:25 +0200)]
journalctl: clean up how we log errors

All functions should either log the errors they run into, or only return
them in which case the caller should log them.

Make sure this rule is followed, so that each error is logged precisely
once, and neither never, nor more than once.

7 years agoresolved: fix crash when shutting down
Lennart Poettering [Mon, 18 May 2015 21:23:17 +0000 (23:23 +0200)]
resolved: fix crash when shutting down

Reported by Cristian Rodríguez

http://lists.freedesktop.org/archives/systemd-devel/2015-May/031626.html

7 years agoutil: split all hostname related calls into hostname-util.c
Lennart Poettering [Mon, 18 May 2015 15:10:07 +0000 (17:10 +0200)]
util: split all hostname related calls into hostname-util.c

7 years agofstab-generator: add x-systemd.requires and x-systemd.requires-mounts-for
Karel Zak [Mon, 18 May 2015 10:30:37 +0000 (12:30 +0200)]
fstab-generator: add x-systemd.requires and x-systemd.requires-mounts-for

Currently we have no way how to specify dependencies between fstab
entries (or another units) in the /etc/fstab. It means that users are
forced to bypass fstab and write .mount units manually.

The patch introduces new systemd fstab options:

x-systemd.requires=<PATH>

 - to specify dependence an another mount (PATH is translated to unit name)

x-systemd.requires=<UNIT>

 - to specify dependence on arbitrary UNIT

x-systemd.requires-mounts-for=<PATH ...>

 - to specify dependence on another paths, implemented by
   RequiresMountsFor=. The option may be specified more than once.

For example two bind mounts where B depends on A:

 /mnt/test/A    /mnt/test/A     none    bind,defaults
 /mnt/test/A    /mnt/test/B     none    bind,x-systemd.requires=/mnt/test/A

More complex example with overlay FS where one mount point depends on
"low" and "upper" directories:

 /dev/sdc1   /mnt/low    ext4     defaults
 /dev/sdc2   /mnt/high   ext4     defaults
 overlay     /mnt/merged overlay  lowerdir=/mnt/low,upperdir=/mnt/high/data,workdir=/mnt/high/work,x-systemd.requires-mounts-for=/mnt/low,x-systemd.requires-mounts-for=mnt/high

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

7 years agobus-socket: simplify initalization of struct msghdr
Zbigniew Jędrzejewski-Szmek [Sat, 16 May 2015 15:06:43 +0000 (11:06 -0400)]
bus-socket: simplify initalization of struct msghdr

7 years agoutil: loop_write - accept 0-length message
Tom Gundersen [Fri, 15 May 2015 23:07:45 +0000 (01:07 +0200)]
util: loop_write - accept 0-length message

write() can send empty messages, so make sure loop_write() can do the same.

7 years agounits: make networkd pull in its own .busname unit
Tom Gundersen [Fri, 15 May 2015 20:59:24 +0000 (22:59 +0200)]
units: make networkd pull in its own .busname unit

The daemon requires the busname unit to operate (on kdbus systems),
since it contains the policy that allows it to acquire its service
name.

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=90287

7 years agosocket-util: socket_address_parse() should not log errors on its own
Lennart Poettering [Fri, 15 May 2015 18:15:59 +0000 (20:15 +0200)]
socket-util: socket_address_parse() should not log errors on its own

Given that socket_address_parse() is mostly a "library" call it
shouldn't log on its own, but leave that to its caller.

This patch removes logging from the call in case IPv6 is not available
but and IPv6 address shall be parsed. Instead a new call
socket_address_parse_and_warn() is introduced which first invokes
socket_address_parse() and then logs if necessary.

This should fix "make check" on ipv6-less kernels:

http://lists.freedesktop.org/archives/systemd-devel/2015-April/031385.html

7 years agogenerator: use fflush_and_check() where appropriate
Lennart Poettering [Fri, 15 May 2015 15:06:59 +0000 (17:06 +0200)]
generator: use fflush_and_check() where appropriate

7 years agocore: don't consider umask for SocketMode=
Davide Bettio [Fri, 15 May 2015 14:36:28 +0000 (16:36 +0200)]
core: don't consider umask for SocketMode=

https://bugs.freedesktop.org/show_bug.cgi?id=89248

7 years agosystemctl: introduce --now for enable, disable and mask
Jan Synacek [Fri, 15 May 2015 07:54:10 +0000 (09:54 +0200)]
systemctl: introduce --now for enable, disable and mask

https://bugs.freedesktop.org/show_bug.cgi?id=42940

7 years agonspawn: allow access to device nodes listed in --bind= and --bind-ro= switches
Stefan Junker [Thu, 14 May 2015 20:51:05 +0000 (22:51 +0200)]
nspawn: allow access to device nodes listed in --bind= and --bind-ro= switches

https://bugs.freedesktop.org/show_bug.cgi?id=90385

7 years agotest-bus-chat: various modernizations
Lennart Poettering [Thu, 14 May 2015 20:41:19 +0000 (22:41 +0200)]
test-bus-chat: various modernizations

7 years agoutil: introduce memmem_safe() and make use of it
Lennart Poettering [Thu, 14 May 2015 09:30:59 +0000 (11:30 +0200)]
util: introduce memmem_safe() and make use of it

GNU memmem() requires a nonnull first parameter. Let's introduce
memmem_safe() that removes this restriction for zero-length parameters,
and make use of it where appropriate.

http://lists.freedesktop.org/archives/systemd-devel/2015-May/031705.html

7 years agoutil: use GNU comparison function prototype for qsort_safe()
Lennart Poettering [Thu, 14 May 2015 09:30:14 +0000 (11:30 +0200)]
util: use GNU comparison function prototype for qsort_safe()

7 years agoutil: add generic calls for prefixing a root directory to a path
Lennart Poettering [Wed, 13 May 2015 15:42:10 +0000 (17:42 +0200)]
util: add generic calls for prefixing a root directory to a path

So far a number of utilities implemented their own calls for this, unify
them in prefix_root() and prefix_roota(). The former uses heap memory,
the latter allocates from the stack via alloca().

Port over most users of a --root= logic.

7 years agonspawn: skip symlink to a combined cgroup hierarchy if it already exists
Iago López Galeiras [Wed, 13 May 2015 13:45:49 +0000 (15:45 +0200)]
nspawn: skip symlink to a combined cgroup hierarchy if it already exists

If a symlink to a combined cgroup hierarchy already exists and points to
the right path, skip it. This avoids an error when the cgroups are set
manually before calling nspawn.