chiark / gitweb /
elogind.git
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.

7 years agoinstall: when exporting prefix InstallInfo to become UnitFileInstallInfo
Lennart Poettering [Mon, 11 May 2015 20:53:54 +0000 (22:53 +0200)]
install: when exporting prefix InstallInfo to become UnitFileInstallInfo

All other types exported from install.h should be namespaces like this,
hence namespace InstallInfo the same way.

Also, remove external forward definition of UnitFileScope type.

7 years agocore: rename SystemdRunningAs to ManagerRunningAs
Lennart Poettering [Mon, 11 May 2015 20:51:49 +0000 (22:51 +0200)]
core: rename SystemdRunningAs to ManagerRunningAs

It's primarily just a property of the Manager object after all, and we
try to refer to PID 1 as "manager" instead of "systemd", hence let's to
stick to this here too.

7 years agoudevd: make udev_ctrl_connection global
Tom Gundersen [Mon, 11 May 2015 20:17:49 +0000 (22:17 +0200)]
udevd: make udev_ctrl_connection global

This allows us to simplify the ctrl_msg handler. Eventually all this global state should move to
a Manager object or so.

7 years agocore,network: major per-object logging rework
Lennart Poettering [Mon, 11 May 2015 18:38:21 +0000 (20:38 +0200)]
core,network: major per-object logging rework

This changes log_unit_info() (and friends) to take a real Unit* object
insted of just a unit name as parameter. The call will now prefix all
logged messages with the unit name, thus allowing the unit name to be
dropped from the various passed romat strings, simplifying invocations
drastically, and unifying log output across messages. Also, UNIT= vs.
USER_UNIT= is now derived from the Manager object attached to the Unit
object, instead of getpid(). This has the benefit of correcting the
field for --test runs.

Also contains a couple of other logging improvements:

- Drops a couple of strerror() invocations in favour of using %m.

- Not only .mount units now warn if a symlinks exist for the mount
  point already, .automount units do that too, now.

- A few invocations of log_struct() that didn't actually pass any
  additional structured data have been replaced by simpler invocations
  of log_unit_info() and friends.

- For structured data a new LOG_UNIT_MESSAGE() macro has been added,
  that works like LOG_MESSAGE() but prefixes the message with the unit
  name. Similar, there's now LOG_LINK_MESSAGE() and
  LOG_NETDEV_MESSAGE().

- For structured data new LOG_UNIT_ID(), LOG_LINK_INTERFACE(),
  LOG_NETDEV_INTERFACE() macros have been added that generate the
  necessary per object fields. The old log_unit_struct() call has been
  removed in favour of these new macros used in raw log_struct()
  invocations. In addition to removing one more function call this
  allows generated structured log messages that contain two object
  fields, as necessary for example for network interfaces that are
  joined into another network interface, and whose messages shall be
  indexed by both.

- The LOG_ERRNO() macro has been removed, in favour of
  log_struct_errno(). The latter has the benefit of ensuring that %m in
  format strings is properly resolved to the specified error number.

- A number of logging messages have been converted to use
  log_unit_info() instead of log_info()

- The client code in sysv-generator no longer #includes core code from
  src/core/.

- log_unit_full_errno() has been removed, log_unit_full() instead takes
  an errno now, too.

- log_unit_info(), log_link_info(), log_netdev_info() and friends, now
  avoid double evaluation of their parameters

7 years agoutil: optimize free_and_strdup() if NOP
Lennart Poettering [Mon, 11 May 2015 18:09:58 +0000 (20:09 +0200)]
util: optimize free_and_strdup() if NOP

Under the assumption that strcmp() is cheaper than memory allocation,
let's avoid the allocation, if the new value is identical to the old.

7 years agoshared: Use O_EXCL with O_TMPFILE in open_tmpfile
Cristian Rodríguez [Mon, 11 May 2015 18:01:37 +0000 (15:01 -0300)]
shared: Use O_EXCL with O_TMPFILE in open_tmpfile

In this usecase, the file will never be materialized
with linkat().

