platform/upstream/systemd.git
6 years agobasic: track dirty state in HashmapBase
Vito Caputo [Sun, 8 Oct 2017 23:28:04 +0000 (16:28 -0700)]
basic: track dirty state in HashmapBase

This only adds marking the HashmapBase as dirty, no clearing of
the dirty state happens yet.

No functional changes.

6 years agocore/dbus-execute: actually set PassEnvironment= (#7510)
Yu Watanabe [Thu, 30 Nov 2017 11:34:58 +0000 (20:34 +0900)]
core/dbus-execute: actually set PassEnvironment= (#7510)

Follow-up for #7444.

6 years agoman: fix typo (#7511)
Yu Watanabe [Thu, 30 Nov 2017 11:02:20 +0000 (20:02 +0900)]
man: fix typo (#7511)

6 years agoFix SELinux labels in cgroup filesystem root directory (#7496)
Krzysztof Nowicki [Thu, 30 Nov 2017 10:59:29 +0000 (11:59 +0100)]
Fix SELinux labels in cgroup filesystem root directory (#7496)

When using SELinux with legacy cgroups the tmpfs on /sys/fs/cgroup is by
default labelled as tmpfs_t. This label is also inherited by the "cpu"
and "cpuacct" symbolic links. Unfortunately the policy expects them to
be labelled as cgroup_t, which is used for all the actual cgroup
filesystems. Failure to do so results in a stream of denials.

This state cannot be fixed reliably when the cgroup filesystem structure
is set-up as the SELinux policy is not yet loaded at this
moment. It also cannot be fixed later as the root of the cgroup
filesystem is remounted read-only. In order to fix it the root of the
cgroup filesystem needs to be temporary remounted read-write, relabelled
and remounted back read-only.

6 years agocore: support upgrading from DynamicUser=0 to DynamicUser=1 for unit directories...
Lennart Poettering [Thu, 30 Nov 2017 10:52:39 +0000 (11:52 +0100)]
core: support upgrading from DynamicUser=0 to DynamicUser=1 for unit directories (#7507)

This makes sure we migrate /var/lib/<foo> if it exists to
/var/lib/private/<foo> if DynamicUser=1 is set. This is useful to allow
turning on DynamicUser= on services that previously didn't use it, and
we can deal with this, and migrate the relevant directories as
necessary.

Note that "downgrading" from DynamicUser=1 backto DynamicUser=0 works
too. However in that case we simply continue to use
/var/lib/private/<foo>, which works because /var/lib/<foo> is a symlink
there after all.

6 years agoMerge pull request #7444 from poettering/dbus-no-spec
Yu Watanabe [Thu, 30 Nov 2017 05:50:36 +0000 (14:50 +0900)]
Merge pull request #7444 from poettering/dbus-no-spec

unit writing escaping fixes + related fixes and additions

6 years agoMerge pull request #7508 from poettering/journal-n-drop
Vito Caputo [Wed, 29 Nov 2017 22:05:21 +0000 (14:05 -0800)]
Merge pull request #7508 from poettering/journal-n-drop

journal: fix log message when dropping messages

6 years agojournal: fix log message when dropping messages
Lennart Poettering [Wed, 29 Nov 2017 21:11:59 +0000 (22:11 +0100)]
journal: fix log message when dropping messages

Fixes: #7506

6 years agoupdate TODO
Lennart Poettering [Wed, 22 Nov 2017 12:56:10 +0000 (13:56 +0100)]
update TODO

6 years agobus-unit-util: slightly tweak log output for unknown props
Lennart Poettering [Wed, 29 Nov 2017 19:07:08 +0000 (20:07 +0100)]
bus-unit-util: slightly tweak log output for unknown props

Pretty:

        Unknown assignment Foo=bar.

Prettier:

        Unknown assignment: Foo=bar

6 years agorun: rearrange error handling when adding unit properties
Lennart Poettering [Wed, 29 Nov 2017 19:05:22 +0000 (20:05 +0100)]
run: rearrange error handling when adding unit properties

Let's always leave logging to the call that actually added the fields to
the bus message. This way we don't get duplicate logging whenver
bus_append_unit_property_assignment() ends up being called, which does
all its logging on its own (and probably should do, as it can output
much more precise errors).

6 years agobus-unit-util: add proper MemorySwapMax= serialization
Lennart Poettering [Wed, 29 Nov 2017 18:55:42 +0000 (19:55 +0100)]
bus-unit-util: add proper MemorySwapMax= serialization

Fixes: #7505

6 years agocore: accept MemorySwapMax= properties that are scaled, too
Lennart Poettering [Wed, 29 Nov 2017 18:55:01 +0000 (19:55 +0100)]
core: accept MemorySwapMax= properties that are scaled, too

Let's do what we already do for MemoryMax= and friends for
MemorySwapMax= too.

6 years agotty-ask-password-agent: drop NULL sentinel
Lennart Poettering [Wed, 29 Nov 2017 18:53:53 +0000 (19:53 +0100)]
tty-ask-password-agent: drop NULL sentinel

found by coccinelle

6 years agococcinelle: add a run-coccinelle.sh script that runs all scripts
Lennart Poettering [Wed, 29 Nov 2017 18:49:05 +0000 (19:49 +0100)]
coccinelle: add a run-coccinelle.sh script that runs all scripts

One day we should start running something like this as part of CI so
that non-well-formed commits are not even accepted...

6 years agococcinelle: fix IN_SET/!IN_SET scripts, and apply some changes it found
Lennart Poettering [Wed, 29 Nov 2017 12:05:24 +0000 (13:05 +0100)]
coccinelle: fix IN_SET/!IN_SET scripts, and apply some changes it found

IN_SET only works for constant values, hence clarify that. Moreover, we
declared a statement "s" we never made use of. Drop it.

Also, for both scripts, let's support 10 items. More causes spatch to
die with "Stack overflow" for me.

6 years agoMerge pull request #7493 from keszybz/revert-revert
Lennart Poettering [Wed, 29 Nov 2017 17:56:26 +0000 (18:56 +0100)]
Merge pull request #7493 from keszybz/revert-revert

Revert "meson: drop rootprefix option"

6 years agoMerge pull request #7504 from keszybz/two-mkosi-ideas
Lennart Poettering [Wed, 29 Nov 2017 15:24:14 +0000 (16:24 +0100)]
Merge pull request #7504 from keszybz/two-mkosi-ideas

Two mkosi tweaks

6 years agoMerge pull request #7500 from poettering/journal-field-count
Lennart Poettering [Wed, 29 Nov 2017 15:21:48 +0000 (16:21 +0100)]
Merge pull request #7500 from poettering/journal-field-count

fix journald field counts

6 years agoAdd mkosi.output/ to .gitignore
Zbigniew Jędrzejewski-Szmek [Tue, 21 Nov 2017 17:52:15 +0000 (18:52 +0100)]
Add mkosi.output/ to .gitignore

It's not something that would ever be checked in, and mkosi along
with systemd, so this directory is likely to appear.

6 years agomkosi: do not build man pages
Zbigniew Jędrzejewski-Szmek [Tue, 31 Oct 2017 08:44:00 +0000 (09:44 +0100)]
mkosi: do not build man pages

6 years agomeson: emit a warning if rootprefix is set
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 20:46:53 +0000 (21:46 +0100)]
meson: emit a warning if rootprefix is set

It's printed at the end because it's the easiest to spot there.

When meson is upgraded to 0.43.1, we'll be able to use warning() instead.

6 years agotree-wide: use strv_isempty() instead of strv_length() == 0
Lennart Poettering [Wed, 29 Nov 2017 11:40:22 +0000 (12:40 +0100)]
tree-wide: use strv_isempty() instead of strv_length() == 0

It's a lot faster in many cases, since it's O(1) rather than O(n).

6 years agobus-unit-util: properly serialize EnvironmentFile= empty assignment
Lennart Poettering [Wed, 29 Nov 2017 10:33:26 +0000 (11:33 +0100)]
bus-unit-util: properly serialize EnvironmentFile= empty assignment

In that case we need to generate an empty array.

6 years agotests: fix description of TEST-14-MACHINE-ID
Lennart Poettering [Tue, 28 Nov 2017 20:25:49 +0000 (21:25 +0100)]
tests: fix description of TEST-14-MACHINE-ID

It used the same description as TEST-01, and that's hardly helpful.

6 years agocore: use safe_fclose() where we can
Lennart Poettering [Tue, 28 Nov 2017 20:24:20 +0000 (21:24 +0100)]
core: use safe_fclose() where we can

6 years agofileio: document why fileio-label.c and fileio.c are two different modules
Lennart Poettering [Mon, 27 Nov 2017 15:06:39 +0000 (16:06 +0100)]
fileio: document why fileio-label.c and fileio.c are two different modules

6 years agodocumentation: add document listing all unit file settings also supported for transie...
Lennart Poettering [Thu, 23 Nov 2017 19:26:02 +0000 (20:26 +0100)]
documentation: add document listing all unit file settings also supported for transient units

Unfortunately, there are far too many properties currently not
accessible to transient units. The first step to opening them all up is
to figure out which ones they are.

6 years agocore: open up all ExecXYZ= fields of service units to transient units
Lennart Poettering [Thu, 23 Nov 2017 16:58:34 +0000 (17:58 +0100)]
core: open up all ExecXYZ= fields of service units to transient units

Fixes: #7400

6 years agocore: never remove "transient" and "control" directories from unit search path
Lennart Poettering [Thu, 23 Nov 2017 16:45:58 +0000 (17:45 +0100)]
core: never remove "transient" and "control" directories from unit search path

This changes the unit search path logic to never drop the transient and
control directories from the unit search path. This is necessary as we
add new entries to both during runtime, due to the "systemctl
set-property" and transient unit logic.

Previously, the "transient" directory was created during early boot to
deal with this, but the "control" directories were not covered like
that. Creating the control directories early at boot is not possible
however, as /etc might be read-only then, and we do define a persistent
control directory. Hence, let's create these dirs on-demand when we need
them, and make sure the search path clean-up logic never drops them from
the search path even if they are initially missing.

(Also, always create these paths properly labelled)

6 years agocore: don't reference rescue/emergency targets in --user mode
Lennart Poettering [Thu, 23 Nov 2017 16:39:53 +0000 (17:39 +0100)]
core: don't reference rescue/emergency targets in --user mode

They are only defined for system mode, hence let's not check for them in
--user mode.

Follow-up for #7433

6 years agocore: minor simplification
Lennart Poettering [Thu, 23 Nov 2017 16:39:25 +0000 (17:39 +0100)]
core: minor simplification

6 years agopath-lookup: LookupPathsFlags are a flags type, hence define it like one
Lennart Poettering [Thu, 23 Nov 2017 16:37:49 +0000 (17:37 +0100)]
path-lookup: LookupPathsFlags are a flags type, hence define it like one

We shouldn't rely on C's incremental assignment of values of enums for
bit fields. That'll work only between the first two flags, but for
everything following will break horrible. Hence, let's avoid any
ambiguity here, and let's clearly define the flags as shifts of 1.

6 years agosystemctl: reword "needs-reload" message a bit
Lennart Poettering [Thu, 23 Nov 2017 16:36:30 +0000 (17:36 +0100)]
systemctl: reword "needs-reload" message a bit

This message is displayed either when the unit file itself is newer than
what is loaded, but also when any of the drop-ins is newer. Say so in
the message, in order not to confuse the user unnecessarily.

6 years agocore: allow changing the description for units dynamically at runtime
Lennart Poettering [Wed, 22 Nov 2017 15:34:56 +0000 (16:34 +0100)]
core: allow changing the description for units dynamically at runtime

This makes "systemctl set-property foobar.service Description=waldo"
work.

See: #7245

6 years agotree-wide: generate SD_BUS_ERROR_INVALID_ARGS when we get invalid arguments on bus...
Lennart Poettering [Wed, 22 Nov 2017 14:15:11 +0000 (15:15 +0100)]
tree-wide: generate SD_BUS_ERROR_INVALID_ARGS when we get invalid arguments on bus calls

Let's make sure that when we return a D-Bus error, we return a native
one, if we generate it ourselves, and use errno-based error
synthetization only if we received an errno ourselves. Yes, this makes
things slightly longer, but is highly misleading as we propagate D-Bus
errors, and not errnos to the client.

6 years agocore: add proper escaping to writing of drop-ins/transient unit files
Lennart Poettering [Wed, 22 Nov 2017 14:03:51 +0000 (15:03 +0100)]
core: add proper escaping to writing of drop-ins/transient unit files

This majorly refactors the transient unit file and drop-in writing
logic, so that we properly C-escape and specifier-escape (% → %%)
everything we write out, so that when we read it back again, specifiers
are parsed that aren't supposed to be parsed.

This renames unit_write_drop_in() and friends by unit_write_setting().
The name change is supposed to clarify that the functions are not only
used to write drop-in files, but also transient unit files.

The previous "mode" parameter to this function is replaced by a more
generic "flags", which knows additional flags for implicit C-style and
specifier escaping before writing things out. This can cover most
properties where either form of escaping is defined. For the cases where
this isn't sufficient, we add helpers unit_escape_setting() and
unit_concat_strv() for escaping individual strings or strvs properly.

While we are at it, we also prettify generation of transient unit files:
we try to reduce the number of section headers written out: previously
we'd write the right section header our for each setting. With this
change we do so only if the setting lives in a different section than
the one before.

(This should also be considered preparation for when we add proper APIs
to systemd to write normal, persistant unit files through the bus API)

6 years agologind: fix sysfs change trigger code
Lennart Poettering [Wed, 22 Nov 2017 11:10:39 +0000 (12:10 +0100)]
logind: fix sysfs change trigger code

We can't create files in sysfs, hence don't bother. Also if we ignore
the return value, do so explicitly by casting to void.

6 years agogenerators: be more careful when writing unit settings that support specifier expansion
Lennart Poettering [Tue, 21 Nov 2017 19:09:31 +0000 (20:09 +0100)]
generators: be more careful when writing unit settings that support specifier expansion

Let's always escape strings we receive from the user before writing them
out to unit file settings that suppor specifier expansion, so that user
strings are transported as-is.

6 years agocore: enable specifier expansion for What=/Where=/Type=/SourcePath= too
Lennart Poettering [Tue, 21 Nov 2017 19:03:51 +0000 (20:03 +0100)]
core: enable specifier expansion for What=/Where=/Type=/SourcePath= too

Using specifiers in these settings isn't particularly useful by itself,
but it unifies behaviour a bit. It's kinda surprising that What= in
mount units resolves specifies, but Where= does not. Hence let's add
that too. Also, it's surprising Where=/What= in mount units behaves
differently than in automount and swap units, hence resolve specifiers
there too. Then, Type= in mount units is nowadays an arbitrary,
sometimes non-trivial string (think fuse!), hence let's also expand
specifiers there, to match the rest of the mount settings.

This has the benefit that when writing code that generates unit files,
less care has to be taken to check whether escaping of specifiers is
necessary or not: broadly everything that takes arbitrary user strings
now does specifier expansion, while enums/numerics/booleans do not.

6 years agocore: process C-style escapes in UnsetEnvironment=
Lennart Poettering [Tue, 21 Nov 2017 18:50:52 +0000 (19:50 +0100)]
core: process C-style escapes in UnsetEnvironment=

We process C-style escapes in Environment=, hence we should process it
in UnsetEnvironment= too, as the latter accepts assignments much like
the former, including arbitrary values specified by the user.

6 years agocore: use config_parse_unit_string_printf() for decoding RebootArgument=
Lennart Poettering [Tue, 21 Nov 2017 18:23:31 +0000 (19:23 +0100)]
core: use config_parse_unit_string_printf() for decoding RebootArgument=

All other cases where we accept a reboot argument are decoded with
config_parse_unit_string_printf() rather than
config_parse_unit_path_printf(), and that's really the only thing what
makes sense here, hence adjust this here, too.

6 years agoCODING_STYLE: document the order in which unescaping + specifier expansion should...
Lennart Poettering [Tue, 21 Nov 2017 16:58:51 +0000 (17:58 +0100)]
CODING_STYLE: document the order in which unescaping + specifier expansion should be done

6 years agospecifier: unify specifier implementations for user-related specifiers
Lennart Poettering [Tue, 21 Nov 2017 16:57:56 +0000 (17:57 +0100)]
specifier: unify specifier implementations for user-related specifiers

The code in install-printf.c and unit-printf.c for these is pretty much
the same and very generic. Let's move this all over to the generic
specifier.c, and share the implementations.

6 years agospecifier: add helper for escaping '%' characters to avoid making them subject for...
Lennart Poettering [Tue, 21 Nov 2017 16:52:31 +0000 (17:52 +0100)]
specifier: add helper for escaping '%' characters to avoid making them subject for expansion

This is ultimately just a wrapper around strreplace(), but it makes
things a bit more self-descriptive.

6 years agostring-util: update strreplace() a bit, use GREEDY_REALLOC()
Lennart Poettering [Tue, 21 Nov 2017 18:38:49 +0000 (19:38 +0100)]
string-util: update strreplace() a bit, use GREEDY_REALLOC()

6 years agocore: drop specifier expansion when parsing transient dbus properties
Lennart Poettering [Tue, 21 Nov 2017 16:32:01 +0000 (17:32 +0100)]
core: drop specifier expansion when parsing transient dbus properties

Specifier expansion (much like C escape handling) should be a helper for
writing unit files, but should be nothing we do on programatic APIs. For
those, the client can do the necessary replacements anyway, and we
really should be careful with doing such string processing of data we
get via lower level programmatic APIs.

We currently do specifier expansion only for the env var transient unit
APIs, no other properties do this. Let's remove it here too, to be fully
systematic.

Yes, in a way this is API breakage, but then again this API isn't
documented yet, and an outlier, hence let's clear this up now, before it
is too late.

6 years agojournald: correct field counts
Lennart Poettering [Wed, 29 Nov 2017 10:37:21 +0000 (11:37 +0100)]
journald: correct field counts

N_IOVEC_OBJECT_FIELDS is bumped 14 → 18 (see dispatch_message_real() and
count!)

N_IOVEC_PAYLOAD_FIELDS is bumped 15 → 16 (see
server_space_usage_message() and count!)

Also, add comments, to make clear what is what.

6 years agojournal: driver messages can now contain object fields, account for that
Lennart Poettering [Wed, 29 Nov 2017 10:36:22 +0000 (11:36 +0100)]
journal: driver messages can now contain object fields, account for that

In some cases we can now log about processes, hence we must keep room
for that.

6 years agoMerge pull request #7492 from keszybz/coverity-fixes
Yu Watanabe [Wed, 29 Nov 2017 03:50:49 +0000 (12:50 +0900)]
Merge pull request #7492 from keszybz/coverity-fixes

A few more cleanups based on coverity and valgrind

6 years agoudev/collect: use _cleanup_ in one more place
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 12:26:15 +0000 (13:26 +0100)]
udev/collect: use _cleanup_ in one more place

This doesn't make the code pretty, but it at least makes it a tiny bit shorter.

6 years agoudev/collect: remove dead conditional
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 12:18:09 +0000 (13:18 +0100)]
udev/collect: remove dead conditional

Coverity rightly says that 'word' is assigned to 'ptr', and 'word'
was assigned from 'ptr' (yikes) right after a non-null check.

6 years agojournal: avoid undefined behaviour in float division by 0.0
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 12:11:35 +0000 (13:11 +0100)]
journal: avoid undefined behaviour in float division by 0.0

Coverity says that's undefined. I'm pretty sure we always would get a nan, but
let's avoid (formally) undefined behaviour since that can cause compilers to do
strange things.

6 years agonetworkd: fix memleak of Rules
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 12:02:33 +0000 (13:02 +0100)]
networkd: fix memleak of Rules

This was the issue mentioned in 93f9da6e0a.

6 years agojournal: use new helpers with journal_file_close
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 11:40:14 +0000 (12:40 +0100)]
journal: use new helpers with journal_file_close

journal_file_close_set() is not necessary anymore.

6 years agojournal-remote: add helper function and use hashmap_free_with_destructor
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 11:38:15 +0000 (12:38 +0100)]
journal-remote: add helper function and use hashmap_free_with_destructor

