chiark / gitweb /
elogind.git
6 years agocgroup: add fields to accommodate eBPF related details
Daniel Mack [Fri, 11 Nov 2016 18:59:19 +0000 (19:59 +0100)]
cgroup: add fields to accommodate eBPF related details

Add pointers for compiled eBPF programs as well as list heads for allowed
and denied hosts for both directions.

6 years agoAdd IP address address ACL representation and parser
Daniel Mack [Thu, 3 Nov 2016 16:30:06 +0000 (17:30 +0100)]
Add IP address address ACL representation and parser

Add a config directive parser that takes multiple space separated IPv4
or IPv6 addresses with optional netmasks in CIDR notation rvalue and
puts a parsed version of it to linked list of IPAddressAccessItem objects.
The code actually using this will be added later.

6 years agoAdd abstraction model for BPF programs
Daniel Mack [Tue, 18 Oct 2016 15:57:10 +0000 (17:57 +0200)]
Add abstraction model for BPF programs

This object takes a number of bpf_insn members and wraps them together with
the in-kernel reference id. Will be needed by the firewall code.

6 years agoin-addr-util: add new helper call in_addr_prefix_from_string_auto()
Lennart Poettering [Fri, 1 Sep 2017 12:25:59 +0000 (14:25 +0200)]
in-addr-util: add new helper call in_addr_prefix_from_string_auto()

This is much like in_addr_prefix_from_string(), but automatically
determines whether IPv4 or IPv6 addresses are specified. Also adds a
test for it.

6 years agomanager: watching the cgroup2 inotify fd is safe in test runs too
Lennart Poettering [Tue, 5 Sep 2017 09:40:47 +0000 (11:40 +0200)]
manager: watching the cgroup2 inotify fd is safe in test runs too

Less deviation between test runs and normal runs is always a good idea,
hence enable more stuff that is safe in test runs

6 years agocgroup: always invalidate "cpu" and "cpuacct" together
Lennart Poettering [Tue, 5 Sep 2017 09:17:01 +0000 (11:17 +0200)]
cgroup: always invalidate "cpu" and "cpuacct" together

This doesn't really matter, as we never invalidate cpuacct explicitly,
and there's no real reason to care for it explicitly, however it's
prettier if we always treat cpu and cpuacct as belonging together, the
same way we conisder "io" and "blkio" to belong together.

6 years agocgroup-util: minor coding style adjustment
Lennart Poettering [Mon, 4 Sep 2017 16:18:04 +0000 (18:18 +0200)]
cgroup-util: minor coding style adjustment

6 years agoPrep v235: Updated .po files to upstream versions.
Sven Eden [Sun, 19 Nov 2017 17:50:17 +0000 (18:50 +0100)]
Prep v235: Updated .po files to upstream versions.

6 years agov235: Added missing updates
Sven Eden [Sun, 19 Nov 2017 17:48:14 +0000 (18:48 +0100)]
v235: Added missing updates

6 years agoPrep v235: Updated root files to upstream
Sven Eden [Mon, 25 Sep 2017 12:41:36 +0000 (14:41 +0200)]
Prep v235: Updated root files to upstream

6 years agoPrep v235: Added cap-list, which is needed now.
Sven Eden [Sun, 19 Nov 2017 17:47:11 +0000 (18:47 +0100)]
Prep v235: Added cap-list, which is needed now.

6 years agofileio: return 0 from read_one_line_file on success
Zbigniew Jędrzejewski-Szmek [Sun, 24 Sep 2017 12:27:21 +0000 (14:27 +0200)]
fileio: return 0 from read_one_line_file on success

Fixup for f4b51a2d09. Suggested by Evgeny Vereshchagin.

6 years agotest-conf-parser: add tests for the new long lines, including overflow handling
Zbigniew Jędrzejewski-Szmek [Thu, 21 Sep 2017 12:36:12 +0000 (14:36 +0200)]
test-conf-parser: add tests for the new long lines, including overflow handling

6 years agotest-conf-parser: use _cleanup_
Zbigniew Jędrzejewski-Szmek [Thu, 21 Sep 2017 10:02:49 +0000 (12:02 +0200)]
test-conf-parser: use _cleanup_

6 years agofileio: use _cleanup_ for FILE unlocking
Zbigniew Jędrzejewski-Szmek [Sat, 23 Sep 2017 08:48:09 +0000 (10:48 +0200)]
fileio: use _cleanup_ for FILE unlocking

6 years agoconf-parse: remove 4K line length limit
Lennart Poettering [Fri, 22 Sep 2017 16:26:35 +0000 (18:26 +0200)]
conf-parse: remove 4K line length limit

Let's use read_line() to solve our long line limitation.

Fixes #3302.