7 years agotreewide: Correct typos and spell plural of bus consistent
Torstein Husebø [Mon, 11 May 2015 11:49:29 +0000 (13:49 +0200)]
treewide: Correct typos and spell plural of bus consistent

7 years agosd-bus: fix memory leak in test-bus-chat
Cristian Rodríguez [Sun, 10 May 2015 01:14:09 +0000 (22:14 -0300)]
sd-bus: fix memory leak in test-bus-chat

Building with address sanitizer enabled on GCC 5.1.x a memory leak
is reported because we never close the bus, fix it by using
cleanup variable attribute.

7 years agobus: don't switch to kdbus if not requested
David Herrmann [Wed, 6 May 2015 16:18:43 +0000 (18:18 +0200)]
bus: don't switch to kdbus if not requested

Whenever systemd is re-executed, it tries to create a system bus via
kdbus. If the system did not have kdbus loaded during bootup, but the
module is loaded later on manually, this will cause two system buses
running (kdbus and dbus-daemon in parallel).

This patch makes sure we never try to create kdbus buses if it wasn't
explicitly requested on the command-line.

7 years agoGenerate systemd-fsck-root.service in the initramfs
Zbigniew Jędrzejewski-Szmek [Wed, 6 May 2015 05:09:53 +0000 (01:09 -0400)]
Generate systemd-fsck-root.service in the initramfs

In the initrafms, generate a systemd-fsck-root.service to replace
systemd-fsck@<sysroot-device>.service. This way, after we transition
to the real root, systemd-fsck-root.service is marked as already done.

This introduces an unnecessary synchronization point, because
systemd-fsck@* is ordered after systemd-fsck-root also in the
initramfs. In practice this shouldn't be a problem.

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

C.f. 956eaf2b8d6c9999024705ddadc7393bc707de02.

7 years agocore: be more strict when manipulating slices names and unescaping paths from unit...
Lennart Poettering [Tue, 5 May 2015 20:39:14 +0000 (13:39 -0700)]
core: be more strict when manipulating slices names and unescaping paths from unit names

Let's better be safe then sorry.

7 years agoFix permissions on /run/systemd/nspawn/locks
Seth Jennings [Tue, 5 May 2015 18:31:01 +0000 (13:31 -0500)]
Fix permissions on /run/systemd/nspawn/locks

machined is getting an EACCES when trying to create the lock file for
images because the mode on /run/systemd/nspawn/locks is 0600.

mkdir("/run/systemd/nspawn/locks", 0600) = -1 EEXIST (File exists)
stat("/run/systemd/nspawn/locks", {st_mode=S_IFDIR|0600, st_size=40, ...}) = 0
open("/run/systemd/nspawn/locks/inode-41:256", O_RDWR|O_CREAT|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC, 0600) = -1 EACCES (Permission denied)

This commit adjusts the mode to 0700 to correct the issue.

7 years agolockfile-util.[ch]: Split out from util.[ch]
Colin Walters [Mon, 4 May 2015 20:12:46 +0000 (16:12 -0400)]
lockfile-util.[ch]: Split out from util.[ch]

Continuing the general trend of splitting up util.[ch].  I specifically
want to reuse this code in https://github.com/GNOME/libglnx and
having it split up will make future copy-pasting easier.

7 years agogenerators: rename add_{root,usr}_mount to add_{sysroot,sysroot_usr}_mount
Zbigniew Jędrzejewski-Szmek [Sat, 2 May 2015 17:01:29 +0000 (12:01 -0500)]
generators: rename add_{root,usr}_mount to add_{sysroot,sysroot_usr}_mount

This makes it obvious that those functions are only usable in the
initramfs.

Also, add a warning when noauto, nofail, or automount is used for the
root fs, instead of silently ignoring. Using those options would be a
sign of significant misconfiguration, and if we bother to check for
them, than let's go all the way and complain.

Other various small cleanups and reformattings elsewhere.

7 years agocore: rework unit name validation and manipulation logic
Lennart Poettering [Thu, 30 Apr 2015 18:21:00 +0000 (20:21 +0200)]
core: rework unit name validation and manipulation logic

A variety of changes:

- Make sure all our calls distuingish OOM from other errors if OOM is
  not the only error possible.

