Commit graph

10485 commits

Author SHA1 Message Date
Lennart Poettering 8f084002ea loopback-setup: simplify code a bit 2015-02-03 13:53:01 +01:00
Lennart Poettering 9ca903cceb loopback-setup: no need to redefine LOOPBACK_IFINDEX, we already have it in missing.h 2015-02-03 13:48:15 +01:00
Zbigniew Jędrzejewski-Szmek 6cb8e687f0 network-address,test-network: avoid undefined behaviour 2015-02-02 21:34:35 -05:00
Zbigniew Jędrzejewski-Szmek c1d630d5fd shared/async: simplify asynchronous_job a bit 2015-02-02 20:31:18 -05:00
Zbigniew Jędrzejewski-Szmek 374c22b351 test-dhcp-client: add a kludge to make valgrind happy 2015-02-02 20:31:18 -05:00
Zbigniew Jędrzejewski-Szmek fe0885f8ce test-dhcp-client: open a real udp socket for test execution
./test-dhcp-client would attempt to operate fd 0, i.e. stdin.
For example, './test-dhcp-client </dev/null' would fail with EPERM
because /dev/null cannot be used with epoll.

https://bugzilla.redhat.com/show_bug.cgi?id=1076119
2015-02-02 20:31:18 -05:00
Lennart Poettering 63c372cb9d util: rework strappenda(), and rename it strjoina()
After all it is now much more like strjoin() than strappend(). At the
same time, add support for NULL sentinels, even if they are normally not
necessary.
2015-02-03 02:05:59 +01:00
Lennart Poettering 44de0efc6e networkd: minor simplification
Let's return the fd we found as return value in systemd_netlink_fd(),
instead of using call-by-reference.
2015-02-02 23:27:33 +01:00
Thomas Hindoe Paaboel Andersen fed6df828d remove unused variables 2015-02-02 22:58:06 +01:00
Lennart Poettering 7a7d5db71f tmpfiles: let's always use DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING() instead of defining our own string tables 2015-02-02 21:34:09 +01:00
Lennart Poettering babc21fdc0 time-util: let's make xstrftime() useful for everybody, even if we only have a single user so far. 2015-02-02 21:28:33 +01:00
Lennart Poettering b7ce6b592d macro: document that DECIMAL_STR_MAX contains space for the trailing NUL byte 2015-02-02 21:28:19 +01:00
Sebastien Bacher 6e1bf7ab99 bootchart: Ensure that systemd is the init called after using bootchart
When booting with systemd-bootchart, default to call the systemd binary
rather than the init binary on disk, which might be another init system.
Collecting data only works with booting systemd.
2015-02-02 17:40:35 +01:00
Topi Miettinen bca81be775 backlight: let udev properties override clamping
On my computer, the minimum brightness enforced by clamping in
backlight is too bright.