6 years agotest-conf-parser: add some basic tests for config_parse()
Zbigniew Jędrzejewski-Szmek [Thu, 21 Sep 2017 12:24:01 +0000 (14:24 +0200)]
test-conf-parser: add some basic tests for config_parse()

This function is pretty important, but we weren't calling it directly
even once in tests.

v2: add a few tests for escaping and line continuations

6 years agofileio: initialize errno to zero before we do fread()
Lennart Poettering [Fri, 22 Sep 2017 19:05:03 +0000 (21:05 +0200)]
fileio: initialize errno to zero before we do fread()

if there was something in the read buffer already errno might not be set
on error, let's detect that case.

6 years agofileio: try to read one byte too much in read_full_stream()
Lennart Poettering [Fri, 22 Sep 2017 19:03:33 +0000 (21:03 +0200)]
fileio: try to read one byte too much in read_full_stream()

Let's read one byte more than the file size we read from stat() on the
first fread() invocation. That way, the first read() will already be
short and indicate eof to fread().

This is a minor optimization, and replaces #3908.

6 years agofileio: move fsync() logic into write_string_stream_ts()
Lennart Poettering [Fri, 22 Sep 2017 18:59:39 +0000 (20:59 +0200)]
fileio: move fsync() logic into write_string_stream_ts()

That way, write_string_stream_ts() becomes more powerful, and we can
remove duplicate code from  write_string_file_atomic() and
write_string_file_ts().

6 years agofileio: make write_string_stream() accept flags parameter
Lennart Poettering [Fri, 22 Sep 2017 18:55:34 +0000 (20:55 +0200)]
fileio: make write_string_stream() accept flags parameter

Let's make write_string_stream() and write_string_file() more alike, and
pass the same flag set so that we can remove a number of boolean
parameters.

6 years agofileio: support writing atomic files with timestamp
Lennart Poettering [Fri, 22 Sep 2017 18:45:06 +0000 (20:45 +0200)]
fileio: support writing atomic files with timestamp

Let's make sure "ts" is taken into account when writing atomic files,
too.

6 years agocgroup-util: replace one use of fgets() by read_line()
Lennart Poettering [Fri, 22 Sep 2017 16:25:45 +0000 (18:25 +0200)]
cgroup-util: replace one use of fgets() by read_line()

6 years agofileio: rework read_one_line_file() on top of read_line()
Lennart Poettering [Fri, 22 Sep 2017 16:01:32 +0000 (18:01 +0200)]
fileio: rework read_one_line_file() on top of read_line()

6 years agodef: add new constant LONG_LINE_MAX
Lennart Poettering [Fri, 22 Sep 2017 18:23:58 +0000 (20:23 +0200)]
def: add new constant LONG_LINE_MAX

LONG_LINE_MAX is much like LINE_MAX, but longer.

As it turns out LINE_MAX at 4096 is too short for many usecases. Since
the general concept of having a common maximum line length limit makes
sense let's add our own, and make it larger (1MB for now).

6 years agofileio: add new helper call read_line() as bounded getline() replacement
Lennart Poettering [Fri, 22 Sep 2017 15:55:53 +0000 (17:55 +0200)]
fileio: add new helper call read_line() as bounded getline() replacement

read_line() is much like getline(), and returns a line read from a
FILE*, of arbitrary sizes. In contrast to gets() it will grow the buffer
dynamically, and in contrast to getline() it will place a user-specified
boundary on the line.

6 years agocgroup: rework which files we chown() on delegation
Lennart Poettering [Fri, 22 Sep 2017 17:58:24 +0000 (19:58 +0200)]
cgroup: rework which files we chown() on delegation

On cgroupsv2 we should also chown()/chmod() the subtree_control file,
so that children can use controllers the way they like.

On cgroupsv1 we should also chown()/chmod() cgroups.clone_children, as
not setting this for new cgroups makes little sense, and hence delegated
clients should be able to write to it.

Note that error handling for both cases is different. subtree_control
matters so we check for errors, but the clone_children/tasks stuff
doesn't really, as it's legacy stuff. Hence we only log errors and
proceed.

Fixes: #6216
6 years agocgroup-util: downgrade log messages from library code to LOG_DEBUG
Lennart Poettering [Fri, 22 Sep 2017 17:57:07 +0000 (19:57 +0200)]
cgroup-util: downgrade log messages from library code to LOG_DEBUG

These errors don't really matter, that's why we log and proceed in the
current code. However, we currently log at LOG_WARNING, but we really
shouldn't given that this is library code. Hence downgrade this to
LOG_DEBUG.

6 years agotime-util: mktime_or_timegm are changing the struct tm
Marcel Hollerbach [Wed, 20 Sep 2017 17:26:13 +0000 (19:26 +0200)]
time-util: mktime_or_timegm are changing the struct tm