6 years agocryptsetup-generator: add helper function and use hashmap_free_with_destructor
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 11:37:51 +0000 (12:37 +0100)]
cryptsetup-generator: add helper function and use hashmap_free_with_destructor

6 years agocoredump: fix typo and use hashmap_free_with_destructor
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 11:37:14 +0000 (12:37 +0100)]
coredump: fix typo and use hashmap_free_with_destructor

6 years agomachine-image: convert image_hashmap_free() to an static inline helper
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 11:36:35 +0000 (12:36 +0100)]
machine-image: convert image_hashmap_free() to an static inline helper

6 years agoAdd set/hashmap helpers for non-trivial freeing and use where straighforward
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 11:35:49 +0000 (12:35 +0100)]
Add set/hashmap helpers for non-trivial freeing and use where straighforward

A macro is needed because otherwise we couldn't ensure type safety.
Some simple tests are included.
No functional change intended.

6 years agoUse hashmap_free_free where appropriate
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 11:31:27 +0000 (12:31 +0100)]
Use hashmap_free_free where appropriate

6 years agoRevert "meson: drop rootprefix option"
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 19:00:10 +0000 (20:00 +0100)]
Revert "meson: drop rootprefix option"

This reverts commit ee4bfa21f62dbf4d8f2be27d3c763c3c16743bfd.