- Be much stricter when parsing escaped paths, do not accept trailing or
  leading escaped slashes.

- Change unit validation to take a bit mask for allowing plain names,
  instance names or template names or an combination thereof.

- Refuse manipulating invalid unit name

7 years agoutil: be a bit safer in path_is_safe()
Lennart Poettering [Thu, 30 Apr 2015 17:44:10 +0000 (19:44 +0200)]
util: be a bit safer in path_is_safe()

We should be more strict when verifying paths with path_is_safe() for
potentially dangerous constructs, and that includes lengths of
PATH_MAX-1 and larger. Be more accurate here.

7 years agocore: catch some special cases in cg_slice_to_path()
Lennart Poettering [Thu, 30 Apr 2015 10:33:35 +0000 (12:33 +0200)]
core: catch some special cases in cg_slice_to_path()

7 years agosym: adding missing symbols to .sym file
Lennart Poettering [Thu, 30 Apr 2015 10:01:19 +0000 (12:01 +0200)]
sym: adding missing symbols to .sym file

7 years agosd-bus,sd-login: add api for querying the slice within the the user systemd instance...
Lennart Poettering [Thu, 30 Apr 2015 09:58:06 +0000 (11:58 +0200)]
sd-bus,sd-login: add api for querying the slice within the the user systemd instance of a process

units are organized in slice trees, not only for the system instance,
but also for user systemd instances, expose this properly.

7 years agosd-bus: when we get ENOTTY on the HELLO ioctl assume incompatible API version
Lennart Poettering [Wed, 29 Apr 2015 23:24:48 +0000 (01:24 +0200)]
sd-bus: when we get ENOTTY on the HELLO ioctl assume incompatible API version

As perparation for future incompatible kdbus kernel API changes.

7 years agocore: rework cgroup path parse logic
Lennart Poettering [Wed, 29 Apr 2015 22:47:41 +0000 (00:47 +0200)]
core: rework cgroup path parse logic

Various cleanups, be stricter when parsing unit paths.

Most importantly: return the root slice "-.slice" when asked for slice
of paths that contain no slice component.

7 years agoman: document when the various sd-login.h calls return ENXIO
Lennart Poettering [Wed, 29 Apr 2015 19:45:45 +0000 (21:45 +0200)]
man: document when the various sd-login.h calls return ENXIO

7 years agosd-bus: properly handle creds that are known but undefined for a process
Lennart Poettering [Wed, 29 Apr 2015 19:40:54 +0000 (21:40 +0200)]
sd-bus: properly handle creds that are known but undefined for a process

A number of fields do not apply to all processes, including: there a
processes without a controlling tty, without parent process, without
service, user services or session. To distuingish these cases from the
case where we simply don't have the data, always return ENXIO for them,
while returning ENODATA for the case where we really lack the
information.

Also update the credentials dumping code to show this properly. Fields
that are known but do not apply are now shown as "n/a".

Note that this also changes some of the calls in process-util.c and
cgroup-util.c to return ENXIO for these cases.

7 years agosd-bus: allow passing NULL as bus parameter to sd_bus_send()
Lennart Poettering [Wed, 29 Apr 2015 16:58:30 +0000 (18:58 +0200)]
sd-bus: allow passing NULL as bus parameter to sd_bus_send()

If NULL is specified for the bus it is now automatically derived from
the passed in message.

This commit also changes a number of invocations of sd_bus_send() to
make use of this.

7 years agosd-bus: drop bus parameter from message callback prototype
Lennart Poettering [Wed, 29 Apr 2015 16:35:10 +0000 (18:35 +0200)]
sd-bus: drop bus parameter from message callback prototype

This should simplify the prototype a bit. The bus parameter is redundant
in most cases, and in the few where it matters it can be derived from
the message via sd_bus_message_get_bus().

7 years agobus-util: drop redundant bus argument from bus_message_map_all_properties() and relat...
Lennart Poettering [Tue, 28 Apr 2015 18:48:54 +0000 (20:48 +0200)]
bus-util: drop redundant bus argument from bus_message_map_all_properties() and related calls

