Commit Graph

21670 Commits

Author SHA1 Message Date
Lennart Poettering 5fdfbbd505 pam_systemd: tiny coding style fix 2018-07-25 16:09:33 +02:00
Lennart Poettering f5cb2820fd pam_systemd: also make $XDG_SESSION_DESKTOP configurable via PAM module command line
Let's make this symmetric with XDG_SESSION_CLASS and XDG_SESSION_TYPE,
so that PAM stacks can configure this easily without involving env vars,
in case there are PAM session managers which only support a single
desktop anyway.
2018-07-25 16:09:33 +02:00
Lennart Poettering 0ecc1c9d7c pam_systemd: simplify how we process env vars
Let's introduce a single unified getenv() implementation for the various
fields we need.

No change in behaviour.
2018-07-25 16:09:33 +02:00
Lennart Poettering 2b2b7228bf pam_systemd: drop setting DBUS_SESSION_BUS_ADDRESS
Since D-Bus 1.9.14 (2015-03-02) dbus looks in $XDG_RUNTIME_DIR/bus for
the system bus on its own, hence we can finally drop setting this
environment variable. gdbus since glib 2.45.3 (June 2015) also supports
it.
2018-07-25 16:09:33 +02:00
Zbigniew Jędrzejewski-Szmek 2b5107e162 core/main: use return log_*_errno more 2018-07-25 14:48:07 +02:00
Lennart Poettering 9fb96abdfd networkd: fix overflow check
Fixes: #9591
2018-07-25 14:13:10 +02:00
Zbigniew Jędrzejewski-Szmek 17086a40c1
Merge pull request #9668 from poettering/open-parent
introduce open_parent() helper
2018-07-25 12:58:45 +02:00
Lennart Poettering ac7ec2883d main: use log_error_errno() at one more place 2018-07-25 12:31:50 +02:00
Lennart Poettering 3a7369495b pam_systemd: explain in detail why pam_systemd does the PAM item mangling it does in comments
The old comments were imprecise, and misleading. Let's extend things and
explain the situation in more detail.
2018-07-25 12:31:50 +02:00
Yu Watanabe e0d95f039a network: make log level lower when operations are automatically re-tried later
When networkd has not connected and setting hostname/timezone is
requested, the operation is delayed, not canceled. So, logging in
debug level is sufficient for the corresponding log message.

Closes #9699.
2018-07-25 12:21:53 +02:00
Yu Watanabe 06202b9e65 nss: do not modify errno when NSS_STATUS_NOTFOUND or NSS_STATUS_SUCCESS
This also adds PROTECT_ERRNO for all nss module functions.

C.f. glibc NSS documents https://www.gnu.org/software/libc/manual/html_node/NSS-Modules-Interface.html
and discussion in https://sourceware.org/bugzilla/show_bug.cgi?id=23410.

Fixes #9585.
2018-07-25 10:23:22 +02:00
Zbigniew Jędrzejewski-Szmek 8d455017ee Drop more copyright headers 2018-07-24 14:40:38 +02:00
Yu Watanabe df0fbad0d4 resolve: add assert_not_reached()
Follow-up for 3fe30d85e3.
2018-07-24 13:00:11 +02:00
Zbigniew Jędrzejewski-Szmek 98310c71dd test-network-tables: add dhcp6_message_type to test
Follow-up for e91c99059b.
2018-07-24 12:59:52 +02:00
Zbigniew Jędrzejewski-Szmek b215c2e7e2 Drop some more copyright headers
Acks in https://github.com/systemd/systemd/issues/9320.
2018-07-24 11:16:01 +02:00
Lennart Poettering ae0db6f132
Merge pull request #9687 from yuwata/rfe-9662
analyze: several systemd-analyze plot improvements
2018-07-24 09:43:57 +02:00
Lennart Poettering 0dbff467f7
Merge pull request #9685 from yuwata/fix-9663
core: serialize and deserialize current ShowStatus
2018-07-23 21:17:07 +02:00
Lennart Poettering b0c34d2e26
Merge pull request #9701 from yuwata/string-table-cleanups
String table cleanups
2018-07-23 21:16:34 +02:00
Yu Watanabe feb927762e analyze: add a space in pretty boot time string 2018-07-24 03:47:41 +09:00
Yu Watanabe 4f481d76fc analyze: show information from hostnamed in plot even when user mode 2018-07-24 03:47:31 +09:00
Yu Watanabe 8c00656560 analyze: plot initrd related timestamps 2018-07-24 03:47:20 +09:00
Yu Watanabe 665a9774e0 core: expose initrd related timestamps on bus 2018-07-24 03:47:07 +09:00
Yu Watanabe d4ee7bd849 core: serialize/deserialize several timestamps on initrd in different names 2018-07-24 03:45:51 +09:00
Yu Watanabe 7725fc11ba analyze: plot units in initrd
Closes #9662.
2018-07-24 03:34:10 +09:00
Zbigniew Jędrzejewski-Szmek 915fa28549
Merge pull request #9560 from mbiebl/uaccess-dev-kvm
Re-add uaccess tag for /dev/kvm
2018-07-23 20:10:38 +02:00
Yu Watanabe 03d63a8182 test: add more string-table tests in test-tables 2018-07-24 01:26:30 +09:00
Yu Watanabe e6e7a551a0 test: add more string-table tests in test-resolve-tables 2018-07-24 01:26:14 +09:00
Yu Watanabe e91c99059b test: add comment in test-network-tables.c 2018-07-24 01:25:24 +09:00
Yu Watanabe 3fe30d85e3 resolve: define _DNS_SERVER_TYPE_MAX in enum 2018-07-24 01:23:41 +09:00
Yu Watanabe dc8bc9adde sd-device: include sd-device.h in device-internal.h 2018-07-24 01:22:32 +09:00
Lion Yang 2fafabfdc4 coredumpctl: info shows the last entry by default
Closes #9524.
2018-07-23 17:45:53 +02:00
Lennart Poettering 1d2d351319
Merge pull request #9658 from LukeShu/to-upstream/misc-cleanup
nspawn: Miscellaneous touch-up
2018-07-23 17:44:56 +02:00
Yu Watanabe aa8d423ef9 systemctl: set string table size for safety 2018-07-23 23:59:09 +09:00
Yu Watanabe a890906ce3 test: add a table test for ShowStatus 2018-07-23 23:45:01 +09:00
Yu Watanabe bee38b5cf8 core: serialize and deserialize current ShowStatus
Fixes #9663.
2018-07-23 23:42:48 +09:00
Yu Watanabe 7a293242e0 core: normalize ShowStatus 2018-07-23 21:55:26 +09:00
Yu Watanabe 08540a9591 meson: allow building resolved and machined without nss modules
This adds -Dnss-resolve= and -Dnss-mymachines= meson options.
By using this option, e.g., resolved can be built without nss-resolve.
When no nss modules are built, then test-nss is neither built.

Also, This changes the option name -Dmyhostname= to -Dnss-myhostname=
for consistency to other nss related options.