Also add comment so that this doesn't get deleted again by mistake.

Replaces #7461.

6 years agoMerge pull request #7490 from yuwata/test-basic
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 17:15:30 +0000 (18:15 +0100)]
Merge pull request #7490 from yuwata/test-basic

add more tests for basic functions

6 years agonetworkd: Add comment for setting_mtu #7460 (#7489)
Susant Sahani [Tue, 28 Nov 2017 16:24:52 +0000 (21:54 +0530)]
networkd: Add comment for setting_mtu #7460 (#7489)

Follow up #7460

6 years agoMerge pull request #7486 from keszybz/coverity-fixes
Lennart Poettering [Tue, 28 Nov 2017 14:04:11 +0000 (15:04 +0100)]
Merge pull request #7486 from keszybz/coverity-fixes

Fixes for issues spotted by coverity (and some cleanups)

6 years agotest-cap-list: add more tests about capability_set_{from,to}_string()
Yu Watanabe [Tue, 28 Nov 2017 13:17:00 +0000 (22:17 +0900)]
test-cap-list: add more tests about capability_set_{from,to}_string()

6 years agotest: move tests about cap_list_cap() from test-cap-list to test-capability
Yu Watanabe [Tue, 28 Nov 2017 13:14:54 +0000 (22:14 +0900)]
test: move tests about cap_list_cap() from test-cap-list to test-capability