Let udev property ID_BACKLIGHT_CLAMP control whether the brightness
is clamped or not.
2015-02-02 17:18:40 +01:00
Martin Pitt 3f4d56a069 cryptsetup: only warn on real key files
Simplify the check from commit 05f73ad to only apply the warning to regular
files instead of enumerating device nodes.
2015-02-02 16:53:39 +01:00
Cristian Rodríguez 05f73ad22b cryptsetup: Do not warn If the key is /dev/*random
Using /dev/urandom as a key is valid for swap, do not
warn if this devices are world readable.
2015-02-02 16:41:31 +01:00
Tom Gundersen 5544ee8516 networkd: support socket activation
Still keep the non-socket activation code around for starting from the commandline, but
will likely drop that too in the future.
2015-02-02 11:57:52 +01:00
Tom Gundersen a9944163fe sd-rtnl: introduce sd_rtnl_new_from_netlink 2015-02-02 11:57:52 +01:00
Tom Gundersen e56cdb7ae2 networkd-wait-online: add timeout
Default to timing out after 120 seconds without a network connection. Setting a
timeout of 0 disables the timeout.
2015-02-02 11:57:52 +01:00
Tom Gundersen c4f1aff230 sd-event: treat NULL callback for timer events like sig events
In both cases exit the event loop.
2015-02-02 11:57:52 +01:00
Tom Gundersen 5d8689d749 networkd-wait-online: support globbing for ignored devices 2015-02-02 11:57:52 +01:00
Zbigniew Jędrzejewski-Szmek 7d328b5446 shared/capability: go frugal on space for caps 2015-02-01 17:22:32 -05:00
Zbigniew Jędrzejewski-Szmek 51ddf61540 Fix dropping of all capabilities
From fd.o bug 88898:

systemd-resolved fails to start:
Failed to drop capabilities: Operation not permitted

Broken in f11943c53e.

Drop all capabilities:
1. prctl(PR_SET_KEEPCAPS, keep_capabilities != 0) // 0 when we drop all
capabilities
2. setresuid() // bye bye capabilities
3. Add CAP_SETPCAP // fails because we have no capabilities
4. Reduce capability bounding set
5. Drop capabilities
6. prctl(PR_SET_KEEPCAPS, 0)

Capabilites should always be kept after setresuid() so that the capability
bounding set can be reduced.

Based-on-a-patch-by: mustrumr97@gmail.com

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

We must be careful not to leave PR_SET_KEEPCAPS on. We could use the
setresuid() call to drop capabilities, but the rules when capabilities
are dropped are fairly complex, since a transition to non-zero uid must
happen. Let's instead keep the capabilities during setresuid(), and drop
them later.
2015-02-01 17:22:32 -05:00
Michael Olbrich 615938651d config_parse_set_status: put signals in the correct set
This was broken when the code was rearranged in "1e2fd62d70ff
core/load-fragment.c: correct argument sign and split up long lines"
2015-02-01 17:22:31 -05:00
Zbigniew Jędrzejewski-Szmek 5ffa8c8181 Add a snprinf wrapper which checks that the buffer was big enough
If we scale our buffer to be wide enough for the format string, we
should expect that the calculation was correct.

char_array_0() invocations are removed, since snprintf nul-terminates
the output in any case.

A similar wrapper is used for strftime calls, but only in timedatectl.c.
2015-02-01 17:21:39 -05:00
Zbigniew Jędrzejewski-Szmek 294929f891 tmpfiles: accurately report creation results 2015-02-01 12:44:04 -05:00
Zbigniew Jędrzejewski-Szmek 612532206c tmpfiles: remove dead branch
In the test, p is a path to a directory, always absolute. dent->d_name
is a single path component, so they cannot be equal. The comparison
was wrong also for other reasons: D type supports globs, so direct
comparisons using streq are not enough.
2015-02-01 12:44:04 -05:00
Zbigniew Jędrzejewski-Szmek a3bd89ea99 core/cgroup: fix embarrassing typo
https://github.com/docker/docker/issues/10280
2015-01-31 23:03:56 -05:00
Zbigniew Jędrzejewski-Szmek afa3509a4f test-dhcp-client: remove linebreak 2015-01-31 12:25:12 -05:00
Tom Gundersen d4cdbea555 networkd: dhcp-server - start as soon as addresses have been set
We would otherwise wait for the interface to be completely configured, which
could take considerable time with IPv4LL. As a result nspawn was very slow
at obtaining IP addresses.
2015-01-31 15:26:08 +01:00
Tom Gundersen 79b1f37d95 networkd-wait-online: allow specific devices to be ignored
In addition to the loopback device, also explicitly configured devices to be ignored.

Suggested by Charles Devereaux <systemd@guylhem.net>.
2015-01-31 15:26:08 +01:00
Tom Gundersen 233ba5c3a0 sd-rtnl: don't fail event handler when callback fails
As in sd-bus, simply log at debug level when a callback fails, but don't fail the event handler.
Otherwise any error returned by any callback will disable the rtnl event handler. We should
only do that on serious internal errors in sd-rtnl that we know cannot be recovered from.
2015-01-31 15:26:08 +01:00
Maxim Mikityanskiy 81f5fc2d43 core: make setting the shutdown watchdog configuration via dbus work
https://bugs.freedesktop.org/show_bug.cgi?id=88284
2015-01-30 18:48:18 -05:00
Kay Sievers 954871d8ba Revert "sd-bus: change serialization of kdbus messages to qualify in their entirety as gvariant objects"
This breaks booting with kdbus.

This reverts commit b381de4197.
2015-01-30 13:53:45 +01:00
Kay Sievers 82c28f5621 Revert "core: make setting the shutdown watchdog configuration via dbus work"
This reverts commit df6e44c4af.

systemd --version segfaults.

Starting program: /usr/lib/systemd/systemd --version
Missing separate debuginfos, use: debuginfo-install systemd-216-16.fc21.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
systemd 218
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN

Program received signal SIGSEGV, Segmentation fault.
0x000055555557c9be in main (argc=2, argv=0x7fffffffe4d8) at src/core/main.c:1832
1832            arg_shutdown_watchdog = m->shutdown_watchdog;
(gdb) bt
(gdb) bt full
        m = 0x0
2015-01-30 10:59:47 +01:00
Zbigniew Jędrzejewski-Szmek 3e495a6651 systemctl: refuse --host with cat
This might be fixed one day, but for now it's better to fail.

https://bugzilla.redhat.com/show_bug.cgi?id=1186952
2015-01-28 21:56:10 -05:00
Lennart Poettering f11943c53e coredump: drop caps while we are processing the coredump
https://bugs.freedesktop.org/show_bug.cgi?id=87354
2015-01-29 02:47:29 +01:00
Lennart Poettering 9e8abdf0d9 Revert "journal: do not check for number of files"
This reverts commit b914ea8d37.

We really need to put a limit on all our resources, everywhere, and in
particular if we operate on external data.

Hence, let's reintroduce the limit, but bump it substantially, so that
it is guaranteed to be higher than any realistic RLIMIT_NOFILE setting.
2015-01-29 02:11:55 +01:00
Maxim Mikityanskiy df6e44c4af core: make setting the shutdown watchdog configuration via dbus work
https://bugs.freedesktop.org/show_bug.cgi?id=88284
2015-01-29 01:23:50 +01:00
Tom Gundersen 73b23bea86 networkd: tunnel - call tunnel modes ipip6, not ip4ipv6 to match ip(8) 2015-01-28 21:35:54 +01:00
Martin Pitt be94d95499 logind: handle closing sessions over daemon restarts
It may happen that you have several sessions with the same VT:

 - Open a session c1 which leaves some processes around, and log out. The
   session will stay in State=closing and become Active=no.
 - Log back in on the same VT, get a new session "c2" which is State=active and
   Active=yes.

When restarting logind after that, the first session that matches the current
VT becomes Active=yes, which will be c1; c2 thus is Active=no and does not get
the usual polkit/device ACL privileges.

Restore the "closing" state in session_load(), to avoid treating all restored
sessions as State=active. In seat_active_vt_changed(), prefer active sessions
over closing ones if more than one session matches the current VT.

Finally, fix the confusing comment in session_load() and explain it a bit
better.

https://launchpad.net/bugs/1415104
2015-01-28 20:03:38 +01:00
Lennart Poettering 40672b99c7 util: add comment explaining hostname_is_valid() 2015-01-28 17:48:05 +01:00
Lennart Poettering f50f01f4b7 sd-dhcp: chop of trailing dot of DHCP supplied host and domain nams 2015-01-28 17:47:37 +01:00
Martin Pitt 06e9788888 core/mount: add dependencies to dynamically mounted mounts too
Add unit dependencies for dynamic (i. e. not from fstab) mounts. With that,
mount units properly bind to their underlying device, and thus get
automatically stopped/unmounted when the underlying device goes away.

This cleans up stale mounts from unplugged devices.

Thanks to Lennart Poettering for pointing out the fix!
2015-01-28 17:02:28 +01:00
Lennart Poettering 3315f08517 sysv-generator: no need to check for identical symlinks source and target twice
http://lists.freedesktop.org/archives/systemd-devel/2015-January/027594.html
2015-01-28 15:11:49 +01:00
Lennart Poettering 82a2b6bb5e core: output unit status output strings to console, only if we actually are changing unit state
Unit _start() and _stop() implementations can fail with -EAGAIN to delay
execution temporarily. Thus, we should not output status messages before
invoking these calls, but after, and only when we know that the
invocation actually made a change.
2015-01-28 15:07:13 +01:00
Lennart Poettering 3ad85e3775 test: duplicate LIST_FOREACH_OTHERS test to check for corner cases of end and start of list 2015-01-28 14:22:13 +01:00
Lennart Poettering cdda4aa8d2 list: properly skip over first item in LIST_FOREACH_OTHERS 2015-01-28 14:04:23 +01:00
Lennart Poettering d1f6b1b455 manager: fix minor typo 2015-01-28 14:04:23 +01:00
Martin Pitt 40780877c1 sysv-generator: Re-fix .sh suffix handling
Commit 4e48855534 caused the .sh suffix to be stripped from the original
"filename", which caused the generated units to call the wrong init.d script.
Only use the .sh stripped file name for comparing with Provides:, not for
generating the Exec*= lines.

Spotted by sysv-generator-test.
2015-01-28 08:00:28 +01:00