Closes #9596.
2018-07-23 14:03:05 +02:00
Yu Watanabe a0cb8078b1 meson: drop redundant messages
The equivalent messages are shown in the last summary.
2018-07-23 14:03:05 +02:00
Jon Ringle fbb48d4c66 Make final kill signal configurable
Usecase is to allow changing the final kill from SIGKILL to SIGQUIT which
should create a core dump useful for debugging why the service didn't stop
with the SIGTERM
2018-07-23 13:44:54 +02:00
Lennart Poettering 0c462ea4ef tree-wide: port various bits over to open_parent() 2018-07-23 13:38:18 +02:00
Lennart Poettering ef8becfac5 fs-util: introduce open_parent() helper
We often open the parent directory of a path. Let's add a common helper
for that, that shortens our code a bit and adds some extra safety
checks, for example it will fail if used on the root directory (which
doesn't really have a parent).

The helper is actually generalized from a function in btrfs-util.[ch]
which already existed for this purpose.
2018-07-23 13:38:18 +02:00
Lennart Poettering 09942654d3 fileio: add additional safety checks
Let's protect against attempts to create temporary files above the root
dir, as that makes little sense.

Let's better be safe than sorry.
2018-07-23 13:38:18 +02:00
Lennart Poettering 3e14d36a8a systemctl: show ExecStop= data after ExecStart= data
the service manager serializes ExecStop= execution data after
ExecStart=, like it makes sense and how it should be expected. However,
systemctl previously would reverse them when deserializing them locally,
and thus show ExecStop= results before ExecStart= results. And that's
confusing. Let's fix that.
2018-07-23 13:36:47 +02:00
Lennart Poettering 6a1d4d9fa6 core: properly reset all ExecStatus structures when entering a new unit cycle
Whenever a unit is started fresh we should flush out any runtime data
from the previous cycle. We are pretty good at that already, but what so
far we missed was the ExecStart=/ExecStop=/… command exit status data.
Let's fix that, and properly flush out that stuff too.

Consider this service:

    [Service]
    ExecStart=/bin/sleep infinity
    ExecStop=/bin/false

When this service is started, then stopped and then started again
"systemctl status" would show the ExecStop= results of the previous run
along with the ExecStart= results of the current one, which is very
confusing. With this patch this is corrected: the data is kept right
until the moment the new service cycle starts, and then flushed out.
Hence "systemctl status" in that case will only show the ExecStart=
data, but no ExecStop= data, like it should be.

This should fix part of the confusion of #9588
2018-07-23 13:36:47 +02:00
Lennart Poettering 42cb05d5ff execute: document what the different structures are for in comments 2018-07-23 13:36:47 +02:00
Lennart Poettering ee39ca20c6 core: drop "argv" field from ExecParameter structure
We always initialize it from the same field in ExecCommand anyway, hence
there's no point in passing it separately to exec_spawn(), after all we
already pass the ExecCommand structure itself anyway.

No change in behaviour.
2018-07-23 13:36:47 +02:00
Lennart Poettering 2ed26ed065 execute: use structure initialization when filling in exec status 2018-07-23 13:36:47 +02:00
Evgeny Vereshchagin 0ffa4c7c4b tests: skip test_get_process_cmdline_harder if `mount --make-rslave /` fails with EPERM or EACCESS
That call to mount was added as a safeguard against a kernel bug which was fixed in
torvalds/linux@bbd5192.

In principle, the error could be ignored because

* normally everything mounted on /proc/PID should disappear as soon as the PID has gone away
* test-mount-util that had been confused by those phantom entries in /proc/self/mountinfo was
  taught to ignore them in 112cc3b.

On the other hand, in practice, if the mount fails, then the next one is extremely unlikely to
succeed, so it seems to be reasonable to just skip the rest of `test_get_process_cmdline_harder`
if that happens.

Closes https://github.com/systemd/systemd/issues/9649.
2018-07-23 11:30:57 +02:00
Carlo Caione ba9778d9b7 login1: policy: Authorize active users to boot to firmware
Currently to set the flag to reboot into the firmware setup an
authentication by an administrative user is required. Since we are
already enabling active users to reboot the system, it is advisable to
let the user decide if he wants to boot into the firmware setup without
any more hassle.
2018-07-23 11:12:33 +02:00
Yu Watanabe ba323bbead meson: do not build module-util.c when libkmod is not found
Follow-up for 3cb9b42af3 (#9516).

Fixes oss-fuzz-9532.
2018-07-23 08:50:26 +02:00
Yu Watanabe f330408d62 tree-wide: drop empty lines in comments 2018-07-23 08:44:24 +02:00
Filipe Brandenburger 46f2579c2a systemctl: Only wait when there's something to wait for.
Tested:
- `systemctl --wait start i-do-not-exist.service` does not wait.
- `systemctl --wait start i-do-not-exist.service valid-unit.service` does.
2018-07-21 23:40:08 +09:00
Luke Shumaker 677a72cd3e nspawn: mount_sysfs(): Unconditionally mkdir /sys/fs/cgroup
Currently, mount_sysfs() only creates /sys/fs/cgroup if cg_ns_supported().
The comment explains that we need to "Create mountpoint for
cgroups. Otherwise we are not allowed since we remount /sys read-only.";
that is: that we need to do it now, rather than later.  However, the
comment doesn't do anything to explain why we only need to do this if
cg_ns_supported(); shouldn't we _always_ need to do it?

The answer is that if !use_cgns, then this was already done by the outer
child, so mount_sysfs() only needs to do it if use_cgns.  Now,
mount_sysfs() doesn't know whether use_cgns, but !cg_ns_supported() implies
!use_cgns, so we can optimize" the case where we _know_ !use_cgns, and deal
with a no-op mkdir_p() in the false-positive where cgns_supported() but
!use_cgns.

But is it really much of an optimization?  We're potentially spending an
access(2) (cg_ns_supported() could be cached from a previous call) to
potentially save an lstat(2) and mkdir(2); and all of them are on virtual
fileystems, so they should all be pretty cheap.

So, simplify and drop the conditional.  It's a dubious optimization that
requires more text to explain than it's worth.
2018-07-20 12:12:03 -04:00
Luke Shumaker f09e86bcaa cgroup-util: cg_kernel_controllers(): Fix comment about including "name="
Remove "arbitrary named hierarchies" from the list of things that
cg_kernel_controllers() might return, and clarify that "name="
pseudo-controllers are not included in the returned list.

/proc/cgroups does not contain "name=" pseudo-controllers, and
cg_kernel_controllers() makes no effort to enumerate them via a different
mechanism.
2018-07-20 12:12:02 -04:00
Luke Shumaker 93dbdf6cb1 nspawn: sync_cgroup(): Rename arg_uid_shift -> uid_shift
Naming it arg_uid_shift is confusing because of the global arg_uid_shift in
nspawn.c
2018-07-20 12:12:02 -04:00
Luke Shumaker 0402948206 nspawn: Move cgroup mount stuff from nspawn-mount.c to nspawn-cgroup.c 2018-07-20 12:12:02 -04:00
Luke Shumaker 2fa017f169 nspawn: Simplify tmpfs_patch_options() usage, and trickle that up
One of the things that tmpfs_patch_options does is take an (optional) UID,
and insert "uid=${UID},gid=${UID}" into the options string.  So we need a
uid_t argument, and a way of telling if we should use it.  Fortunately,
that is built in to the uid_t type by having UID_INVALID as a possible
value.

So this is really a feature that requires one argument.  Yet, it is somehow
taking 4!  That is absurd.  Simplify it to only take one argument, and have
that trickle all the way up to mount_all()'s usage.

Now, in may of the uses, the argument becomes

    uid_shift == 0 ? UID_INVALID : uid_shift

because it used to treat uid_shift=0 as invalid unless the patch_ids flag
was also set.  This keeps the behavior the same.  Note that in all cases
where it is invoked, if !use_userns (sometimes called !userns), then
uid_shift is 0; we don't have to add any checks for that.

That said, I'm pretty sure that "uid=0" and not setting "uid=" are the
same, but Christian Brauner seemed to not think so when implementing the
cgns support.  https://github.com/systemd/systemd/pull/3589
2018-07-20 12:12:02 -04:00
Luke Shumaker 9c0fad5fb5 nspawn: Simplify mkdir_userns() usage, and trickle that up
One of the things that mkdir_userns{,_p}() does is take an (optional) UID,
and chown the directory to that.  So we need a uid_t argument, and a way of
telling if we should use that uid_t argument.  Fortunately, that is built
in to the uid_t type by having UID_INVALID as a possible value.

However, currently mkdir_userns() also takes a MountSettingsMask and checks
a couple of bits in it to decide if it should perform the chown.

Drop the mask argument, and instead have the caller pass UID_INVALID if it
shouldn't chown.
2018-07-20 12:12:02 -04:00
Lennart Poettering 79d53eb8f7 bus-unit-util: tiny coding style fix 2018-07-20 16:57:35 +02:00
Lennart Poettering 2f28018cb8 nss: never become IPC clients for services that are about to be started
This is an attempt to automatically detect and avoid certain kinds of
NSS deadlocks as discussed in this thread:

https://lists.freedesktop.org/archives/systemd-devel/2018-July/040975.html
2018-07-20 16:57:35 +02:00
Lennart Poettering d521916d0f pid1: tell PAM/NSS modules why we are calling them 2018-07-20 16:57:35 +02:00
Lennart Poettering 088c49c3da growfs: make global variables that don't need to be exported static 2018-07-20 16:57:35 +02:00
Lennart Poettering 6b228852bc path-util: avoid name clashes
One of those days we should rework this to use the UNIQ macros, but for
now, an underscore should be enough.
2018-07-20 16:57:35 +02:00
Lennart Poettering ccfc19c960 env-util: make env-util.h self contained
The header file references strlen(), hence it should include string.h
2018-07-20 16:57:35 +02:00
Lennart Poettering 74bf45bb2c tests: prefer MS_SLAVE over MS_PRIVATE for turning off mount propagation
When we open our own little namespace for running our tests in, let's
turn off mount propagation only one way, rather than both ways. This is
better as this means we don't pin host mounts unnecessarily long in our
namespace, even though the host already got rid of them. This is because
MS_SLAVE in contrast to MS_PRIVATE allows umount events to propagate
from the host into our environment.
2018-07-20 16:51:20 +02:00
Lennart Poettering f606cd16d3
Merge pull request #9500 from zsol/append
Add support for opening files for appending
2018-07-20 15:45:08 +02:00
Alan Jenkins d3243f55ca core: remove support for API bus "started outside our own logic"
Looking at a recent Bad Day, my log contains over 100 lines of

    systemd[23895]: Failed to connect to API bus: Connection refused

It is due to "systemd --user" retrying to connect to an API bus.[*]  I
would prefer to avoid spamming the logs.  I don't think it is good for us
to retry so much like this.

systemd was mislead by something setting DBUS_SESSION_BUS_ADDRESS.  My best
guess is an unfortunate series of events caused gdm to set this.  gdm has
code to start a session dbus if there is not a bus available already (and
in this case it exports the environment variable).  I believe it does not
normally do this when running under systemd, because "systemd --user" and
hence "dbus.service" would already have been started by pam_systemd.

I see two possibilities

1. Rip out the check for DBUS_SESSION_BUS_ADDRESS entirely.
2. Only check for DBUS_SESSION_BUS_ADDRESS on startup.  Not in the
   "recheck" logic.

The justification for 2), is that the recheck is called from unit_notify(),
this is used to check whether the service just started (or stopped) was
"dbus.service".  This reason for rechecking does not apply if we think
the session bus was started outside our logic.

But I think we can justify 1).  dbus-daemon ships a statically-enabled
/usr/lib/systemd/user/dbus.service, which would conflict with an attempt to
use an external dbus.  Also "systemd --user" is started from user@.service;
if you try to start it manually so that it inherits an environment
variable, it will conflict if user@.service was started by pam_systemd
(or loginctl enable-linger).
2018-07-20 15:25:55 +02:00
Lennart Poettering 496a6ba40e
Merge pull request #9516 from keszybz/module-load-unification
Module load unification
2018-07-20 13:55:56 +02:00
Lennart Poettering 9638adaf21
Merge pull request #9614 from poettering/negative-sec
parse-util: make sure "-0.-0s" is not considered a valid time specifi…
2018-07-20 13:22:01 +02:00
Zsolt Dollenstein 566b7d23eb Add support for opening files for appending
Addresses part of #8983
2018-07-20 03:54:22 -07:00
Yu Watanabe efe6112dc5 analyze: fix width calculation in plot command 2018-07-20 12:51:31 +02:00
Lennart Poettering 48a0ab391c
Merge pull request #9659 from yuwata/fix-network-memleak2
fix networkd memleak and voidify several function calls
2018-07-20 12:38:49 +02:00
Yu Watanabe b22c8bfcd4 hostname: set sd_event_add_signal() 2018-07-20 15:00:02 +09:00
Yu Watanabe 50008ae48a locale: set sd_event_add_signal() 2018-07-20 14:59:36 +09:00
Yu Watanabe 754f026935 timedate: set sd_event_add_signal() 2018-07-20 14:59:23 +09:00
Filipe Brandenburger 279f52a1d3 parse-util: make sure "3.+1s" or "3. 1s" are not considered valid time specification
Indeed, strtoll() is super-hard to use properly! :-(

Also added more tests for those cases and copied the tests to parse_nsec as well.
2018-07-19 22:09:54 -07:00
Yu Watanabe 8b7140dbd0 timesync: voidify sd_event_add_signal() and sd_event_set_watchdog() 2018-07-20 11:30:11 +09:00
Yu Watanabe 1ae1729214 resolve: voidify sd_event_add_signal() and sd_event_set_watchdog() 2018-07-20 11:29:59 +09:00
Yu Watanabe 05e2162773 network: voidify sd_event_add_signal() and sd_event_set_watchdog() 2018-07-20 11:29:49 +09:00
Yu Watanabe e42699438a network: add missing sd_netlink_unref() 2018-07-20 11:23:24 +09:00
Zbigniew Jędrzejewski-Szmek 4fdf69078a udev-builtin-kmod: adjust logging
I guess the one about "execute" was from the time when modprobe was called
directly.
2018-07-19 18:28:21 +02:00
Zbigniew Jędrzejewski-Szmek 81d7c69657 core: use the generic module_load() function
This allows aliases to be used for the basic modules we load from pid1 before
udev is started. In #9501 the kernel renamed autofs4 to autofs, with "autofs4"
as alias, but we wouldn't load the module, because we didn't follow aliases.
The kernel change was reverted, but it's probably better to support aliases.
2018-07-19 18:28:21 +02:00
Zbigniew Jędrzejewski-Szmek 9b38ec87da shared/module-util: fix preexisting mixup with errno sign 2018-07-19 18:28:21 +02:00
Zbigniew Jędrzejewski-Szmek c3ad978633 udev-builtin-kmod: use the generic module_load() function
There should be no functional change.
2018-07-19 18:28:21 +02:00
Yu Watanabe 4b0051b1b6 resolve: drop unused slot 2018-07-19 11:28:42 +02:00
Filipe Brandenburger d9fb7afb48 coverity: Add custom assertion macros for Coverity
These custom macros make the expression go through a function, in order
to prevent ASSERT_SIDE_EFFECT false positives on our macros such as
assert_se() and assert_return() that cannot be disabled and will always
evaluate their expressions.

This technique has been described and recommended in:
https://community.synopsys.com/s/question/0D534000046Yuzb/suppressing-assertsideeffect-for-functions-that-allow-for-sideeffects

Tested by doing a local cov-build and uploading the resulting tarball to
scan.coverity.com, confirmed that the ASSERT_SIDE_EFFECT false positives
were gone.
2018-07-19 09:07:25 +02:00
Lennart Poettering 8b3169b9a1
Merge pull request #9600 from keszybz/systemctl-mask-check
Systemctl mask check
2018-07-18 21:03:02 +02:00
Lennart Poettering 8d568e8d3e
Merge pull request #9346 from keszybz/journald-exact2
Store a copy of the input message if any stripping or truncation occurs
2018-07-18 21:00:43 +02:00
Yu Watanabe 2e7e8e34aa sd-bus: make bus_slot_disconnect() also unref the slot object
This makes bus_slot_disconnect() unref the slot object from bus when
`unref == true` and it is floating, as the function removes the
reference from the relevant bus object.

This reverts 20d4ee2cbc, as it
introduces #9604.

Fixes #9604.
2018-07-18 20:54:19 +02:00
Lennart Poettering 3bdfea0820
Merge pull request #9643 from keszybz/two-meson-fixmes
Two meson fixmes
2018-07-18 20:32:28 +02:00
Lennart Poettering 900ae0d7ff
Merge pull request #9633 from yuwata/network-fix-memleak
network: fix memleak
2018-07-18 20:32:03 +02:00
Zbigniew Jędrzejewski-Szmek 1d7aedf11a meson: remove false check for key_serial_t
key_serial_t is defined in keyutil.h, which wasn't included in the header list
in the test, so the test always failed. We were always compiling stuff with
!HAVE_KEY_SERIAL_T.

We could try to add keyutil.h to the test, but then we'd have to first check if
it is available, which just doesn't seem worth the trouble.

key_serial_t should always be defined as int32_t. Let's keep the uncoditional
define, since repeated compatible typedefs are not a problem, and it allows us
to compile even if the header file is missing. If there's ever a change in the
definition, we'll have to adjust the code for the different type anyway, and
our compiler will tell us.
2018-07-18 17:46:33 +02:00
Zbigniew Jędrzejewski-Szmek 9c869d08d8 meson: unify linux/stat.h check with other checks and use _GNU_SOURCE
Using _GNU_SOURCE is better because that's how we include the headers in the
actual build, and some headers define different stuff when it is defined.
sys/stat.h for example defines 'struct statx' conditionally.
2018-07-18 17:40:41 +02:00
Zbigniew Jędrzejewski-Szmek 6d77a30c09 bus: add comment to explain assert 2018-07-18 16:36:37 +02:00
Zbigniew Jędrzejewski-Szmek 7ae8edcd03 bus: move BUS_DONT_DESTROY calls after asserts
It's not useful to bump the reference count before checking if the object is
NULL. Thanks to d40f5cc498 we can do this ;).