6 years agocap-list: check range of numeric value
Yu Watanabe [Tue, 28 Nov 2017 13:06:34 +0000 (22:06 +0900)]
cap-list: check range of numeric value

6 years agotest-bitmap: add tests for bitmap_copy()
Yu Watanabe [Tue, 28 Nov 2017 09:19:04 +0000 (18:19 +0900)]
test-bitmap: add tests for bitmap_copy()

6 years agotest-architecture: add more tests
Yu Watanabe [Tue, 28 Nov 2017 09:14:55 +0000 (18:14 +0900)]
test-architecture: add more tests

6 years agotest-alloc-util: add tests for memdup_suffix0() and greedy_realloc()
Yu Watanabe [Tue, 28 Nov 2017 11:33:58 +0000 (20:33 +0900)]
test-alloc-util: add tests for memdup_suffix0() and greedy_realloc()

6 years agotests: add tests for empty string
Yu Watanabe [Tue, 28 Nov 2017 09:13:05 +0000 (18:13 +0900)]
tests: add tests for empty string

6 years agoalloc-util: coding style fix
Yu Watanabe [Tue, 28 Nov 2017 09:11:58 +0000 (18:11 +0900)]
alloc-util: coding style fix

6 years agoMerge pull request #7398 from keszybz/udev-list
Lennart Poettering [Tue, 28 Nov 2017 10:35:02 +0000 (11:35 +0100)]
Merge pull request #7398 from keszybz/udev-list

