chiark / gitweb /
elogind.git
4 years agotmpfiles: make recursive operation generic
Zbigniew Jędrzejewski-Szmek [Sun, 18 Jan 2015 06:33:39 +0000 (01:33 -0500)]
tmpfiles: make recursive operation generic

4 years agotmpfiles: add 'a' type to set ACLs
Zbigniew Jędrzejewski-Szmek [Sun, 18 Jan 2015 04:27:39 +0000 (23:27 -0500)]
tmpfiles: add 'a' type to set ACLs

4 years agotmpfiles: attach an array of items to each path
Zbigniew Jędrzejewski-Szmek [Fri, 9 Jan 2015 07:00:37 +0000 (02:00 -0500)]
tmpfiles: attach an array of items to each path

The data structure used by tmpfiles is changed: instead of hashmaps
mapping {path → Item*} we now have hashmaps containing
{path -> ItemArray}, where ItemArray contains a pointer
to an array of Items.

For current code it doesn't matter much, but when we add new types it
is easier to simply add a new Item for a given path, then to coalesce
multiple lines into one Item.

In the future, this change will also make it possible to remember the
file and line where each Item originates, and use that in reporting
errors. Currently this is not possible, since each Item can be created
from multiple lines.

4 years agotmpfiles: make sure not to concatenate non-absolute path
Zbigniew Jędrzejewski-Szmek [Fri, 9 Jan 2015 06:27:31 +0000 (01:27 -0500)]
tmpfiles: make sure not to concatenate non-absolute path

If the path is absolute was only checked later.
Also do not check if path if absolute if we just
specified it starting with a slash.

4 years agotmpfiles: detect all combinations of + and !
Zbigniew Jędrzejewski-Szmek [Fri, 9 Jan 2015 06:11:01 +0000 (01:11 -0500)]
tmpfiles: detect all combinations of + and !

The same algorithm as with - and @ in ExecStart= is used.

4 years agotmpfiles: simplification
Zbigniew Jędrzejewski-Szmek [Fri, 9 Jan 2015 06:10:02 +0000 (01:10 -0500)]
tmpfiles: simplification

Certain conditions were checked more than once. Warning message
is improved.

4 years agocatalog: update pt_BR translation
Rafael Ferreira [Mon, 19 Jan 2015 14:39:43 +0000 (12:39 -0200)]
catalog: update pt_BR translation

Brazilian Portuguese update for CATALOG patch, according to commit
2057124e7910c4cab7e53d26e0c3749d326ae2bb ("Grammar changes to catalog")

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

4 years agoshared/cgroup-show: simplify show_pid_array()
Zbigniew Jędrzejewski-Szmek [Wed, 21 Jan 2015 04:09:58 +0000 (23:09 -0500)]
shared/cgroup-show: simplify show_pid_array()

int[] should not be used as pid_t[], even if happens to be same thing.
Also deduplicating in a quadratic loop right before sorting is unnecessary.
Remove custom greedy_realloc implementation.

4 years agoAssorted format fixes
Zbigniew Jędrzejewski-Szmek [Wed, 21 Jan 2015 03:22:15 +0000 (22:22 -0500)]
Assorted format fixes

Types used for pids and uids in various interfaces are unpredictable.
Too bad.

4 years agoFix some format strings for enums, they are signed
Zbigniew Jędrzejewski-Szmek [Thu, 22 Jan 2015 04:47:37 +0000 (23:47 -0500)]
Fix some format strings for enums, they are signed

4 years agoshared/util: use signed printf format for PIDs
Zbigniew Jędrzejewski-Szmek [Thu, 22 Jan 2015 04:35:19 +0000 (23:35 -0500)]
shared/util: use signed printf format for PIDs

gcc 5 started warning about this.

4 years agoupdate TODO
Lennart Poettering [Thu, 22 Jan 2015 03:01:58 +0000 (04:01 +0100)]
update TODO

4 years agoimport: introduce new mini-daemon systemd-importd, and make machinectl a client to it
Lennart Poettering [Thu, 22 Jan 2015 02:57:15 +0000 (03:57 +0100)]
import: introduce new mini-daemon systemd-importd, and make machinectl a client to it