Related to https://bugzilla.redhat.com/show_bug.cgi?id=1576084,
https://bugzilla.redhat.com/show_bug.cgi?id=1575340,
https://bugzilla.redhat.com/show_bug.cgi?id=1575350. I'm not sure why those two
people hit this code path, while most people don't. At least we won't abort.
2018-07-18 12:16:33 +02:00
Yu Watanabe ddfc4f6e34 network: free routes assigned to link 2018-07-18 13:07:27 +09:00
Yu Watanabe 0ade014c8b network: simplify link_free() 2018-07-18 13:06:34 +09:00
Yu Watanabe 3534a04300 network: move sd_event initialization to manager_new() 2018-07-18 12:37:50 +09:00
Filipe Brandenburger 3f10c66270 bus-socket: Fix line_begins() to accept word matching full string
The switch to memory_startswith() changed the logic to only look for a space or
NUL byte after the matched word, but matching the full size should also be
acceptable.

This changed the behavior of parsing of "AUTH\r\n", where m will be set to 4,
since even though the word will match, the check for it being followed by ' '
or NUL will make line_begins() return false.

Tested:

- Using netcat to connect to the private socket directly:
  $ echo -ne '\0AUTH\r\n' | sudo nc -U /run/systemd/private
  REJECTED EXTERNAL ANONYMOUS