udev: use list.h instead of udev_list_node

6 years agoMerge pull request #7484 from poettering/sd-resolve-timeout
Lennart Poettering [Tue, 28 Nov 2017 10:33:38 +0000 (11:33 +0100)]
Merge pull request #7484 from poettering/sd-resolve-timeout

timeout sd-resolve tests

6 years agopid1: improve syntax in error message
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 22:05:19 +0000 (22:05 +0000)]
pid1: improve syntax in error message

6 years agopid1: clarify that min_max is always initialized
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 22:01:48 +0000 (22:01 +0000)]
pid1: clarify that min_max is always initialized

read_one_line_file() always returns <= 0, so the code was OK, but let's write
the check a bit differently to make it obvious that min_max is always set.

6 years agotest-hostname-util: add assert_se's to make coverity happy
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 21:54:38 +0000 (21:54 +0000)]
test-hostname-util: add assert_se's to make coverity happy

6 years agotest-process-util: add (void) cast to make coverity happy
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 21:52:32 +0000 (21:52 +0000)]
test-process-util: add (void) cast to make coverity happy

The intent is for the call to succeed only when privileged, so make
that clear.

6 years agotest-fd-util: add assert_se to make coverity happy
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 21:51:11 +0000 (21:51 +0000)]
test-fd-util: add assert_se to make coverity happy