7 years agoexit-status: introduce common exit_status_set_test() call for testing exit status...
Lennart Poettering [Tue, 28 Apr 2015 16:24:20 +0000 (18:24 +0200)]
exit-status: introduce common exit_status_set_test() call for testing exit status set membership

7 years agobus-util: print correct warnings for units that fail but for which we have a NULL...
Lennart Poettering [Tue, 28 Apr 2015 10:12:29 +0000 (12:12 +0200)]
bus-util: print correct warnings for units that fail but for which we have a NULL result only

7 years agopath-util: fix fstat fallback in fd_is_mount_point
Thomas Hindoe Paaboel Andersen [Sun, 26 Apr 2015 13:57:29 +0000 (15:57 +0200)]
path-util: fix fstat fallback in fd_is_mount_point

7 years agosd-device: don't retry loading uevent/db files more than once
Tom Gundersen [Sat, 25 Apr 2015 23:07:42 +0000 (01:07 +0200)]
sd-device: don't retry loading uevent/db files more than once

If for whatever reason there was nothing to load or loading failed, don't keep trying.

7 years agosd-device: don't complain if the uevent file is missing
Tom Gundersen [Sat, 25 Apr 2015 23:04:33 +0000 (01:04 +0200)]
sd-device: don't complain if the uevent file is missing

Only 'real' devices are required to have an uevent file.

7 years agologind: kill newline characters from log_error_errno() calls
Daniel Mack [Fri, 24 Apr 2015 19:44:51 +0000 (21:44 +0200)]
logind: kill newline characters from log_error_errno() calls

log_error_errno() already adds a newline, so drop them.

7 years agosysctl: minor simplifications
Lennart Poettering [Fri, 24 Apr 2015 17:56:24 +0000 (19:56 +0200)]
sysctl: minor simplifications

7 years agoUpdate Spanish translation
Daniel Mustieles [Fri, 24 Apr 2015 13:13:34 +0000 (09:13 -0400)]
Update Spanish translation

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

7 years agosd-bus: add controlling tty field to sd_creds object
Lennart Poettering [Thu, 23 Apr 2015 17:43:40 +0000 (19:43 +0200)]
sd-bus: add controlling tty field to sd_creds object

This is useful to print wall messages from logind with the right client
tty. (to be added in a later patch)

7 years agoshutdownd: kill the old implementation
Daniel Mack [Thu, 23 Apr 2015 15:30:23 +0000 (17:30 +0200)]
shutdownd: kill the old implementation

Not that all functionality has been ported over to logind, the old
implementation can be removed. There goes one of the oldest parts of
the systemd code base.

7 years agologind: add support for /run/nologin and /run/systemd/shutdown/scheduled
Daniel Mack [Thu, 23 Apr 2015 15:11:28 +0000 (17:11 +0200)]
logind: add support for /run/nologin and /run/systemd/shutdown/scheduled

Port over more code from shutdownd and teach logind to write /run/nologin at
least 5 minutes before the system is going down, and
/run/systemd/shutdown/scheduled when a shutdown is scheduled.

7 years agosd-bus: when bus operations are to be executed on direct connections always fail
Lennart Poettering [Thu, 23 Apr 2015 14:23:15 +0000 (16:23 +0200)]
sd-bus: when bus operations are to be executed on direct connections always fail

Also, don't consider this an loggable event, so that code that tries to
read creds from a direct connection, doesn't generate logs.

7 years agoudevd: fix REMOVE handling
Tom Gundersen [Thu, 23 Apr 2015 13:19:13 +0000 (15:19 +0200)]
udevd: fix REMOVE handling

This reverts b67f944. Lazy loading of device properties does not work for devices
that are received over netlink, as these are sealed. Reinstate the unconditional
loading of the device db.

Reported by: Mantas Mikulėnas <grawity@gmail.com>.

7 years agosd-bus: don't inherit connection creds into message creds when we have a direct conne...
Lennart Poettering [Thu, 23 Apr 2015 11:37:03 +0000 (13:37 +0200)]
sd-bus: don't inherit connection creds into message creds when we have a direct connection