- Running the Ignition blackbox test:
  $ sudo sh -c 'PATH=$PWD/bin/amd64:$PATH ./tests.test'
  PASS

Fixes: d27b725abf
2018-07-17 21:42:20 +02:00
Lennart Poettering ed698d3028 sleep: tiny coding style updates
No change in behaviour
2018-07-17 21:41:56 +02:00
Filipe Brandenburger 06c28aa0d8 resolvectl: Take empty string argument to clear lists in "dns", "domain" and "nta" options
The current CLI does not support a way to clear these lists, since without any
additional arguments, the command will list the current values.

Introduce a new way to clear the lists by passing a single '' argument to these
subcommands.

Update the man page to document this.

Tested:
  $ build/resolvectl domain eth1
  Link 3 (eth1): ~.
  $ build/resolvectl domain eth1 ''
  $ build/resolvectl domain eth1
  Link 3 (eth1):
  $ build/resolvectl domain eth1 '~.' '~example.com'
  $ build/resolvectl domain eth1
  Link 3 (eth1): ~. ~example.com
  $ build/resolvectl domain eth1 ''
  $ build/resolvectl domain eth1
  Link 3 (eth1):
  $ build/resolvectl domain eth1 '~.'
  $ build/resolvectl domain eth1
  Link 3 (eth1): ~.