6 years agoudevadm-monitor: add some assert_se's to make coverity happy
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 21:48:46 +0000 (21:48 +0000)]
udevadm-monitor: add some assert_se's to make coverity happy

We do that elsewhere and it's nice to be consistent.

6 years agocore/umount: use _cleanup_ in one more place
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 16:13:04 +0000 (16:13 +0000)]
core/umount: use _cleanup_ in one more place

6 years agosd-resolve: check that name fits in the specified packet length
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 13:54:55 +0000 (13:54 +0000)]
sd-resolve: check that name fits in the specified packet length

Coverity complained that we didn't check if the data is long enough.

6 years agoshim: fix logically dead code
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 13:31:46 +0000 (13:31 +0000)]
shim: fix logically dead code

The alternate verification path could never be taken.

Found by coverity.

6 years agonetworkd: remove dead code
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 13:25:08 +0000 (13:25 +0000)]
networkd: remove dead code

Found by coverity.

6 years agotest-ndisc-ra: add assert_se() to make coverity happy
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 12:47:52 +0000 (12:47 +0000)]
test-ndisc-ra: add assert_se() to make coverity happy

6 years agoboot/shim: fix char ** vs char * mismatch
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 12:36:21 +0000 (12:36 +0000)]
boot/shim: fix char ** vs char * mismatch