The old "systemd-import" binary is now an internal tool. We still use it
as asynchronous backend for systemd-importd. Since the import tool might
require some IO and CPU resources (due to qcow2 explosion, and
decompression), and because we might want to run it with more minimal
priviliges we still keep it around as the worker binary to execute as
child process of importd.

machinectl now has verbs for pulling down images, cancelling them and
listing them.

4 years agoimpot: minor cleanups
Lennart Poettering [Thu, 22 Jan 2015 02:51:22 +0000 (03:51 +0100)]
impot: minor cleanups

4 years agolog: add new log output mode, that prints to console, but prefixes with syslog priority
Lennart Poettering [Thu, 22 Jan 2015 02:47:46 +0000 (03:47 +0100)]
log: add new log output mode, that prints to console, but prefixes with syslog priority

This is useful when we execute our own programs, reading output from its
STDERR, and want to retain priority information.

4 years agonetworkd: plug lldp leak
Tom Gundersen [Wed, 21 Jan 2015 22:02:22 +0000 (23:02 +0100)]
networkd: plug lldp leak

4 years agonetwork: dhcp - split out dhcp_identifier_set_{iaid,duid_en} from dhcp6-client
Tom Gundersen [Wed, 21 Jan 2015 21:25:20 +0000 (22:25 +0100)]
network: dhcp - split out dhcp_identifier_set_{iaid,duid_en} from dhcp6-client

This will also be used in dhcp4-client.

4 years agonetwork: dhcp - split out the duid structure into a new header file
Tom Gundersen [Wed, 21 Jan 2015 20:23:47 +0000 (21:23 +0100)]
network: dhcp - split out the duid structure into a new header file

We will use the same in both dhcp4 and dhcp6.

4 years agoupdate TODO
Lennart Poettering [Wed, 21 Jan 2015 19:05:24 +0000 (20:05 +0100)]
update TODO

4 years agoimport: simplify dkr importer, by making use of generic import-job logic, used by...
Lennart Poettering [Wed, 21 Jan 2015 19:03:57 +0000 (20:03 +0100)]
import: simplify dkr importer, by making use of generic import-job logic, used by the raw and tar importers

This gets us progress output as well xz/bzip2 support.

4 years agoimport: minor cleanups for the tar and raw importers
Lennart Poettering [Wed, 21 Jan 2015 19:02:30 +0000 (20:02 +0100)]
import: minor cleanups for the tar and raw importers

4 years agobuild: Add parallel-tests automake option
Martin Pitt [Wed, 21 Jan 2015 16:10:20 +0000 (17:10 +0100)]
build: Add parallel-tests automake option

We use PY_LOG_COMPILER in Makefile.am for running *.py tests, which requires
automake's parallel test runner. This has only been the default from 1.13 on.
As we only require automake 1.11, add it as an option explicitly.

4 years agosysv-generator: Replace Provides: symlinks with real units
Martin Pitt [Wed, 21 Jan 2015 09:25:14 +0000 (10:25 +0100)]
sysv-generator: Replace Provides: symlinks with real units

Since commit b7e7184 the SysV generator creates symlinks for all "Provides:" in
the LSB header. However, this is too greedy; there are cases where the
creation of a unit .service file fails because of an already existing
symlink with the same name:

 - Backup files such as /etc/init.d/foo.bak still have "Provides: foo", and
   thus get a foo.service -> foo.bak.service link. foo.bak would not be enabled
   in rcN.d/, but we (deliberately) create units for all executables in init.d/
   so that a manual "systemctl start" works. If foo.bak is processed before,
   the symlink already exists.

 - init.d/bar has "Provides: foo", while there also is a real init.d/foo. The
   former would create a link foo.service -> bar.service, while the latter
   would fail to create the real foo.service.

If we encounter an existing symlink, just remove it before writing a real unit.

Note that two init.d scripts "foo" and "bar" which both provide the same name
"common" already work. The first processed init script wins and creates the
"common.service" symlink, and the second just fails to create the symlink
again. Thus create an additional test case for this to ensure that it keeps
working sensibly.

https://bugs.debian.org/775404