And similar for "dns" and "nta".
2018-07-17 21:20:52 +02:00
Lennart Poettering 5a9fb35843 parse-util: make sure "-0.-0s" is not considered a valid time specification
Did I mention that strtoll() is super-hard to use properly?
2018-07-17 13:01:46 +02:00
Lennart Poettering a7edb403e5
Merge pull request #9601 from yuwata/small-fixes
Small fixes
2018-07-17 12:40:52 +02:00
Yu Watanabe cad4359568 network: drop unused slots 2018-07-17 12:40:04 +02:00
Yu Watanabe 948f7ce4fb login: fix typo in log message
Reported in #9590.
2018-07-17 03:10:32 +09:00
Yu Watanabe 2bb8d8d9b2 process-util: do not hide global variable
Suggested by LGTM.
2018-07-17 03:06:45 +09:00
remueller 2667385b0e tmpfiles: set only default acls to folders #9545 (#9599)
Check if the fd is a folder before setting default acls

Tested:

Ubuntu 18.04.

test.conf: A+ /tmp/test - - - - u:user2:rw,d:u:user1:rwx

The folder /tmp/test looks like

    /tmp/test/file1
    /tmp/test/folder2

start systemd-tmpfiles manually

Fixes: #9545
2018-07-16 16:56:01 +02:00
Yu Watanabe 460d7ac3a2
Merge pull request #9550 from nosada/fix-9549
format-table: make all widths be set properly
2018-07-16 23:02:32 +09:00
Zbigniew Jędrzejewski-Szmek 86f004fbb5 systemctl: allow 'edit' to work on templates again
This got broken in 9d9dd746d4, because a template
is not a valid unit, so the check for being masked failed. Avoid this by
handling templates specially. Fixes #9554.

Also, this improves 'cat' with masked units:

(before) $ systemctl cat foofoofoo@.service
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument

(after) $ build/systemctl cat foofoofoo@.service