It's never a good idea, let's just not do it, not even on dierct
connections.

7 years agopath-util: make use of "mnt_id" field exported in /proc/self/fdinfo/<fd> to test...
Lennart Poettering [Thu, 23 Apr 2015 11:23:03 +0000 (13:23 +0200)]
path-util: make use of "mnt_id" field exported in /proc/self/fdinfo/<fd> to test for mount points

It's a very recent kernel addition, but certainly makes sense to
support.

7 years agohwdb: fix typo - "sort by by..." -> "sort by..."
Peter Hutterer [Thu, 23 Apr 2015 01:10:04 +0000 (11:10 +1000)]
hwdb: fix typo - "sort by by..." -> "sort by..."

7 years agocore: explicitly specify credentials for direct connections, too
Lennart Poettering [Wed, 22 Apr 2015 22:37:47 +0000 (00:37 +0200)]
core: explicitly specify credentials for direct connections, too

So far we authenticate direct connections primarily at connection time,
but let's also do this for each method individually, by attaching the
creds we need for that right away.

7 years agojournalctl: rework code that checks whether we have access to /var/log/journal
Lennart Poettering [Wed, 22 Apr 2015 20:54:23 +0000 (22:54 +0200)]
journalctl: rework code that checks whether we have access to /var/log/journal

- fix some memory leaks on error conditions

- handle all error cases properly, and log about failures

- move HAVE_ACL and no-HAVE_ACL code closer to each other

7 years agolibudev-device: fix lazy loading of devlinks, properties and tags
Tom Gundersen [Wed, 22 Apr 2015 17:01:50 +0000 (19:01 +0200)]
libudev-device: fix lazy loading of devlinks, properties and tags

If the underlying device has not read in the properties yet, the generation will be 0, so
make sure we trigger the reading at least once.

7 years agologind: add code for UTMP wall messages
Daniel Mack [Wed, 22 Apr 2015 15:20:42 +0000 (17:20 +0200)]
logind: add code for UTMP wall messages

Add a timer to print UTMP wall messages so that it repeatedly informs users
about a scheduled shutdown:

 * every 1 minute with less than 10 minutes to go
 * every 15 minutes with less than 60 minutes to go
 * every 30 minutes with less than 180 minutes (3 hours) to go
 * every 60 minutes if more than that to go

This functionality only active if the .EnableWallMessages DBus property
is set to true. Also, a custom string can be added to the wall message,
set through the WallMessagePrefix property.

7 years agobtrfs-util: support recursive removal of read-only subvolumes
Lennart Poettering [Wed, 22 Apr 2015 15:09:20 +0000 (17:09 +0200)]
btrfs-util: support recursive removal of read-only subvolumes

When deleting a read-only subsvolume with a sub-subvolume, we need to
mark it writable first, otherwise the removal will not work.

7 years agobtrfs-util: fix creating recursive read-only snapshots
Lennart Poettering [Wed, 22 Apr 2015 14:52:53 +0000 (16:52 +0200)]
btrfs-util: fix creating recursive read-only snapshots

When creating recursive read-only snapshots we need to mark the snapshot
writable immediately before creating subsnapshots within it, otherwise
the operation for it will fail.

7 years agosd-bus: handle ppid=0 more gracefully (which happens for pid=1)
Lennart Poettering [Wed, 22 Apr 2015 11:27:29 +0000 (13:27 +0200)]
sd-bus: handle ppid=0 more gracefully (which happens for pid=1)

7 years agobtrfs-util: be more careful when invoking btrfs file system ioctls
Lennart Poettering [Wed, 22 Apr 2015 11:11:19 +0000 (13:11 +0200)]
btrfs-util: be more careful when invoking btrfs file system ioctls

If we get passed an fd that does not refer to a regular file or
directory, we should not issue btrfs ioctls on it, since it might end up
in a device driver or similar (note that DRM for example uses the same
ioctl numbers as some file system ioctls).

Hence, let's make sure to always check if something is a regular file or
directory, or is on btrfs before invoking the respective ioctls. It's
better to be safe than sorry.