4 years agosystemd-sysv-generator test: test scripts with hidden suffixes
Martin Pitt [Wed, 21 Jan 2015 14:30:01 +0000 (15:30 +0100)]
systemd-sysv-generator test: test scripts with hidden suffixes

We don't expect any unit generated from temporary package manager, swap, and
similar files.

4 years agoutil: Add some missing hidden_file() suffixes
Martin Pitt [Wed, 21 Jan 2015 14:26:13 +0000 (15:26 +0100)]
util: Add some missing hidden_file() suffixes

dpkg itself also uses *.dpkg-dist, while .dpkg-{bak,backup,remove} are being
used by dpkg-maintscript-helper.

4 years agosysv-generator: Handle .sh suffixes when translating Provides:
Martin Pitt [Tue, 20 Jan 2015 15:41:31 +0000 (16:41 +0100)]
sysv-generator: Handle .sh suffixes when translating Provides:

When deciding whether the provided name equals the file name in
sysv_translate_facility(), also consider them equal if the file name has a
".sh" suffix.

This was uncovered by commit b7e7184 which then created a symlink
"<name>.service" to itself for ".sh" suffixed init.d scripts.

For additional robustness, refuse to create symlinks to itself in add_alias().

Add test case which reproduces the bug.

https://bugs.debian.org/775889

4 years agoupdate TODO
Lennart Poettering [Wed, 21 Jan 2015 12:45:07 +0000 (13:45 +0100)]
update TODO

4 years agoimport: support downloading bzip2-encoded images
Lennart Poettering [Wed, 21 Jan 2015 12:43:55 +0000 (13:43 +0100)]
import: support downloading bzip2-encoded images

This way, we can import CoreOS images unmodified.

4 years agojournal: Fix syslog forwarding without CAP_SYS_ADMIN
Christian Seiler [Tue, 13 Jan 2015 10:53:25 +0000 (11:53 +0100)]
journal: Fix syslog forwarding without CAP_SYS_ADMIN

In case CAP_SYS_ADMIN is missing (like in containers), one cannot fake pid in
struct ucred (uid/gid are fine if CAP_SETUID/CAP_SETGID are present).

Ensure that journald will try again to forward the messages to syslog without
faking the SCM_CREDENTIALS pid (which isn't guaranteed to succeed anyway, since
it also does the same thing if the process has already exited).

With this patch, journald will no longer silently discard messages
that are supposed to be sent to syslog in these situations.

https://bugs.debian.org/775067

4 years agozsh-completion: Do not interpret escape sequences in _filter_units_by_property
Wieland Hoffmann [Sat, 17 Jan 2015 01:10:42 +0000 (02:10 +0100)]
zsh-completion: Do not interpret escape sequences in _filter_units_by_property

This makes all functions that rely on _filter_units_by_property() (like
_systemctl_{stop,kill,try_restart}) work with unit names that contain backslash
escaped sequences (like automount units with spaces that are escaped to
"\x20").

4 years agosystemd-sysv-generator test: fix enabled check
Martin Pitt [Wed, 21 Jan 2015 09:21:08 +0000 (10:21 +0100)]
systemd-sysv-generator test: fix enabled check

Fix hardcoded "foo.service", test for the actual unit parameter.

4 years agosystemd-sysv-generator test: don't parse symlinks
Martin Pitt [Wed, 21 Jan 2015 08:45:15 +0000 (09:45 +0100)]
systemd-sysv-generator test: don't parse symlinks

Generated services which are symlinks should be tested/handled differently from
files, so ignore them in run_generator()'s result parsing.

4 years agotest: add integration test for systemd-sysv-generator
Martin Pitt [Tue, 20 Jan 2015 15:08:05 +0000 (16:08 +0100)]
test: add integration test for systemd-sysv-generator

This covers the general functionality as well as regression tests for recent
fixes like commits b7e718 and 1ed0c19.

4 years agoimport: also add verification support to tar importer
Lennart Poettering [Wed, 21 Jan 2015 03:03:33 +0000 (04:03 +0100)]
import: also add verification support to tar importer

4 years agoimport: make verification code generic, in preparation for using it pull-tar
Lennart Poettering [Wed, 21 Jan 2015 02:46:01 +0000 (03:46 +0100)]
import: make verification code generic, in preparation for using it pull-tar