In check_triggering_units(), the call to unit_is_masked() is replaced with an
open-coded check. This is a bit unfortunate, but unit_is_masked() now requires
LookupPaths to be initialized, which we don't have or need in this case, so it
seems easiest to just accept this tiny code duplication.
2018-07-16 15:52:40 +02:00
Yu Watanabe 385b2eb262 sd-bus: make BUS_DEFAULT_TIMEOUT configurable
This adds sd_bus_{get,set}_method_call_timeout().
If the timeout is not set or set to 0, then the timeout value is
parsed from $SYSTEMD_BUS_TIMEOUT= environment variable. If the
environment variable is not set, then built-in timeout is used.
2018-07-16 15:11:50 +02:00
Lennart Poettering db9eee7e45
Merge pull request #9530 from keszybz/sd-bus-doc
More documentation for sd-bus
2018-07-16 15:01:12 +02:00
Zbigniew Jędrzejewski-Szmek 3cb9b42af3 Move module-util.h to src/shared/ and load_module() to libshared
Unfortunately this needs libshared to link to libkmod. Before it was linked
into systemd-udevd, udevadm, and systemd each seperately. On most systems this
doesn't make much difference, because at least systemd would be installed, but
it might not be in small chroots. It is a small library, so I hope this is not
a big issue.
2018-07-16 13:08:40 +02:00
Zbigniew Jędrzejewski-Szmek d35f51ea84 tree-wide: use "polkit" to refer to PolicyKit/polkit
Back in 2012 the project was renamed, see the release notes for v 0.105
[https://cgit.freedesktop.org/polkit/tree/NEWS#n754]. Let's update our
documentation and comments to do the same. Referring to PolicyKit is confusing
to users because at the time the polkit api changed too, and we support the new
version. I updated NEWS too, since all the references to PolicyKit there were
added after the rename.

"PolicyKit" is unchanged in various URLs and method call names.
2018-07-16 12:44:24 +02:00
Filipe Brandenburger 75720bff62 build-sys: Detect whether struct statx is defined in sys/stat.h
Starting with glibc 2.27.9000-36.fc29, include file sys/stat.h will have a
definition for struct statx, in which case include file linux/stat.h should be
avoided, in order to prevent a duplicate definition.

    In file included from ../src/basic/missing.h:18,
		     from ../src/basic/util.h:28,
		     from ../src/basic/hashmap.h:10,
		     from ../src/shared/bus-util.h:12,
		     from ../src/libsystemd/sd-bus/bus-creds.c:11:
    /usr/include/linux/stat.h:99:8: error: redefinition of ‘struct statx’
     struct statx {
	    ^~~~~
    In file included from /usr/include/sys/stat.h:446,
		     from ../src/basic/util.h:19,
		     from ../src/basic/hashmap.h:10,
		     from ../src/shared/bus-util.h:12,
		     from ../src/libsystemd/sd-bus/bus-creds.c:11:
    /usr/include/bits/statx.h:36:8: note: originally defined here
     struct statx
	    ^~~~~

Extend our meson.build to look for struct statx when only sys/stat.h is
included and, in that case, do not include linux/stat.h anymore.

Tested that systemd builds correctly when using a glibc version that includes a
definition for struct statx.

glibc Fedora RPM update:
28cb5d31fc

glibc upstream commit:
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fd70af45528d59a00eb3190ef6706cb299488fcd
2018-07-16 11:14:29 +02:00
Yu Watanabe 86d18f3b09 login: use parse_uid() when unmounting user runtime directory
When unmounting user runtime directory, only UID is necessary,
and the corresponding user may not exist anymore.
This makes first try to parse the input by parse_uid(), and only if it
fails, prase the input by get_user_creds().

Fixes #9541.
2018-07-16 11:12:42 +02:00
Yu Watanabe 475d8599b0 format-table: fix typo in comment 2018-07-15 17:07:38 +09:00
Yu Watanabe a6e964712c test: add a reproducer of issue #9549 2018-07-15 17:07:18 +09:00
Michael Biebl ace5e3111c Do not apply uaccess tag for /dev/kvm if mode is 0666 2018-07-13 23:38:55 +02:00
Lennart Poettering 99352de644
Merge pull request #9462 from yuwata/strv_split
make strv_split() accept empty string and use it in pager_open()
2018-07-13 20:32:37 +02:00
Yu Watanabe 20d4ee2cbc sd-bus: unref slot->match_callback.install_slot when slot is disconnected
When a slot is disconnected, then slot->match_callback.install_slot
is also disconnected. So, bus_slot_disconnect() removes the install_slot
from the list of slots in bus, although it is a floating object.
This makes install_slot unreffed from bus when it is disconnected.

Fixes #9505 and #9510.
2018-07-13 20:07:43 +02:00
Yu Watanabe bd7d173274 machinectl: fix verbosity of import-raw or friends
This partially reverts 31d99bd172.

Fixes #9527.
2018-07-13 19:49:19 +02:00
Yu Watanabe eef836ed00 pull: initialize libgcrypt before calling any functions provided by libgcrypt
This fixes the following warning:
```
systemd-pull[4065]: Libgcrypt warning: missing initialization - please fix the application
```
2018-07-13 19:47:49 +02:00
Lennart Poettering 5901d89955
Merge pull request #9572 from yuwata/fix-9511
resolve: fix heap-use-after-free and uninitialized memory
2018-07-13 19:32:09 +02:00
Tejun Heo 4842263577 core: add MemoryMin
The kernel added support for a new cgroup memory controller knob memory.min in
bf8d5d52ffe8 ("memcg: introduce memory.min") which was merged during v4.18
merge window.

Add MemoryMin to support memory.min.
2018-07-12 08:21:43 +02:00
NOGISAKA Sadata a26db0bc5d format-table: make all widths be set properly
Fixes #9549.
2018-07-12 13:51:58 +09:00
Yu Watanabe 7b3bae217e resolve: use structured initializer
This fixes the following valgrind warning:
```
Syscall param sendmsg(msg.msg_name) points to uninitialised byte(s)
   at 0x6189CC1: sendmsg (in /usr/lib64/libpthread-2.27.so)
   by 0x153082: dns_stream_writev (resolved-dns-stream.c:235)
   by 0x153343: dns_stream_tls_writev (resolved-dns-stream.c:299)
   by 0x5B30343: ??? (in /usr/lib64/libgnutls.so.30.20.2)
   by 0x5B3158F: ??? (in /usr/lib64/libgnutls.so.30.20.2)
   by 0x5B33190: ??? (in /usr/lib64/libgnutls.so.30.20.2)
   by 0x5B36307: ??? (in /usr/lib64/libgnutls.so.30.20.2)
   by 0x5B37D47: gnutls_handshake (in /usr/lib64/libgnutls.so.30.20.2)
   by 0x154591: dns_stream_connect_tls (resolved-dns-stream.c:596)
   by 0x13A889: dns_transaction_emit_tcp (resolved-dns-transaction.c:676)
   by 0x13D901: dns_transaction_go (resolved-dns-transaction.c:1761)
   by 0x1330C8: dns_query_candidate_go (resolved-dns-query.c:156)
 Address 0xa9ac268 is 312 bytes inside a block of size 592 alloc'd
   at 0x4C30B06: calloc (vg_replace_malloc.c:711)
   by 0x1541F8: dns_stream_new (resolved-dns-stream.c:545)
   by 0x13A662: dns_transaction_emit_tcp (resolved-dns-transaction.c:642)
   by 0x13D901: dns_transaction_go (resolved-dns-transaction.c:1761)
   by 0x1330C8: dns_query_candidate_go (resolved-dns-query.c:156)
   by 0x134E16: dns_query_go (resolved-dns-query.c:757)
   by 0x11F3FB: bus_method_resolve_hostname (resolved-bus.c:353)
   by 0x4F947A7: method_callbacks_run (bus-objects.c:402)
   by 0x4F97266: object_find_and_run (bus-objects.c:1260)
   by 0x4F978B1: bus_process_object (bus-objects.c:1376)
   by 0x4FAF82C: process_message (sd-bus.c:2661)
   by 0x4FAFA1B: process_running (sd-bus.c:2703)
```
2018-07-12 13:38:35 +09:00
Yu Watanabe 18df5fb017 resolve: unref stream after completion processes
Fixes #9511.
2018-07-12 12:57:55 +09:00
Sven Joachim 06bed19ea1 core: Fix grammar in error message 2018-07-11 12:38:36 +02:00
Michael Biebl fa53e24130 Re-add uaccess tag for /dev/kvm
If --dev-kvm-mode is set to something different then 0666, which we
explicitly support, it makes sense to still apply the uaccess tag to
/dev/kvm. For distros which opt to use the default 0666, this change is
a nop.

This partially reverts commit b8fd3d8220.
2018-07-10 14:51:50 +02:00
Dave Reisner 25ea58d373 network/link: Fix logic error in matching devices by MAC
Prior to this commit, a .link file with a [Match] section containing
MACAddress= would match any device without a MAC. This restores the
matching logic prior to e90d037.
2018-07-07 13:48:59 +02:00
Yu Watanabe 70d6e5bd99 systemctl: make variable which stores environment variable constant 2018-07-07 01:39:14 +09:00
Yu Watanabe 43942e8055 pager: split $PAGER or $SYSTEMD_PAGER and use execvp()
This makes pager_open() correctly handle e.g. PAGER='  ' or PAGER=' cat '.
2018-07-07 01:38:32 +09:00
Yu Watanabe 0745ce7565 strv: make strv_split() accept empty string 2018-07-07 01:34:18 +09:00
Tomsod M 8255430754 show-status: add newline to ephemeral messages
Fixes #6712.  The newline is later reversed, naturally.
2018-07-06 16:35:22 +02:00
Zbigniew Jędrzejewski-Szmek 6755bb5548 core/kmod-setup: restore comments
They were removed in 7491e6e7c5, but the
original version is more informative. Let's add them back.
2018-07-06 11:51:24 +02:00
Zbigniew Jędrzejewski-Szmek 7c30c3c44f journal: store the original timestamp as SYSLOG_TIMESTAMP=
This is useful if someone wants to recreate the original syslog datagram. We
already include timestamp information as _SOURCE_REALTIME_TIMESTAMP=, and in
normal use that timestamp, converted back to the form used by syslog
(Mth dd HH:MM:SS) would usually give the value. But there are various
circumstances where this might not be true. Most obviously, if the datagram is
sent a bit later after being prepared, the time is rounded to the nearest
second, and it might be off. This is especially bad around New Year when the
syslog timestamp wraps around. Then the same timezone and locale need to be
used to recreate the original timestamp. In the end doing this reliably is
complicated, and it seems much easier to just unconditionally include the
original timestamp.

If the original timestamp cannot be located, we store the full log line.
This way, it should be always possible to recreate the original input.

Example:
MESSAGE=x
SYSLOG_TIMESTAMP=Sep 15 15:07:58
SYSLOG_RAW
^]^@^@^@^@^@^@^@<13>Sep 15 15:07:58 HOST: x^@y
_PID=3318
_SOURCE_REALTIME_TIMESTAMP=1530743976393553

Fixes #2398.
2018-07-05 00:40:35 +02:00
Zbigniew Jędrzejewski-Szmek 855a86a349 systemctl: fix assert for failed mktime conversion
mktime returns -1 on error, so checking for != 0 is not useful.
2018-07-04 23:54:43 +02:00
Zbigniew Jędrzejewski-Szmek df8701a3f2 journal: store the original syslog input as SYSLOG_RAW=
This allows the original stream to be recreated and/or verified. The new field
is written if any stripping was done or if the input message contained embeded
NULs.

$ printf '<13>Sep 15 15:07:58 HOST: x\0y' | nc -w1 -u -U /run/systemd/journal/dev-log

$ journalctl -o json-pretty ...
{
  ...
  "MESSAGE" : "x",
  "SYSLOG_RAW" : [ 60, 49, 51, 62, 83, 101, 112, 32, 49, 53, 32, 49, 53, 58, 48, 55, 58, 53, 56, 32, 72, 79, 83, 84, 58, 32, 120, 0, 121 ]
}

$ journalctl -o export ... | cat -v
...
MESSAGE=x
SYSLOG_RAW
^]^@^@^@^@^@^@^@<13>Sep 15 15:07:58 HOST: x^@y