7 years agobtrfs-util: introduce btrfs_is_filesystem() and make use of it where appropriate
Lennart Poettering [Wed, 22 Apr 2015 11:08:19 +0000 (13:08 +0200)]
btrfs-util: introduce btrfs_is_filesystem() and make use of it where appropriate

Let's unify the code that checks whether an fd is on btrfs a bit.

(Also, rename btrfs_is_snapshot() to btrfs_is_subvol(), since that's
usually how this is referred to in our code)

7 years agoutil: make sure fd refers to regular file or directory when applying file attributes
Lennart Poettering [Wed, 22 Apr 2015 11:05:26 +0000 (13:05 +0200)]
util: make sure fd refers to regular file or directory when applying file attributes

Before invoking file system ioctls we need to make sure that the
specified fd actually refers to a file system object, and not a device
node or similar. Otherwise we might by accident invoke unrelated device
driver ioctls. For example, DRM ioctls use the same ioctl numbers as the
various file system ioctls.

7 years agonetworkd: introduce vti6 tunnel
Susant Sahani [Wed, 22 Apr 2015 08:44:55 +0000 (14:14 +0530)]
networkd: introduce vti6 tunnel

This patch add support to create vti6 tunnel

test:

vt6.network
[Match]
Name=wlan0

[Network]
Tunnel=ip6vti

vti6.netdev
[NetDev]
Name=ip6vti
Kind=vti6

[Tunnel]
Local=2a00:ffde:4567:edde::4987
Remote=2001:473:fece:cafe::5179

ip link

11: ip6_vti0@NONE: <NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT
group default
    link/tunnel6 :: brd ::
12: ip6vti@wlan0: <POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN
mode DEFAULT group default
    link/tunnel6 2a00:ffde:4567:edde::4987 peer 2001:473:fece:cafe::5179

7 years agosd-bus: expose ppid field
Lennart Poettering [Tue, 21 Apr 2015 18:58:09 +0000 (20:58 +0200)]
sd-bus: expose ppid field

kdbus has been passing us the ppid file for a while, actually make use
of it.

7 years agocore: make unit deserialization more defensive
Lennart Poettering [Tue, 21 Apr 2015 18:22:51 +0000 (20:22 +0200)]
core: make unit deserialization more defensive

7 years agotree-wide: get rid of more strerror() calls
Lennart Poettering [Tue, 21 Apr 2015 16:05:44 +0000 (18:05 +0200)]
tree-wide: get rid of more strerror() calls

7 years agotmpfiles: make /home and /var btrfs subvolumes by default when booted up with them...
Lennart Poettering [Tue, 21 Apr 2015 15:28:16 +0000 (17:28 +0200)]
tmpfiles: make /home and /var btrfs subvolumes by default when booted up with them missing

This way the root subvolume can be left read-only easily, and variable
and user data writable with explicit quota set.

7 years agotmpfiles: there's no systemd-forbid-user-logins.service service
Lennart Poettering [Tue, 21 Apr 2015 15:26:56 +0000 (17:26 +0200)]
tmpfiles: there's no systemd-forbid-user-logins.service service

7 years agolog: move log_syntax() into src/shared/log.c, and make it more similar to the other...
Lennart Poettering [Tue, 21 Apr 2015 15:26:04 +0000 (17:26 +0200)]
log: move log_syntax() into src/shared/log.c, and make it more similar to the other log functions

7 years agosd-device: set_syspath - return ENODEV when passed something that is not a device
Tom Gundersen [Tue, 21 Apr 2015 12:41:13 +0000 (14:41 +0200)]
sd-device: set_syspath - return ENODEV when passed something that is not a device

7 years agosd-bus: when augmenting creds, remember which ones were augmented
Lennart Poettering [Mon, 20 Apr 2015 22:58:08 +0000 (00:58 +0200)]
sd-bus: when augmenting creds, remember which ones were augmented

Also, when we do permissions checks using creds, verify that we don't do
so based on augmented creds, as extra safety check.

7 years agosd-bus: augmenting cgroups-based creds when we have the cgroup path already is free
Lennart Poettering [Mon, 20 Apr 2015 22:53:43 +0000 (00:53 +0200)]
sd-bus: augmenting cgroups-based creds when we have the cgroup path already is free