4 years agoimport: improve logging
Lennart Poettering [Wed, 21 Jan 2015 02:02:23 +0000 (03:02 +0100)]
import: improve logging

4 years agoimport: show download speed while downloading
Lennart Poettering [Wed, 21 Jan 2015 02:02:04 +0000 (03:02 +0100)]
import: show download speed while downloading

4 years agoimport: add image verification using gpg
Lennart Poettering [Wed, 21 Jan 2015 02:01:13 +0000 (03:01 +0100)]
import: add image verification using gpg

This also adds an initial keyring for the verification, that contains
Ubuntu's and Fedora's key. We should probably add more entries sooner or
later.

4 years agotest: eliminate shell wrapper for Python test
Martin Pitt [Tue, 20 Jan 2015 20:26:35 +0000 (21:26 +0100)]
test: eliminate shell wrapper for Python test

Use the parallel test runner's TEST_EXTENSIONS/*_LOG_COMPILER feature
(https://www.gnu.org/software/automake/manual/html_node/Parallel-Test-Harness.html)
to run *.py tests through $(PYTHON), and only if we have python
available/enabled.

This eliminates the need of having shell wrappers, thus drop
test/rules-test.sh.

4 years agotest: simplify rules-test.sh wrapper
Martin Pitt [Tue, 20 Jan 2015 19:50:35 +0000 (20:50 +0100)]
test: simplify rules-test.sh wrapper

Drop globbing of rules/*.rules in the rules-test.sh wrapper and move that logic
into the actual test rule-syntax-check.py. This can still be called with
individual rules files, but when being called without arguments it will now
process all top_builddir/rules/*.rules.

Preparation for dropping the shell wrappers altogether.

4 years agonspawn: work around kernel bug with partition table probing on loopback devices
Lennart Poettering [Tue, 20 Jan 2015 19:36:19 +0000 (20:36 +0100)]
nspawn: work around kernel bug with partition table probing on loopback devices

When we set up a loopback device with partition probing, the udev
"change" event about the configured device is first passed on to
userspace, only the the in-kernel partition prober is started. Since
partition probing fails with EBUSY when somebody has the device open,
the probing frequently fails since udev starts probing/opening the
device as soon as it gets the notification about it, and it might do so
earlier than the kernel probing.

This patch adds a (hopefully temporary) work-around for this, that
compares the number of probed partitions of the kernel with those of
blkid and synchronously asks for reprobing until the numebrs are in
sync.

This really deserves a proper kernel fix.

4 years agoimport: add a couple of additional suffixes to remove from raw images
Lennart Poettering [Tue, 20 Jan 2015 15:37:27 +0000 (16:37 +0100)]
import: add a couple of additional suffixes to remove from raw images

4 years agoimport: make image verification optional
Lennart Poettering [Tue, 20 Jan 2015 15:36:40 +0000 (16:36 +0100)]
import: make image verification optional

4 years agosd-dhcp6-client: Remove unnecessary debug printout
Patrik Flykt [Mon, 5 Jan 2015 14:25:49 +0000 (16:25 +0200)]
sd-dhcp6-client: Remove unnecessary debug printout

4 years agoimport: add a simple scheme for validating the SHA256 sums of downloaded raw files
Lennart Poettering [Tue, 20 Jan 2015 14:06:34 +0000 (15:06 +0100)]
import: add a simple scheme for validating the SHA256 sums of downloaded raw files

4 years agoimport: be less aggressive when allocating memory for downloaded payload
Lennart Poettering [Tue, 20 Jan 2015 14:06:01 +0000 (15:06 +0100)]
import: be less aggressive when allocating memory for downloaded payload

4 years agoimport: improve logging a bit
Lennart Poettering [Tue, 20 Jan 2015 14:05:25 +0000 (15:05 +0100)]
import: improve logging a bit

4 years agoimport: port pull-raw to helper tools implemented for pull-tar
Lennart Poettering [Tue, 20 Jan 2015 02:00:07 +0000 (03:00 +0100)]
import: port pull-raw to helper tools implemented for pull-tar

This allows us to reuse a lot more code, and simplify pull-raw
drastically.

4 years agoimport: add support for pulling raw tar balls as containers
Lennart Poettering [Tue, 20 Jan 2015 00:36:11 +0000 (01:36 +0100)]
import: add support for pulling raw tar balls as containers

Ubuntu provides their cloud images optionally as tarball, hence also
support downloading those.

4 years agoutil: make http url validity checks more generic, and move them to util.c
Lennart Poettering [Mon, 19 Jan 2015 19:45:27 +0000 (20:45 +0100)]
util: make http url validity checks more generic, and move them to util.c

4 years agotest: Use configured Python
Martin Pitt [Tue, 20 Jan 2015 11:46:28 +0000 (12:46 +0100)]
test: Use configured Python

Don't hardcode "python" or /usr/bin/python, but use the configured $(PYTHON).

4 years agotest/rule-syntax-check.py: Fix for Python 3
Martin Pitt [Tue, 20 Jan 2015 11:18:40 +0000 (12:18 +0100)]
test/rule-syntax-check.py: Fix for Python 3

Make this work with both Python 2 and 3.

4 years agonetworkd: fix a typo in networkd-wait-online-manager.
Rami Rosen [Tue, 20 Jan 2015 11:56:14 +0000 (13:56 +0200)]
networkd: fix a typo in networkd-wait-online-manager.

subscibe->subscribe

4 years agoman: add networkctl(1)
Zbigniew Jędrzejewski-Szmek [Tue, 20 Jan 2015 02:44:16 +0000 (21:44 -0500)]
man: add networkctl(1)

4 years agoman: use one description of --no-legend
Zbigniew Jędrzejewski-Szmek [Tue, 20 Jan 2015 02:43:35 +0000 (21:43 -0500)]
man: use one description of --no-legend

4 years agonspawn: add ipvlan support
Tom Gundersen [Mon, 19 Jan 2015 23:18:28 +0000 (00:18 +0100)]
nspawn: add ipvlan support

4 years agonetworkd: netdev - add ipvlan support
Tom Gundersen [Mon, 19 Jan 2015 21:24:32 +0000 (22:24 +0100)]
networkd: netdev - add ipvlan support

4 years agosystemctl: do not show dots with --plain
Zbigniew Jędrzejewski-Szmek [Mon, 19 Jan 2015 20:41:03 +0000 (15:41 -0500)]
systemctl: do not show dots with --plain

Plain implies a ... "plain" output.

Also do not say "No jobs" with --no-legend. We skip
reporting the number of jobs with --no-legend if there
are any, and 0 is also a number, and should be skipped.

4 years agonspawn: support dissecting GPT images that contain only a single generic linux partition
Lennart Poettering [Mon, 19 Jan 2015 19:22:58 +0000 (20:22 +0100)]
nspawn: support dissecting GPT images that contain only a single generic linux partition

This should allow running Ubuntu UEFI GPT Images with nspawn,
unmodified.

4 years agoimport: clarify when we are unpacking the qcow2 device
Lennart Poettering [Mon, 19 Jan 2015 19:22:50 +0000 (20:22 +0100)]
import: clarify when we are unpacking the qcow2 device

4 years agoinspawn: wait until udev has probed a loopback device before making us of it
Lennart Poettering [Mon, 19 Jan 2015 19:21:57 +0000 (20:21 +0100)]
inspawn: wait until udev has probed a loopback device before making us of it

4 years agoimport: make sure don't leak the LZMA context
Lennart Poettering [Mon, 19 Jan 2015 16:02:37 +0000 (17:02 +0100)]
import: make sure don't leak the LZMA context

4 years agomachined: refer to the disk space allocated for an image to "usage" rather than ...
Lennart Poettering [Mon, 19 Jan 2015 16:01:15 +0000 (17:01 +0100)]
machined: refer to the disk space allocated for an image to "usage" rather than "size"

After all, it's closer to the "du"-reported value than to the file
sizes...

4 years agoqcow2: when dissecting qcow2, use btrfs clone ioctls for reflinking blocks to target
Lennart Poettering [Sat, 17 Jan 2015 17:11:45 +0000 (18:11 +0100)]
qcow2: when dissecting qcow2, use btrfs clone ioctls for reflinking blocks to target

4 years agoimport: when downloading raw files, show simple progress reports
Lennart Poettering [Sat, 17 Jan 2015 02:22:06 +0000 (03:22 +0100)]
import: when downloading raw files, show simple progress reports

4 years agoimport: simplify the code a bit
Lennart Poettering [Sat, 17 Jan 2015 01:45:42 +0000 (02:45 +0100)]
import: simplify the code a bit

4 years agoimport-raw: when downloading raw images, generate sparse files if we can
Lennart Poettering [Sat, 17 Jan 2015 01:36:23 +0000 (02:36 +0100)]
import-raw: when downloading raw images, generate sparse files if we can

4 years agoimport-raw: set NOCOW flag on all raw images we create
Lennart Poettering [Sat, 17 Jan 2015 01:34:33 +0000 (02:34 +0100)]
import-raw: set NOCOW flag on all raw images we create

4 years agosystemctl: fix import-environment description, trim help to 80 cols
Zbigniew Jędrzejewski-Szmek [Mon, 19 Jan 2015 18:55:44 +0000 (13:55 -0500)]
systemctl: fix import-environment description, trim help to 80 cols

4 years agojournalctl: trim --help to fit in 80 columns
Zbigniew Jędrzejewski-Szmek [Mon, 19 Jan 2015 18:42:34 +0000 (13:42 -0500)]
journalctl: trim --help to fit in 80 columns

Terminals tend to be 80 columns wide by default, and the help
text is only supposed to be a terse reminder anyway.

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

4 years agocgroup: fix typo
Daniel Mack [Fri, 16 Jan 2015 12:44:32 +0000 (13:44 +0100)]
cgroup: fix typo

4 years agoMove DEFINE_TRIVIAL_CLEANUP_FUNC to macro.h
Zbigniew Jędrzejewski-Szmek [Sun, 18 Jan 2015 04:20:00 +0000 (23:20 -0500)]
Move DEFINE_TRIVIAL_CLEANUP_FUNC to macro.h

This remove the need for various header files to include the
(relatively heavyweight) util.h.

4 years agoAdd initialization helper for file_handle_union
Zbigniew Jędrzejewski-Szmek [Wed, 7 Jan 2015 15:28:04 +0000 (10:28 -0500)]
Add initialization helper for file_handle_union

4 years agoman: reindent tmpfiles.d(5)
Zbigniew Jędrzejewski-Szmek [Tue, 6 Jan 2015 06:58:31 +0000 (01:58 -0500)]
man: reindent tmpfiles.d(5)

Reindent to 2 spaces, use more markup.

4 years agoman: mention "wheel" and "adm" in journalctl(1)
Zbigniew Jędrzejewski-Szmek [Tue, 6 Jan 2015 06:15:59 +0000 (01:15 -0500)]
man: mention "wheel" and "adm" in journalctl(1)

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

4 years agoman: reindent journalctl(1)
Zbigniew Jędrzejewski-Szmek [Tue, 6 Jan 2015 06:09:55 +0000 (01:09 -0500)]
man: reindent journalctl(1)

Reindent with two spaces, use non-breaking spaces, add <literal> tags.

4 years agobus: drop systemd.kdbus_attach_flags_mask= cmdline
David Herrmann [Sun, 18 Jan 2015 22:56:19 +0000 (23:56 +0100)]
bus: drop systemd.kdbus_attach_flags_mask= cmdline

There is no reason to provide our own attach_flags_mask. We can simply
rely on kdbus.attach_flags_mask= which is read by the kernel *and* kmod.
If it's set, we assume the user wants to override our setting, so we
simply skip setting it.

4 years agocore: write kdbus.attach_flags_mask only on real boot
David Herrmann [Sun, 18 Jan 2015 22:54:42 +0000 (23:54 +0100)]
core: write kdbus.attach_flags_mask only on real boot

The kernel module system is not namespaced, so no container should ever
modify global options. Make sure we set the kdbus attach_flags_mask only
on a real boot as PID1.

4 years agolibudev: fix check for too long packet
Topi Miettinen [Sun, 18 Jan 2015 21:57:35 +0000 (23:57 +0200)]
libudev: fix check for too long packet

Don't use recvmsg(2) return value to check for too long packets
(it doesn't work) but MSG_TRUNC flag.

(David: add parantheses around condition)

4 years agoutil: replace RUN_WITH_LOCALE with extended locale functions
Cristian Rodríguez [Thu, 15 Jan 2015 05:27:34 +0000 (02:27 -0300)]
util: replace RUN_WITH_LOCALE with extended locale functions

There were two callers, one can use strtod_l() and the other strptime_l().

(David: fix up commit-msg and coding-style)

4 years agotimesyncd: consider too long packets as invalid
Topi Miettinen [Sun, 18 Jan 2015 14:01:25 +0000 (16:01 +0200)]
timesyncd: consider too long packets as invalid

If the received NTP message from server didn't fit to our buffer, either
it is doing something nasty or we don't know the protocol. Consider the
packet as invalid.

(David: add parantheses around conditional)

4 years agobus-proxy: don't pretend everyone is root
David Herrmann [Sun, 18 Jan 2015 20:34:33 +0000 (21:34 +0100)]
bus-proxy: don't pretend everyone is root

While it's a lovely scenario, it's probably not really useful. Fix our
GetConnectionUnixUser() to return the actual 'euid' which we asked for,
not the possible uninitialized 'uid'.

4 years agoRevert "test-exec: do not skip all the tests"
David Herrmann [Sun, 18 Jan 2015 19:07:51 +0000 (20:07 +0100)]
Revert "test-exec: do not skip all the tests"

This reverts commit 68e68ca8106e7cd874682ae425843b48579c6539. We *need*
root access to create cgroups. The only exception is if it is run from
within a cgroup with "Delegate=yes". However, this is not always true and
we really shouldn't rely on this.

If your terminal runs from within a systemd --user instance, you're fine.
Everyone else is not (like running from ssh, VTs, and so on..).

4 years agobus: fix SD_BUS_CREDS_AUGMENT on kdbus queries
David Herrmann [Sun, 18 Jan 2015 18:37:34 +0000 (19:37 +0100)]
bus: fix SD_BUS_CREDS_AUGMENT on kdbus queries

If we set SD_BUS_CREDS_AUGMENT, we *need* the PID from the kernel so we
can lookup further information from /proc. However, we *must* set
SD_BUS_CREDS_PIDS in "mask", otherwise, our creds-collector will never
actually copy the pid into "sd_bus_creds". Fix this, so
SD_BUS_CREDS_AUGMENT works even if SD_BUS_CREDS_PID is not specified by
the caller.

4 years agobus: fix typo
David Herrmann [Sun, 18 Jan 2015 18:28:30 +0000 (19:28 +0100)]
bus: fix typo

Fix comment typo and clarify that this is not about privileges but can
have rather arbitrary reasons.

4 years agobus: use EUID over UID and fix unix-creds
David Herrmann [Sun, 18 Jan 2015 12:55:55 +0000 (13:55 +0100)]
bus: use EUID over UID and fix unix-creds

Whenever a process performs an action on an object, the kernel uses the
EUID of the process to do permission checks and to apply on any newly
created objects. The UID of a process is only used if someone *ELSE* acts
on the process. That is, the UID of a process defines who owns the
process, the EUID defines what privileges are used by this process when
performing an action.

Process limits, on the other hand, are always applied to the real UID, not
the effective UID. This is, because a process has a user object linked,
which always corresponds to its UID. A process never has a user object
linked for its EUID. Thus, accounting (and limits) is always done on the
real UID.

This commit fixes all sd-bus users to use the EUID when performing
privilege checks and alike. Furthermore, it fixes unix-creds to be parsed
as EUID, not UID (as the kernel always takes the EUID on UDS). Anyone
using UID (eg., to do user-accounting) has to fall back to the EUID as UDS
does not transmit the UID.

4 years agobus-proxy: fake all UIDs/GIDs, not just the real UID/GID
David Herrmann [Sun, 18 Jan 2015 12:54:46 +0000 (13:54 +0100)]
bus-proxy: fake all UIDs/GIDs, not just the real UID/GID

Make sure we tell the kernel to fake all UIDs/GIDs. Otherwise, the remote
side has no chance of querying our effective UID (which is usually what
they're interested in).

4 years agobus-proxy: fix bus-uid tracking
David Herrmann [Sun, 18 Jan 2015 12:07:21 +0000 (13:07 +0100)]
bus-proxy: fix bus-uid tracking

We need to implicitly allow HELLO from users with the same uid as the bus.
Fix the bus-uid tracking to use the original uid, not the uid after
privilege-dropping.

4 years agologind: hide 'self' links if not available
David Herrmann [Sun, 18 Jan 2015 11:59:39 +0000 (12:59 +0100)]
logind: hide 'self' links if not available

If the caller does not run in a session/seat or has no tracked user, hide
the /org/freedesktop/login1/.../self links in introspection data.
Otherwise, "busctl tree org.freedesktop.login1" tries to query those nodes
even though it cant.

4 years agobus-proxy: don't print error-messages if we check multiple dests
David Herrmann [Sat, 17 Jan 2015 20:18:52 +0000 (21:18 +0100)]
bus-proxy: don't print error-messages if we check multiple dests

If we test the policy against multiple destination names, we really should
not print warnings if one of the names results in DENY. Instead, pass the
whole array of names to the policy and let it deal with it.

4 years agobus-proxy: implement org.freedesktop.DBus.ReloadConfig()
David Herrmann [Sat, 17 Jan 2015 18:06:34 +0000 (19:06 +0100)]
bus-proxy: implement org.freedesktop.DBus.ReloadConfig()

Make sure to reload our xml policy configuration if requested via the bus.

4 years agobus-proxy: fix indentation
David Herrmann [Sat, 17 Jan 2015 17:54:09 +0000 (18:54 +0100)]
bus-proxy: fix indentation

Fix whitespace indentation.

4 years agobus-proxy: drop privileges if run as root
David Herrmann [Sat, 17 Jan 2015 17:23:33 +0000 (18:23 +0100)]
bus-proxy: drop privileges if run as root

We cannot use "User=" in unit-files if we want to retain privileges. So
make bus-proxy.c explicitly drop privileges. However, only do that if
we're root, as there is no need to drop it on the user-bus.

4 years agobus-proxy: share policy between threads
David Herrmann [Sat, 17 Jan 2015 17:07:58 +0000 (18:07 +0100)]
bus-proxy: share policy between threads

This implements a shared policy cache with read-write locks. We no longer
parse the XML policy in each thread.

This will allow us to easily implement ReloadConfig().

4 years agobuild: move stdio-bridge into $PATH
David Herrmann [Sat, 17 Jan 2015 17:01:01 +0000 (18:01 +0100)]
build: move stdio-bridge into $PATH

Make sure stdio-bridge can be found in $PATH. Otherwise, "xyzctl -H"
fails.

4 years agohwdb: restore comments about MSI devices
Maxim Mikityanskiy [Sat, 17 Jan 2015 16:27:12 +0000 (11:27 -0500)]
hwdb: restore comments about MSI devices

Some time ago 95-keymap.rules was replaced by
60-keyboard.hwdb. Original comments for MSI laptops (that were in
95-keymap.rules) were removed, but I think they are important for
understanding what's going on.

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

4 years agobus-proxy: set custom thread names
David Herrmann [Sat, 17 Jan 2015 13:32:58 +0000 (14:32 +0100)]
bus-proxy: set custom thread names

Set thread-names to "p$PIDu$UID" and suffix with '*' if truncated. This
helps debugging bus-proxy issues if we want to figure out which
connections are currently open.

4 years agobus-proxy: turn into multi-threaded daemon
David Herrmann [Sat, 17 Jan 2015 12:57:46 +0000 (13:57 +0100)]
bus-proxy: turn into multi-threaded daemon

Instead of using Accept=true and running one proxy for each connection, we
now run one proxy-daemon with a thread per connection. This will enable us
to share resources like policies in the future.

4 years agomissing: add macros for OFD locks
Michael Marineau [Thu, 15 Jan 2015 21:25:00 +0000 (13:25 -0800)]
missing: add macros for OFD locks

4 years agoremove unneeded libgen.h includes
Cristian Rodríguez [Wed, 14 Jan 2015 13:39:53 +0000 (10:39 -0300)]
remove unneeded libgen.h includes