This mostly fixes #4863.
2018-07-04 18:18:04 +02:00
Zbigniew Jędrzejewski-Szmek c3950a9bbe journal: optimize the common case where whitespace stripping is not needed
If we can just use the original data, let's do that.
2018-07-04 18:02:50 +02:00
Lennart Poettering cfffa385a3
Merge pull request #9489 from keszybz/copyright-removal-3
Copyright header removal, part 3 (or 4?)
2018-07-03 16:55:01 +02:00
Zbigniew Jędrzejewski-Szmek be9bf171bb rpm: emit warning when macro with typo is used
Follow-up for a6bb550458. Suggested by @ignatenkobrain.

$ rpmbuild --eval %_environmentdir
/usr/lib/environment.d
$ rpmbuild --eval %_environmnentdir
warning: Use %_environmentdir instead
/usr/lib/environment.d
2018-07-03 16:54:02 +02:00
Zbigniew Jędrzejewski-Szmek 1235a7dc73
Merge pull request #9417 from Conan-Kudo/rpm-environmentdir-typo
rpm: Fix typo in %_environmentdir
2018-07-03 15:36:15 +02:00
Yu Watanabe 1e5f4e8ba2 conf-parser,login: logs description of error in parsing size 2018-07-03 15:18:04 +02:00
Lion Yang a9518dc369 seccomp: add swapcontext into @process for ppc32
There are some modern programming languages use userspace context switches
to implement coroutine features. PowerPC (32-bit) needs syscall "swapcontext" to get
contexts or switch between contexts, which is special.

Adding this rule should fix #9485.
2018-07-03 13:35:02 +02:00
Yu Watanabe db2f8a2e8a tree-wide: add a space after (void) 2018-07-03 10:44:28 +02:00
Zbigniew Jędrzejewski-Szmek 052a85d188 resolved: fix typo in log message
Follow-up for cc7d50a571.
2018-07-03 09:09:41 +09:00
Zbigniew Jędrzejewski-Szmek 6ae97a514b tree-wide: drop some leftover header for Lennart Poettering
Follow-up for 0c69794138.
2018-07-03 01:32:36 +02:00
Zbigniew Jędrzejewski-Szmek 90d75140c8 journald: drop copyright headers for Sebastian Thorarensen
For #9320.
2018-07-03 01:32:25 +02:00
Violet Halo 11ce0db2e2 sd-bus: publicize sd_bus_message_readv()
The D-Bus library supplies a va_list variant of
`sd_bus_message_append()` called `sd_bus_message_appendv()`,
but failed to provide a va_list variant of its opposite,
`sd_bus_message_read()`. This commit publicizes a previously static
function as `sd_bus_message_readv()`.
2018-06-29 11:45:40 +02:00
Yu Watanabe 545cdb90f3 tree-wide: use instead of #ifdef for HAVE_* 2018-06-29 11:40:15 +02:00
Yu Watanabe cc7d50a571 resolve: update log message
Follow-up for f43580f17d.
2018-06-29 11:37:07 +02:00
Lennart Poettering 0a2fcbd2ee
Merge pull request #9468 from yuwata/small-cleanups
small fixes and cleanups for comments
2018-06-29 11:35:57 +02:00
ChenQi1989 4f07ffa8f5 Use #if instead of #ifdef for ENABLE_GSHADOW
ENABLE_GSHADOW is defined to be 0 or 1. So #if should be used instead of #ifdef.
2018-06-29 10:27:51 +02:00
Yu Watanabe 825862972e bus-util: update comment
Originally, request_name_handler_may_reload_dbus() was written for
timesyncd. But now it is also called by networkd or resolved.
2018-06-29 12:35:49 +09:00
Yu Watanabe afb76fdbff tree-wide: drop double newline 2018-06-29 11:02:17 +09:00
Yu Watanabe 8f5dd8c094 tree-wide: drop empty comments 2018-06-29 11:00:30 +09:00
Yu Watanabe 1e089bf805 tree-wide: drop empty lines in the begining of comments 2018-06-29 10:50:23 +09:00
Yu Watanabe 599c44e6e2 network: update log message
Closes #9396.
2018-06-29 10:38:38 +09:00
Yu Watanabe 031651a57a bus-util: drop unnecessary !! 2018-06-29 10:38:31 +09:00
Lennart Poettering ca285cdb40
Merge pull request #9422 from yuwata/conf-files
cleanups for default conf files
2018-06-28 10:17:54 +02:00
Yu Watanabe 845d247a3d tree-wide: use 'signed int' instead of 'int' for bit field variables
Suggested by LGTM: https://lgtm.com/rules/1506024027114/
2018-06-28 10:16:51 +02:00
Yu Watanabe f43580f17d resolve: warn when our stub listener is disabled but resolv.conf uses it
Closes #9450.
2018-06-28 10:06:15 +02:00
Evegeny Vereshchagin 283c265387 sd-bus: stop using the result of an assignment as an operand of &&
This makes OBJECT_PATH_FOREACH_PREFIX consistent with PATH_FOREACH_PREFIX
and also fixes 7 alerts reported by LGTM at
ac0a087003/files/src/libsystemd/sd-bus/bus-objects.c?sort=name&dir=ASC&mode=heatmap&showExcluded=true#V1383
2018-06-28 13:17:29 +09:00
Lennart Poettering 874b5ad248 core: tiny comment fix 2018-06-28 11:55:44 +09:00
Lennart Poettering a7e2e50d35 summary: update nspawn description string a bit
nspawn as it is now is a generally useful tool, hence let's drop the
comments about it being useful for debug and so on only.

The new wording just makes the first sentence of the main page also the
summary.
2018-06-28 11:55:44 +09:00
Filipe Brandenburger d7af62d52c sleep: fix one more printf format of a fiemap field
Use PRIu64 constant to get the format right on LP-64 architectures,
cast to (uint64_t) to solve incompatibility of __u64.

This was missed in ad4bc33522, so fix it
with this follow up.
2018-06-28 03:29:21 +09:00
Mike Gilbert 358248caa3 basic: add missing comma in raw_clone assembly for sparc
Fixes: 96f64eb574
Closes: https://github.com/systemd/systemd/issues/9444
2018-06-27 09:16:04 -07:00
Lorenz Hübschle-Schneider b90cbe6638 cryptsetup: Add dependency on loopback setup to generated units
For loopback volumes, the generated unit needs to depend on
systemd-tmpfiles-setup-dev.service to ensure that loopback
support is loaded.