7 years agosd-bus: when augmenting creds, don't override any creds in any case
Lennart Poettering [Mon, 20 Apr 2015 22:52:24 +0000 (00:52 +0200)]
sd-bus: when augmenting creds, don't override any creds in any case

Let's better be safe than sorry.

7 years agosd-bus: when copying creds objects, make sure we copy even the implicit well known...
Lennart Poettering [Mon, 20 Apr 2015 22:50:43 +0000 (00:50 +0200)]
sd-bus: when copying creds objects, make sure we copy even the implicit well known names

7 years agologind: add .ScheduleShutdown and .CancelScheduledShutdown methods
Daniel Mack [Mon, 20 Apr 2015 13:27:15 +0000 (15:27 +0200)]
logind: add .ScheduleShutdown and .CancelScheduledShutdown methods

Add a method called ScheduleShutdown in org.freedesktop.login1.Manager
which adds a timer to shut down the system at a later point in time.

The first argument holds the type of the schedule that is about to
happen, and must be one of 'reboot', 'halt' or 'poweroff'.

The second argument specifies the absolute time, based on
CLOCK_REALTIME in nanoseconds, at which the the operation should be
executed.

To cancel a previously scheduled shutdown, the CancelScheduledShutdown()
can be called, which returns a bool, indicating whether a scheduled
timeout was cancelled.

Also add a new property called ScheduledShutdown which returns the
equivalent to what was passed in via ScheduleShutdown, as '(st)' type.

7 years agologind: factor out polkit checks
Daniel Mack [Mon, 20 Apr 2015 13:19:26 +0000 (15:19 +0200)]
logind: factor out polkit checks

Factor out the code to ask polkit for authorization from
method_do_shutdown_or_sleep() into an own function called
verify_shutdown_creds().

This is needed in order to also use the same checks when shutdown
operations are scheduled. For that, it's also necessary to allow
NULL values for that action{,_multiple_sessions,_ignore_inhibit)
arguments, which will suppress the call if no action string is
passed.

7 years agoutil: fix typo
Raul Gutierrez S [Mon, 20 Apr 2015 05:27:45 +0000 (22:27 -0700)]
util: fix typo

7 years agoexit-status: Fix "NOTINSSTALLED" typo
Martin Pitt [Sat, 18 Apr 2015 21:38:13 +0000 (22:38 +0100)]
exit-status: Fix "NOTINSSTALLED" typo

7 years agosd-device: uniformly handle missing devices
Tom Gundersen [Fri, 17 Apr 2015 12:53:02 +0000 (14:53 +0200)]
sd-device: uniformly handle missing devices

sd_device_new_from_* now returns -ENODEV when the device does not exist, and the enumerator
silently drops these errors as missing devices is exepected.

7 years agosd-device: enumerator - match only on initialized devices by default
Tom Gundersen [Fri, 17 Apr 2015 12:11:00 +0000 (14:11 +0200)]
sd-device: enumerator - match only on initialized devices by default

It is still possible to include uninitialized ones, but now that is opt-in. In most
cases people only want initialized devices. Exception is if you want to work without
udev running.

Suggested by David Herrmann.

7 years agosd-device: enumerator - don't expose add_device()
Tom Gundersen [Fri, 17 Apr 2015 11:50:10 +0000 (13:50 +0200)]
sd-device: enumerator - don't expose add_device()

This is rarely, if ever, used. Drop it from the new public API and only keep it for
the legacy API.

Suggested by David Herrmann.

7 years agosd-bus: add more comments to the credential decision logic
Lennart Poettering [Thu, 16 Apr 2015 15:27:51 +0000 (17:27 +0200)]
sd-bus: add more comments to the credential decision logic

7 years agoautomount: add expire support
Michael Olbrich [Tue, 14 Apr 2015 20:01:48 +0000 (22:01 +0200)]
automount: add expire support

7 years agosd-device: fix typo
Zbigniew Jędrzejewski-Szmek [Tue, 14 Apr 2015 16:39:40 +0000 (12:39 -0400)]
sd-device: fix typo