This code cannot have ever worked ;(

Found by coverity, obvious when the type is not obfuscated to void*.

6 years agoboot/efi: fix NULL dereference
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 12:22:56 +0000 (12:22 +0000)]
boot/efi: fix NULL dereference

The comment above makes the intent of the code pretty clear:
"use security2_protocol == NULL as indicator".
So revert the condition in the check and fix the logic in the comment while
at it.

The question is how this could have ever worked: if BS->LocateProtocol
(which is supposedly optional) ever failed, we'd crash here. Strange.

Found by coverity.

6 years agodissect-image: simplify check for passphrase presence
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 12:16:09 +0000 (12:16 +0000)]
dissect-image: simplify check for passphrase presence

m->encrypted is set when fstype=="crypto_LUKS", but this is not obvious when
reading decrypt_partition(). Just check if passphrase is set before using
it.

6 years agonetworkd: fix reversed arguments
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 12:08:37 +0000 (12:08 +0000)]
networkd: fix reversed arguments

Found by coverity.

Also drop unused return value while at it.

6 years agonetworkd: plug some memleaks in rule serialization/deserialization
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 12:01:41 +0000 (12:01 +0000)]
networkd: plug some memleaks in rule serialization/deserialization

This fixes the (mostly theoretical, since we're only parsing data that we write
ourselves) memleak when iif or oif is deserialized multiple times. Unfortunately
it does not fix the memleak when rule is freed, but that'll require a bigger
effort.