Fixes #9308
2018-06-27 16:57:17 +02:00
Yu Watanabe 04e075b572 bus-util: make log level lower in request_name_destroy_callback()
Fixes #9442.
2018-06-27 16:56:50 +02:00
Lennart Poettering a5de5c43e6
Merge pull request #9440 from yuwata/fix-js
journal-gateway: update browse.html
2018-06-27 10:37:36 +02:00
Lennart Poettering 7f818901a2
Merge pull request #9438 from yuwata/lgtm-fixes-2
small fixes suggested by LGTM
2018-06-27 10:36:50 +02:00
Yu Watanabe a661dc36f6 resolve: reduce number of conversions between ifname and ifindex
This also fixes minor memleak introduced in
654457e560c5723b90b419f7651b87040aade07e.
2018-06-26 23:09:36 -07:00
Filipe Brandenburger 5a01b3f35d resolvconf: fixes for the compatibility interface
Also use compat_main() when called as `resolvconf`, since the interface
is closer to that of `systemd-resolve`.

Use a heap allocated string to set arg_ifname, since a stack allocated
one would be lost after the function returns. (This last one broke the
case where an interface name was suffixed with a dot, such as in
`resolvconf -a tap0.dhcp`.)

Tested:
  $ build/resolvconf -a nonexistent.abc </etc/resolv.conf
  Unknown interface 'nonexistent': No such device

Fixes #9423.
2018-06-26 23:09:36 -07:00
Yu Watanabe e68131526b analyze: actually select longest activated-time of services
Discovered by LGTM.
2018-06-27 14:54:19 +09:00
Yu Watanabe 944072fedd journal-gateway: use localStorage["cursor"] only when it has valid value
Discovered by LGTM.
2018-06-27 14:50:23 +09:00
Yu Watanabe c497e449f4 journal-gateway: explicitly declare local variables
Suggested by LGTM.
2018-06-27 14:22:28 +09:00
Yu Watanabe affaed1e55 sd-bus: fix implicit downcast of bitfield reported by LGTM 2018-06-27 13:28:28 +09:00
Filipe Brandenburger ad4bc33522 sleep: fix printf format of fiemap fields
Use PRIu64 and PRIu32 constants to also get the format right on LP-64
architectures.

For the 64-bit fields, we need a cast to (uint64_t), since __u64 is
defined as a `long long unsigned` and PRIu64 expects a `long unsigned`.
In practice, both are the same, so the cast should be OK.
2018-06-26 20:39:07 +02:00
Neal Gompa a6bb550458 rpm: Add misspelled %_environmentdir macro for temporary compatibility
This should be removed after systemd 240 is released.

Signed-off-by: Neal Gompa <ngompa13@gmail.com>
2018-06-26 07:43:41 -04:00
Yu Watanabe e0f691e1fd tree-wide: use localtime_r() instead of localtime()
Follow-up for e46acb7950.
2018-06-26 14:26:39 +09:00
Yu Watanabe ad16158c10 netdev: do not assign unused values 2018-06-26 14:26:19 +09:00
Jan Janssen aa2cc005d7 crypt-util: Translate libcryptsetup log level instead of using log_debug()
This makes sure that errors reported by libcryptsetup are shown to the
user instead of getting swallowed up by log_debug().
2018-06-26 14:26:07 +09:00
Yu Watanabe e761599ffd core: add missing option and drop nonexistent option in system.conf 2018-06-26 04:07:19 +09:00
Yu Watanabe 2dcacc7363 journal: add missing option in journald.conf 2018-06-26 04:05:42 +09:00
Yu Watanabe a4d5708c79 journal-remote: add license and reference to man page in conf files 2018-06-26 04:04:45 +09:00
Yu Watanabe 3632149409 network: provide default networkd.conf 2018-06-26 03:34:49 +09:00
Lennart Poettering e46acb7950 timedate: use gmtime_r() and localtime_r()
gmtime() and localtime() operate on a static buffer. let's avoid this,
as we never know whether some library might use these calls in some
backrgound thread.

Discovered by lgtm:

https://lgtm.com/projects/g/systemd/systemd/
2018-06-25 19:20:34 +02:00
Zbigniew Jędrzejewski-Szmek e49807606d
Merge pull request #9411 from poettering/systemctl-is-running-fixes
tiny systemctl fixes
2018-06-25 19:03:31 +02:00
Neal Gompa 6ea4cb975f rpm: Fix typo in %_environmentdir
Signed-off-by: Neal Gompa <ngompa13@gmail.com>
2018-06-25 12:56:50 -04:00
Zbigniew Jędrzejewski-Szmek dfe23d4145
Merge pull request #4522 from lucaswerkmeister/unescape-template
escape: support --unescape with --template
2018-06-25 18:48:01 +02:00
Lennart Poettering 5e4c5bde5c busctl: make parameter const
it's initialized from an argv[] entry, hence let's be make it
non-writable by default.
2018-06-25 18:26:17 +02:00
Lennart Poettering bfeec178db systemctl: if we can't detect the system-is-running state, assume it's not running 2018-06-25 17:10:27 +02:00
Lennart Poettering e686a616e8 systemctl: log errors to LOG_DEBUG rather than eating them up entirely 2018-06-25 17:10:27 +02:00
Lennart Poettering 9897b09ba7 systemctl: add 'static' to constant state array 2018-06-25 17:10:27 +02:00
Filipe Brandenburger b02a7e1aea resolved: assert t->server is set in dns_transaction_emit_tcp.
Uncovered by Coverity. Fixes CID 1393390.
2018-06-25 13:17:25 +02:00
Filipe Brandenburger 53a2383b8b core/job: add check for return of job_type_merge_and_collapse()
Using an assertion is fine, since calls to job_merge_into_installed()
are protected by a check for job_type_is_conflicting().

Uncovered by Coverity, fixes CID 996307.
2018-06-25 13:16:38 +02:00
Lennart Poettering 2919425bab
Merge pull request #9398 from yuwata/lgtm-fixes
fixes error handlings and several cleanups suggested by LGTM
2018-06-25 13:12:44 +02:00
Michal Koutný 1e75824cb0 core/manager: Make sure jobs statistics are not double after daemon-reload
We add n_installed_jobs and n_failed_jobs to our inner state after
deserialization. This is fine during daemon-reexec when we start with clear
Manager (and some jobs possibly queued before deserialization), however,
daemon-reload works with the same manager and adding the values would
effectively double the counters. Reset the counters before we deserialize and
add their values again.
2018-06-25 11:18:44 +02:00
Lucas Werkmeister d936cddcb5 escape: add --instance option
Suggested by @keszybz in #4522.
2018-06-25 11:17:55 +02:00
Zbigniew Jędrzejewski-Szmek d3a27ed402 boot: do not assume the last character in cmdline is a newline
Fixes #9401.
2018-06-25 11:17:53 +02:00