after that wm_day etc. seems to be changed. Moving the check infront of
the mktime_or_timegm fixes that.

6 years agotime-util: correctly handle the timezone when parsing
Marcel Hollerbach [Wed, 20 Sep 2017 12:47:49 +0000 (14:47 +0200)]
time-util: correctly handle the timezone when parsing

The timezone was cut off the string once the timezone was not UTC.
If it is not UTC but a other timezone that matches tzname[0] or
tzname[1], then we can leave it to the impl function to parse that
correctly. If not we can just fallback to whatever is the current
timezone is in the given t_timezone.

This should fix the testuite and tests.

6 years agoLink to the right glibc commit in comment (#6884)
Zbigniew Jędrzejewski-Szmek [Thu, 21 Sep 2017 18:54:16 +0000 (20:54 +0200)]
Link to the right glibc commit in comment (#6884)

Reported by Marcos Mello.

Fixes #6882.

6 years agotime-util: fix shadowing of timezone
Marcel Hollerbach [Tue, 19 Sep 2017 15:00:56 +0000 (17:00 +0200)]
time-util: fix shadowing of timezone

timezone was shadowing timezone from time.h which leads to a buildbreak
since elogind is built with -Werror

6 years agoMake test_run into a flags field and disable generators again
Zbigniew Jędrzejewski-Szmek [Sat, 16 Sep 2017 09:19:43 +0000 (11:19 +0200)]
Make test_run into a flags field and disable generators again

Now generators are only run in elogind --test mode, where this makes
most sense (how are you going to test what would happen otherwise?).

Fixes #6842.

v2:
- rename test_run to test_run_flags

6 years agotests: change dbus tests to use user bus (#6845)
Michael Biebl [Tue, 19 Sep 2017 12:17:57 +0000 (14:17 +0200)]
tests: change dbus tests to use user bus (#6845)

This makes it possible to run more dbus tests in a build
environment/chroot where no system bus is available.
To run the dbus test one then can use dbus-run-session.

6 years agobuild-sys: bump xslt maxdepth limit (#6863)
Zbigniew Jędrzejewski-Szmek [Tue, 19 Sep 2017 06:04:02 +0000 (08:04 +0200)]
build-sys: bump xslt maxdepth limit (#6863)

With libxslt-1.30, builds were failing on some recursion depth limit
with elogind.index.xml. Bumping the limit fixes the issue.

6 years agotest-exec-util: add two test cases for scripts masked with empty file
Zbigniew Jędrzejewski-Szmek [Sun, 17 Sep 2017 13:17:50 +0000 (15:17 +0200)]
test-exec-util: add two test cases for scripts masked with empty file

A test for #6831. Fails without the previous commit.

Suggested by Evgeny Vereshchagin.

6 years agoconf-files: fix check for masking with empty files
Zbigniew Jędrzejewski-Szmek [Sun, 17 Sep 2017 13:26:01 +0000 (15:26 +0200)]
conf-files: fix check for masking with empty files

Fixes #6831.

6 years agoman: describe user@host:machine syntax
Zbigniew Jędrzejewski-Szmek [Sun, 17 Sep 2017 19:05:20 +0000 (21:05 +0200)]
man: describe user@host:machine syntax

Fixes #6734.

6 years agosd-bus: style nitpick node_vtable_get_userdata()
Alan Jenkins [Sat, 16 Sep 2017 11:32:59 +0000 (12:32 +0100)]
sd-bus: style nitpick node_vtable_get_userdata()

It's confusing to use a single void* to store data with two different
types, i.e. a userdata value which is safe to pass to ->find(), and a
userdata value which identifies the found object.

Name the latter `found_u`.  This naming treats (!c->find) as a degenerate
case.  (I.e. at that point, we know the object has already been found :).

6 years agosd-bus: fix response for GetAll on non-existent objects
Alan Jenkins [Sat, 16 Sep 2017 13:39:22 +0000 (14:39 +0100)]
sd-bus: fix response for GetAll on non-existent objects

Before this commit, if you run `loginctl user-status` from
debug-shell.service (and you have no login sessions for root), you always
see this output:

0
Linger: no

because Properties.GetAll is returning success but without any properties,
when the only find() callback had returned 0 to mean "no object found".

After:

Could not get properties: Unknown object:
'/org/freedesktop/login1/user/self'

BTW I have a fix for more user-friendly messages from logind in this case.
It is pending in my local branch for #6829 "fix `loginctl enable-linger`".

6 years agoFix for dst/non-dst timezones
Ivan Kurnosov [Sun, 17 Sep 2017 11:09:38 +0000 (23:09 +1200)]
Fix for dst/non-dst timezones

The problem was with the tm.tm_isdst that is set to the current environment
value: either DST or not. While the current state is not relevant to the state
in the desired date.

Hence — it should be reset so that the mktime_or_timegm could normalise it
later.

6 years agoSimplify the if cases for timezone checking
Zbigniew Jędrzejewski-Szmek [Sun, 17 Sep 2017 07:10:03 +0000 (09:10 +0200)]
Simplify the if cases for timezone checking

Just to reduce the indentation a bit.

6 years agoAdded timezone to the CalendarSpec, parser/formatter and the timedatectl
Ivan Kurnosov [Wed, 6 Sep 2017 09:56:36 +0000 (21:56 +1200)]
Added timezone to the CalendarSpec, parser/formatter and the timedatectl

6 years agoman: use "filename" not "file name" by default
Zbigniew Jędrzejewski-Szmek [Fri, 15 Sep 2017 12:59:45 +0000 (14:59 +0200)]
man: use "filename" not "file name" by default

We settled on "filename" and "file system", so change a couple of places for
consistency. The exception is when there's an adjective before "file" that
binds more strongly then "name": "password file name", "output file name", etc.
Those cases are left intact.

6 years agocore: add new per-unit setting KeyringMode= for controlling kernel keyring setup
Lennart Poettering [Thu, 14 Sep 2017 19:19:05 +0000 (21:19 +0200)]
core: add new per-unit setting KeyringMode= for controlling kernel keyring setup

Usually, it's a good thing that we isolate the kernel session keyring
for the various services and disconnect them from the user keyring.
However, in case of the cryptsetup key caching we actually want that
multiple instances of the cryptsetup service can share the keys in the
root user's user keyring, hence we need to be able to disable this logic
for them.

This adds KeyringMode=inherit|private|shared:

    inherit: don't do any keyring magic (this is the default in elogind --user)
    private: a private keyring as before (default in elogind --system)
    shared: the new setting

6 years agobuild-sys: require libmount >= 2.30 (#6795)
Zbigniew Jędrzejewski-Szmek [Fri, 15 Sep 2017 12:47:57 +0000 (14:47 +0200)]
build-sys: require libmount >= 2.30 (#6795)

Fixes #4871.

The new libmount has two changes relevant for us:

- x-* options are propagated to /run/mount/utab and are visible through
  libmount (fixes #4817).

- umount -c now really works (partially solves #6115).

6 years agonetworkd: add support to configure IP Rule (#5725)
Susant Sahani [Thu, 14 Sep 2017 19:51:39 +0000 (19:51 +0000)]
networkd: add support to configure IP Rule (#5725)

Routing Policy rule manipulates rules in the routing policy database control the
route selection algorithm.

This work supports to configure Rule
```
[RoutingPolicyRule]
TypeOfService=0x08
Table=7
From= 192.168.100.18

```

```
ip rule show
0: from all lookup local
0: from 192.168.100.18 tos 0x08 lookup 7
```

V2 changes:

1. Added logic to handle duplicate rules.
2. If rules are changed or deleted and networkd restarted
   then those are deleted when networkd restarts next time

V3:

1. Add parse_fwmark_fwmask

6 years agoconf-parser: when the empty string assigned to Personality= reset it
Lennart Poettering [Thu, 14 Sep 2017 14:54:32 +0000 (16:54 +0200)]
conf-parser: when the empty string assigned to Personality= reset it

Let's support assigning the empty string to reset things in one more
place.

6 years agocore: don't synthesize empty list when empty string is read in config_parse_strv()
Lennart Poettering [Thu, 14 Sep 2017 14:53:34 +0000 (16:53 +0200)]
core: don't synthesize empty list when empty string is read in config_parse_strv()

This was added to make
https://bugs.freedesktop.org/show_bug.cgi?id=62558 work, which has long
been removed, hence let's revert to the original behaviour and fully
flush out the list when an empty string is assigned.

6 years agorules: ubi mtd - add link to named partitions (#6750)
Michael Grzeschik [Thu, 14 Sep 2017 12:53:07 +0000 (14:53 +0200)]
rules: ubi mtd - add link to named partitions (#6750)

[zjs:
- rebase onto recent master
- drop signed-off-by]

6 years agoman: unify titling, fix description of precedence in sysusers.d(5)
Zbigniew Jędrzejewski-Szmek [Thu, 14 Sep 2017 09:55:00 +0000 (11:55 +0200)]
man: unify titling, fix description of precedence in sysusers.d(5)

Fixes #6639.

(This behaviour of elogind-sysusers is long established, so it's better
to adjust the documentation rather than change the code. If there are any
situations out there where it matters, users must have adjusted to the
current behaviour.)

6 years agonss: use secure_getenv for behaviour-modifying booleans (#6817)
Zbigniew Jędrzejewski-Szmek [Thu, 14 Sep 2017 07:20:27 +0000 (09:20 +0200)]
nss: use secure_getenv for behaviour-modifying booleans (#6817)

Follow up for fe102d6ab15731a199a7ea9f38c4f68d8959f86c.

6 years agobasic: ensure O_TMPFILE is always defined (#6816)
Davide Cavalca [Thu, 14 Sep 2017 04:14:29 +0000 (00:14 -0400)]
basic: ensure O_TMPFILE is always defined (#6816)

6 years agosd-bus: extend D-Bus authentication timeout considerably (#6813)
Lennart Poettering [Wed, 13 Sep 2017 17:08:26 +0000 (19:08 +0200)]
sd-bus: extend D-Bus authentication timeout considerably (#6813)

As it turns out the authentication phase times out too often than is
good, mostly due to PRNG pools not being populated during boot. Hence,
let's increase the authentication timeout from 25s to 90s, to cover for
that.

(Note that we leave the D-Bus method call timeout at 25s, matching the
reference implementation's value. And if the auth phase managed to
complete then the pools should be populated enough and mehtod calls
shouldn't take needlessly long anymore).

Fixes: #6418
6 years agoutil: make get_block_device() available
Franck Bui [Wed, 13 Sep 2017 09:47:15 +0000 (11:47 +0200)]
util: make get_block_device() available

6 years agoconf-files: log when we skip a drop-in configuration file
Lennart Poettering [Wed, 13 Sep 2017 09:41:41 +0000 (11:41 +0200)]
conf-files: log when we skip a drop-in configuration file

6 years agoexec-util,conf-files: skip non-executable files in execute_directories()
Lennart Poettering [Tue, 12 Sep 2017 14:57:33 +0000 (16:57 +0200)]
exec-util,conf-files: skip non-executable files in execute_directories()

Fixes: #6787
6 years agopager: let's create pager fds with O_CLOEXEC first
Lennart Poettering [Wed, 13 Sep 2017 08:35:28 +0000 (10:35 +0200)]
pager: let's create pager fds with O_CLOEXEC first

We make copies (without O_CLOEXEC) of the fds anyway before using them,
hence let's be safe and create them with O_CLOEXEC first, so that we
don't run into issues should pager_open() be called in a threaded
environment where another thread fork()s at the wrong time and ends up
with fds not marked O_CLOEXEC.

6 years agosystemctl: don't do ANSI underlining on TERM=linux (#6778)
Lennart Poettering [Sat, 9 Sep 2017 20:48:35 +0000 (22:48 +0200)]
systemctl: don't do ANSI underlining on TERM=linux (#6778)

The linux console apparently can't do underlining, hence let's not do it
on the console.

Also see: #6601

6 years agoutil-lib: wrap personality() to fix up broken glibc error handling (#6766)
Lennart Poettering [Fri, 8 Sep 2017 14:16:29 +0000 (16:16 +0200)]
util-lib: wrap personality() to fix up broken glibc error handling (#6766)

glibc appears to propagate different errors in different ways, let's fix
this up, so that our own code doesn't get confused by this.

See #6752 + #6737 for details.

Fixes: #6755
6 years agoshared: allow to input empty string to config_parse_path()
Yu Watanabe [Tue, 5 Sep 2017 06:12:55 +0000 (15:12 +0900)]
shared: allow to input empty string to config_parse_path()

Fixes #6633.

6 years agobuild-sys: make nonnull warning non-fatal (#6742)
Zbigniew Jędrzejewski-Szmek [Mon, 4 Sep 2017 16:49:12 +0000 (19:49 +0300)]
build-sys: make nonnull warning non-fatal (#6742)

Seems to be some kind of confusion in gcc. Insteading of playing whack-a-mole and
adding work-arounds in code, let's adjust the compilation options instead.

Fixes #6119, replaces #6657.

6 years agotmpfiles: silently ignore any path that passes through autofs (#6506)
NeilBrown [Mon, 4 Sep 2017 13:35:07 +0000 (23:35 +1000)]
tmpfiles: silently ignore any path that passes through autofs (#6506)

If a path passes though an autofs filesystem, then accessing
the path might trigger and automount.  As elogind-tmpfiles is run before
the network is up, and as automounts are often used for networked
filesystems, this can cause a deadlock.

So chase_symlinks is enhance to accept a new flag which tells it
to check for autofs, and return -EREMOTE if autofs is found.

tmpfiles is changed to check just before acting on a path so that it
can avoid autofs even if a symlink was created earlier by tmpfiles
that would send this path through an autofs.

This fixes a deadlock that happens when /home is listed in /etc/fstab as
x-elogind.automount for an NFS directory.

6 years agoelogind-mount: allow to specify an arbitrary string for arg_mount_what when vfs is...
Yu Watanabe [Mon, 4 Sep 2017 01:55:51 +0000 (10:55 +0900)]
elogind-mount: allow to specify an arbitrary string for arg_mount_what when vfs is used

Fixes #6591.

6 years agoterminal: unify code for resetting kbd utf8 mode a bit (#6692)
Lennart Poettering [Fri, 1 Sep 2017 00:09:32 +0000 (02:09 +0200)]
terminal: unify code for resetting kbd utf8 mode a bit (#6692)

We have the same code at two places, let's unify that at one place.

Follow-up for #6606

6 years agotree-wide: use pid_is_valid() at more places
Lennart Poettering [Thu, 31 Aug 2017 08:25:06 +0000 (10:25 +0200)]
tree-wide: use pid_is_valid() at more places

6 years agosd-bus: use -- when passing arguments to ssh (#6706)
Evgeny Vereshchagin [Thu, 31 Aug 2017 08:38:30 +0000 (11:38 +0300)]
sd-bus: use -- when passing arguments to ssh (#6706)

This prevents `systemctl` from runnning /bin/touch when the following
command is used:
```
systemctl -H '-oProxyCommand=/bin/touch i-shouldnt-be-here' show-environment
```

6 years agolog: reopen log for failed assertions (#6703)
Topi Miettinen [Thu, 31 Aug 2017 08:37:32 +0000 (08:37 +0000)]
log: reopen log for failed assertions (#6703)

Reopen log so that failed and aborting assertions can be written to log.

Closes: #6658
6 years agobus-util: remove unnecessary initializations
Yu Watanabe [Thu, 31 Aug 2017 08:02:33 +0000 (17:02 +0900)]
bus-util: remove unnecessary initializations

6 years agosystemctl: show capabilities in human readable format
Yu Watanabe [Thu, 31 Aug 2017 08:07:16 +0000 (17:07 +0900)]
systemctl: show capabilities in human readable format

Follow-up for 21771f338d268e06dc9a10b9b08b14ff8217d4be.

6 years agomeson: add . to include_directories (#6634)
Davide Cavalca [Wed, 30 Aug 2017 15:34:44 +0000 (08:34 -0700)]
meson: add . to include_directories (#6634)

6 years agologind: VT_GETSTATE "cannot return state for more than 16 VTs" (#6625)
Alan Jenkins [Wed, 30 Aug 2017 15:06:12 +0000 (16:06 +0100)]
logind: VT_GETSTATE "cannot return state for more than 16 VTs" (#6625)

`vt_is_busy(16)` would always return FALSE.  So we could have started
autovt@16.service even when VT 16 was already being used for something.

6 years agomeson: use current_source_dir() to scope git invocations (#6635)
Davide Cavalca [Wed, 30 Aug 2017 15:04:53 +0000 (08:04 -0700)]
meson: use current_source_dir() to scope git invocations (#6635)

6 years agosd-bus: socket - only transmit auxillary FDs once (#6603)
Tom Gundersen [Wed, 30 Aug 2017 11:09:03 +0000 (13:09 +0200)]
sd-bus: socket - only transmit auxillary FDs once (#6603)

If a message is too large to fit into the output buffer, it will be
transmitted to the kernel in several chunks. However, the FDs must
only ever be transmitted once or they will bereceived by the remote
end repeatedly.

The D-Bus specification disallows several sets of FDs attached to
one message, however, the reference implementation of D-Bus will
not reject such a message, rather it will reassign the duplicate
FDs to subsequent FD-carrying messages.

This attaches the FD array only to the first byte of the message.

6 years agoterminal reset should honour default_utf8 kernel setting (#6606)
g0tar [Wed, 30 Aug 2017 08:00:44 +0000 (10:00 +0200)]
terminal reset should honour default_utf8 kernel setting (#6606)

terminal reset should honour default_utf8 kernel setting

6 years agoseccomp: default to something resembling the current personality when locking it
Lennart Poettering [Wed, 9 Aug 2017 18:40:26 +0000 (20:40 +0200)]
seccomp: default to something resembling the current personality when locking it

Let's lock the personality to the currently set one, if nothing is
specifically specified. But do so with a grain of salt, and never
default to any exotic personality here, but only PER_LINUX or
PER_LINUX32.

6 years agoAdded Romanian Translation (#6674)
dasj19 [Mon, 28 Aug 2017 16:24:09 +0000 (18:24 +0200)]
Added Romanian Translation (#6674)

6 years agologind: tighten assertion in execute_shutdown_or_sleep()
Alan Jenkins [Thu, 24 Aug 2017 14:21:21 +0000 (15:21 +0100)]
logind: tighten assertion in execute_shutdown_or_sleep()

Following commit b498d6ea, I belated realized we should tighten the
assertions as well, to make sure that we're setting `m->action_what` to
represent an action in progress.  (The check for an action in progress is
to compare `m->action_what` to zero)

6 years agologind: add missing resume signal when we fail to initiate sleep/shutdown
Alan Jenkins [Thu, 24 Aug 2017 09:33:24 +0000 (10:33 +0100)]
logind: add missing resume signal when we fail to initiate sleep/shutdown

This fixed https://bugzilla.redhat.com/show_bug.cgi?id=1476313
as much as I was able to reproduce it in a VM, at least.

E.g. this signal might wake the screen back up, providing a more visible
indicator of suspend failure.  In my VM testing, it was also required in
order to unblock keyboard input in gnome-shell after the failed suspend.

At the same time, fix the error handling for scheduled shutdowns.  This now
mirrors the behaviour of when you use `shutdown -k` - it sends all the
scary messages about shutting down, "but you'll have to do it [shut down
the system] yourself".  It also avoids the risk of locking out the admin
(nologin file), in case they logged out for some reason (and they use
`sudo` instead of root).

Not that I have any idea why you'd want to use `shutdown -k`, but the code
is easier to analyze if it rolls back on error (in the absence of any code
comment as to why that's not wanted).

6 years agologind: respect "delay" inhibitors in scheduled shutdowns
Alan Jenkins [Mon, 21 Aug 2017 16:28:35 +0000 (17:28 +0100)]
logind: respect "delay" inhibitors in scheduled shutdowns

There is no justification not to wait an extra (default) 5 seconds, for
a more graceful shutdown of user programs.  Again, you don't get to ignore
delay inhibitors for unscheduled shutdowns, short of
`systemctl poweroff -f`.

It is simplest if we move the test for `m->shutdown_dry_run` into
manager_scheduled_shutdown_handler().

However we need to not add such delays during a "dry run".  Otherwise, we
would still have to be considered "in progress" for some seconds after our
admin has seen the final wall message.  If they go to `poweroff`, we would
have blocked them with a misleading error message.  Note this `poweroff`
will still process delay inhibitors as needed.  If the admin planned to
use a more forceful method... eh.  It's their responsibility to assess
whether that's safe.

There is an argument that the alternative behaviour could be used (racily!)
to kludge around them not being able to shutdown to "single user mode".  If
we cared about that case, we would have easily preserved non-racy support
for it in `shutdown`.

Additionally, though I think this code does read more easily by reducing
inconsistencies, we didn't come up with any use case for delay inhibitors
v.s. shutdown.[1]  The SIGTERM v.s. SIGKILL delay is more general, and we
allow a whole 90 seconds for it, not just 5.  So I don't think keeping this
approach bears a risk of significant damage.

[1] https://www.freedesktop.org/wiki/Software/elogind/inhibit/

6 years agologind: add missing check for conflicting operation v.s. scheduled shutdown
Alan Jenkins [Mon, 21 Aug 2017 10:49:25 +0000 (11:49 +0100)]
logind: add missing check for conflicting operation v.s. scheduled shutdown

> We don't want to shutdown while a suspend is running, and vice versa.
> This would be confusing and could lead to data loss in the worst case.

https://bugs.launchpad.net/ubuntu/+source/elogind/+bug/1441253/comments/4

According to the above comment, if the conflicting operation is hung,
we don't want to force things when the admin has not passed a force option.

Similarly if you're not an admin, you probably shouldn't get to sneak
around this check by using a scheduled shutdown instead of an unscheduled
one.  (And no-one so far thought it necessary to add such a permission in
PolKit).

Note that if the conflicting operation was _not_ hung, and we lost the
race with suspend, the system might not have shut down at the scheduled
time anyway.  Which is no good if you were scheduling a power outage.
And scheduling a shutdown for an arbitrary time when the system is resumed,
does not seem a very useful semantic.  More likely, scheduled shutdowns are
useful on systems which do not use suspend, such as multi-user servers.
(In which case even PolKit defaults likely don't let the users trigger
suspend).

6 years agologind: method_schedule_shutdown() already rejects empty `type`
Alan Jenkins [Tue, 22 Aug 2017 12:54:21 +0000 (13:54 +0100)]
logind: method_schedule_shutdown() already rejects empty `type`

Don't test for an empty `type` afterwards.  This is not how you cancel
scheduled shutdowns - there's a separate method for that.

6 years agobuild-sys: don't build networkctl if networkd is disabled
Felipe Sateler [Mon, 21 Aug 2017 12:48:41 +0000 (09:48 -0300)]
build-sys: don't build networkctl if networkd is disabled

6 years agocapability: add new ambient_capabilities_supported() helper
Lennart Poettering [Wed, 9 Aug 2017 13:07:15 +0000 (15:07 +0200)]
capability: add new ambient_capabilities_supported() helper

This new function reports whether ambient caps are available, and should
be quick because the result is cached.

6 years agocapability: change capability_bounding_set_drop() to be work without privileges when...
Lennart Poettering [Wed, 9 Aug 2017 13:05:36 +0000 (15:05 +0200)]
capability: change capability_bounding_set_drop() to be work without privileges when executing a NOP

This way daemons which already dropped all caps may use the call to
drop priviliges again, which becomes a non-failing NOP.

6 years agotree-wide: use path_startswith() rather than startswith() where ever that's appropriate
Lennart Poettering [Wed, 9 Aug 2017 17:03:39 +0000 (19:03 +0200)]
tree-wide: use path_startswith() rather than startswith() where ever that's appropriate

When checking path prefixes we really should use the right APIs, just in
case people add multiple slashes to their paths...

6 years agoutil-lib: add a new skip_dev_prefix() helper
Lennart Poettering [Wed, 9 Aug 2017 17:01:18 +0000 (19:01 +0200)]
util-lib: add a new skip_dev_prefix() helper

This new helper removes a leading /dev if there is one. We have code
doing this all over the place, let's unify this, and correct it while
we are at it, by using path_startswith() rather than startswith() to
drop the prefix.

6 years agoPrep v235: Update test-login.c
shwsh [Tue, 5 Sep 2017 15:23:33 +0000 (22:23 +0700)]
Prep v235: Update test-login.c

 * Merge pull request #29 from shwsh/master

6 years agoPrep v235: Allow elogind to be auto-started by dbus requests
Sven Eden [Fri, 1 Sep 2017 11:35:48 +0000 (13:35 +0200)]
Prep v235: Allow elogind to be auto-started by dbus requests

6 years agoPrep v235: Fix pam_elogind
Sven Eden [Fri, 1 Sep 2017 11:22:46 +0000 (13:22 +0200)]
Prep v235: Fix pam_elogind

6 years agoPrep v235: systemd installs in /lib/systemd, so we install in /lib/elogind.
Sven Eden [Thu, 31 Aug 2017 15:34:31 +0000 (17:34 +0200)]
Prep v235: systemd installs in /lib/systemd, so we install in /lib/elogind.

6 years agoPrep v235: Catch and react on SIGINT, SIGQUIT and SIGTERM
Sven Eden [Thu, 31 Aug 2017 14:44:51 +0000 (16:44 +0200)]
Prep v235: Catch and react on SIGINT, SIGQUIT and SIGTERM

6 years agoPrep v235: Fix startup order and add debug logging.
Sven Eden [Thu, 31 Aug 2017 05:58:32 +0000 (07:58 +0200)]
Prep v235: Fix startup order and add debug logging.

6 years agoPrep v235: Do not write an early PID file, if elogind is going to be daemonized.
Sven Eden [Wed, 30 Aug 2017 08:59:42 +0000 (10:59 +0200)]
Prep v235: Do not write an early PID file, if elogind is going to be daemonized.

6 years agoPrep v235: Apply pending upstream updates in src/test [4/4]
Sven Eden [Wed, 30 Aug 2017 05:49:50 +0000 (07:49 +0200)]
Prep v235: Apply pending upstream updates in src/test [4/4]

6 years agoPrep v235: Apply pending upstream updates in src/login [3/4]
Sven Eden [Wed, 30 Aug 2017 05:49:50 +0000 (07:49 +0200)]
Prep v235: Apply pending upstream updates in src/login [3/4]

6 years agoPrep v235: Apply pending upstream updates in src/core [2/4]
Sven Eden [Wed, 30 Aug 2017 05:49:50 +0000 (07:49 +0200)]
Prep v235: Apply pending upstream updates in src/core [2/4]

6 years agoPrep v235: Apply pending upstream updates in src/basic [1/4]
Sven Eden [Wed, 30 Aug 2017 05:49:50 +0000 (07:49 +0200)]
Prep v235: Apply pending upstream updates in src/basic [1/4]

6 years agoPrep 235: add missing libshared.sym and remove obsolete kdbus.h
Sven Eden [Wed, 30 Aug 2017 05:48:30 +0000 (07:48 +0200)]
Prep 235: add missing libshared.sym and remove obsolete kdbus.h

6 years agoPrep v235: optimize elogind extra startup functionality
Sven Eden [Wed, 30 Aug 2017 05:47:40 +0000 (07:47 +0200)]
Prep v235: optimize elogind extra startup functionality