6 years agonetworkd: fix serialization of {Incoming,Outgoing}Interface
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 11:51:08 +0000 (11:51 +0000)]
networkd: fix serialization of {Incoming,Outgoing}Interface

Let's just say that the code wasn't fully functional ;(

Since we only had the parser for serialization, and not the writer, we are
free to change the format. So while at it, let's use shorter names in the
serialization format that match the surrounding style.

6 years agoAdd test-routing-policy-rule
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 11:38:24 +0000 (11:38 +0000)]
Add test-routing-policy-rule

6 years agotest-network: use automatic cleanup
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 11:23:31 +0000 (11:23 +0000)]
test-network: use automatic cleanup

6 years agonetworkd: parse the rvalue, not the option name
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 11:21:19 +0000 (11:21 +0000)]
networkd: parse the rvalue, not the option name

:(

6 years agonetworkd: move rule loading to a separate function
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 10:22:51 +0000 (10:22 +0000)]
networkd: move rule loading to a separate function

No functional change.

6 years agoMerge pull request #7316 from poettering/fd-store-remove
Zbigniew Jędrzejewski-Szmek [Tue, 28 Nov 2017 08:15:00 +0000 (09:15 +0100)]
Merge pull request #7316 from poettering/fd-store-remove

add new FDSTOREREMOVE=1 sd_notify() message

6 years agoAdded Logitech MX Master 2s (#7487)
Ari [Tue, 28 Nov 2017 02:30:31 +0000 (21:30 -0500)]
Added Logitech MX Master 2s (#7487)

6 years agotest-resolve: make sure we don't hang forever
Lennart Poettering [Mon, 27 Nov 2017 15:29:41 +0000 (16:29 +0100)]
test-resolve: make sure we don't hang forever

If test-resolve is running in some CI environment that doesn't have
reliably working DNS, it's a good idea not to hang forever, let's
time-out after 20s

6 years agosd-resolve: propagate timeouts in sd_resolve_wait() the same way as in sd_bus_wait...
Lennart Poettering [Mon, 27 Nov 2017 15:28:53 +0000 (16:28 +0100)]
sd-resolve: propagate timeouts in sd_resolve_wait() the same way as in sd_bus_wait(): ETIMEDOUT

Thankfully this is an internal API still, so we can mkae changes like
this.