Commit Graph
7517 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek aea3f594db various: use id128_from_string_not_null()
No functional change. In config_parse_address_generation_type() we would set
the output parameter and then say it's ignored, so it _looked_ like an error in
the code, but the variable was always initialized to SD_ID128_NULL anyway, so
the code was actually fine.
2023-09-02 14:16:25 +03:00
Zbigniew Jędrzejewski-Szmek f1c0ad5279 shared/id128-print: fix indentation, reduce variable scope 2023-08-29 17:06:47 +03:00
Malte PollandPaul Meyer 4947de275a mkfs-util: propagate SOURCE_DATE_EPOCH to mcopy
Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
2023-08-29 14:58:44 +01:00
Luca Boccassi cd4ed8579b Merge pull request #28948 from poettering/tpm2-duplicate-pcr-names
tpm2: unify tpm2 PCR symbolic identifiers
2023-08-28 17:43:10 +01:00
Luca Boccassi f154440980 Merge pull request #28916 from ddstreet/tpm2_pcr_value_post_merge
Tpm2 pcr value post merge
2023-08-28 17:42:48 +01:00
Zbigniew Jędrzejewski-Szmek 6f420b5f75 Merge pull request #28968 from DaanDeMeyer/rlimit
Limit rlim_max in rlimit_nofile_safe() to nr_open
2023-08-27 16:06:58 +02:00
Daan De Meyer fbc6a75571 mkfs-util: Set FORK_REOPEN_LOG
We set FORK_CLOSE_ALL_FDS, so we should also set FORK_REOPEN_LOG to
reopen the log in the child process so we don't miss any logging
messages.
2023-08-25 14:25:33 +02:00
Dan Streetman 81e3d37211 tpm2: wrap (7) in UINT32_C() 2023-08-24 12:35:58 -04:00
Dan Streetman 26d8d71fa5 tpm2: add tpm2_pcr_values_has_(any|all)_values() functions 2023-08-24 12:35:58 -04:00
Dan Streetman 70cb382d36 tpm2: remove unnecessary void* cast 2023-08-24 12:35:58 -04:00
Dan Streetman ed35ac3155 tpm2: make logging level consistent at debug for some functions 2023-08-24 12:35:58 -04:00
Dan Streetman 3f4d5dfd65 tpm2: use switch() instead of if-else 2023-08-24 12:35:58 -04:00
Dan Streetman 6761e1355e tpm2: use table for openssl<->tpm2 ecc curve id mappings 2023-08-24 12:35:54 -04:00
Dan Streetman b030710295 openssl: use new(char, size) instead of malloc(size) 2023-08-24 12:33:26 -04:00
Dan Streetman 65fd657e0a tpm2: use memcpy_safe() instead of memcpy() 2023-08-24 12:33:26 -04:00
Dan Streetman ae2b38e463 tpm2: remove ret_ prefix from input/output params 2023-08-24 12:33:26 -04:00
Dan Streetman c6e5178220 tpm2: split TPM2_PCR_VALUE_MAKE() over multiple lines 2023-08-24 12:33:26 -04:00
Dan Streetman 85b6f299b2 tpm2: use strempty() 2023-08-24 12:33:26 -04:00
Dan Streetman 8e757259c3 tpm2: check pcr value hash != 0 before looking up hash algorithm name 2023-08-24 12:33:26 -04:00
Dan Streetman 495f2bf57c tpm2: simplify call to asprintf() 2023-08-24 12:33:26 -04:00
Dan Streetman 2b2ee3f265 tpm2: put !isempty() check inside previous !isempty() check 2023-08-24 12:33:26 -04:00
Dan Streetman 7001a7daf7 tpm2: use SIZE_MAX instead of strlen() for unhexmem() 2023-08-24 12:33:26 -04:00
Dan Streetman 193fd5730e tpm2: in tpm2_pcr_values_valid() use FOREACH_ARRAY() 2023-08-24 12:32:51 -04:00
Dan Streetman 064ac95d81 tpm2: in validator functions, return false instead of assert failure 2023-08-24 12:31:00 -04:00
Dan Streetman 3cd4145f34 tpm2: move cast from lhs to rhs in uint16_t/int comparison 2023-08-24 12:31:00 -04:00
Dan Streetman cc1a78d5c4 tpm2: lowercase TPM2_PCR_VALUE[S]_VALID functions
As these are not macros, they should be lowercase.
2023-08-24 12:31:00 -04:00
Dan Streetman 7354a7ccd4 tpm2: change *alg_to_* functions to use switch() 2023-08-24 12:31:00 -04:00
Lennart Poettering 6b0651df60 gpt: move basic header/partition structure of GPT into common code
This way we can use it at other places too, not just when dissecting
images.
2023-08-24 15:25:38 +02:00
Lennart Poettering e0e1f4f7a2 fundamental: rename tpm-pcr.h → tpm2-pcr.h
I always found it confusing that most of our TPM related definitions are
in tpm2-util.h, but the PCR names in tpm-pcr.h, without the "2". Let's
fix that and make this systematic, in particular as the definitions in
the file all start with TPM2_ already.

No code flow changes, just some renaming.
2023-08-24 13:40:37 +02:00
Lennart Poettering 2099cd6289 tpm2: unify symbolic name infra for PCRs
We so far maintained two places for symboic names for PCRs. One in
tpm2-util.h and one in tpm-pcr.h.

Let's unify this into one, i.e. move the full list from tpm2-util.h into
tpm-pcr.h, replacing the short list placed so far there.

Systematically prefix the definitions with TPM2_ or tpm2_, to follow how
we do this for all other defines in this context.

No change in behaviour, just unification of tables.
2023-08-24 13:40:37 +02:00
Lennart Poettering f5fc7732b0 json: add json_variant_set_fieldb() helper
Let's a "b" helper for json_variant_set_field() that combines
json_build() with json_variant_set_field(), similar to the
json_variant_merge_objectb(), json_variant_append_arrayb().
2023-08-24 13:20:39 +02:00
Lennart Poettering e931768eb4 json: rename json_append() → json_variant_merge_objectb()
json_append() is a useful wrapper around json_variant_merge(). However,
I think the naming sould be cleaned up a bit of both functions.

I thinker "merge" is the better word than "append", since it does
decidedly more than just append: it replaces existing fields of the same
name, hence "merge" sounds more appropriate. This is as opposed to the
similar operations for arrays, where no such override logic is applied
and we really just append, hence those functions are called "append"
already.

To make clearer that "merge" is about objects, and "append" about
arrays, also include "object" in the name.

Also, include "json_variant" in the name, like we do for almost all
other functions in the JSON API that take a JSON object as primary
input, and hence are kinda object methods.

Finally, let's follow the logic that helpers that combine json_build()
with some other operation get suffixed with "b" like we already have in
some cases.

Hence:

json_variant_merge() → json_variant_merge_object()
       json_append() → json_variant_merge_objectb()

This mirrors nicely the existing:
                       json_variant_append_array()
                       json_vairant_append_arrayb()

This also drops the variant of json_append() that takes a va_arg
parameter (i.e. json_appendv()). We have no user of that so far, and
given the nature as a helper function only I don#t see that happening,
and if it happens after all it's trivial to bring back.
2023-08-24 13:20:39 +02:00
Lennart Poettering 3218794f1c json: add json_variant_append_arrayb() helper 2023-08-24 13:19:52 +02:00
Lennart Poettering ba091282e5 utf8: automatically determine length of string if SIZE_MAX is specified
Let's make utf8_to_utf16() and utf16_to_utf8() a bit nicer to use by
adding shortcuts for common cases.

This is particularly relevant for utf16_to_utf8() since the
multiplication with 2 is easy to forget.
2023-08-24 13:19:12 +02:00
Daan De Meyer b56ee69233 hostname: Make sure we pass error to bus_verify_polkit_async()
Fixes #28943
2023-08-24 11:23:01 +02:00
Jan Janssen 9ee80846f8 meson: Convert fidsk to meson feature
By making this a disabler dependency, we can slightly simplify the code
and it als fixes the build for -Dfdisk=disabled as we failed to create a
fallback empty libshared_fdisk variable.
2023-08-23 14:45:02 +02:00
Yu Watanabe 2b60ce545c mount-util: drop unused remount_and_move_sub_mounts() 2023-08-22 23:21:43 +09:00
Lennart Poettering ea803614fc verbs: make a helpful suggestion when user types unrecognized verb
I have been mistyping commands too often myself, and I think the tools
could simply be more helpful, by suggesting to me what I probably wanted
to write. Copy/Paste FTW, after all!
2023-08-21 23:19:49 +02:00
Lennart Poettering afa303254d Merge pull request #28907 from poettering/have-seccomp-tweaks
reduce HAVE_SECCOMP ifdeffery
2023-08-21 23:15:39 +02:00
Lennart Poettering cf1ab844a9 tree-wide: drop "static inline" use in .c files
"static inline" makes sense in .h files. But in .c files it's useless
decoration, the compiler should just make its own decisions there, and
it can do that.

hence, replace all remaining uses of "static line" by a simple" static"
in all .c files (but keep them in .h files, where they make sense)
2023-08-21 23:15:12 +02:00
Lennart Poettering e2fc0a7222 tree-wide: don't ifdef seccomp-util.h, drop seccomp.h inclusion everywhere
seccomp-util.h doesn't need ifdeffing, hence don't. It has worked since
quite a while with HAVE_SECCOMP is off, hence use it everywhere.

Also drop explicit seccomp.h inclusion everywhere (which needs
HAVE_SECCOMP ifdeffery everywhere). seccomp-util.h includes it anyway,
automatically, which we can just rely on, and it deals with HAVE_SECCOMP
at one central place.
2023-08-21 18:50:29 +02:00
Lennart Poettering 65a57927ad seccomp: move seccomp_parse_errno_or_action() into common definitions
Let's remove some HAVE_SECCOMP ifdeffery by simply defining the funcion
in question (seccomp_parse_errno_or_action() + related calls) into
common code that is also compiled if HAVE_SECCOMP is off.

This is generally the better approach anyway, since we want as much as
possible and easily feasible parsers work even if the code implementing
them is disabled. THis is easy to achieve here, hence do.
2023-08-21 18:50:29 +02:00
Mike Yuan 121ce4a687 generators: use generator_open_unit_file where appropriate 2023-08-19 01:15:01 +01:00
Daan De Meyer 3c1c52f2c9 install: Drop install_info_may_process() from unit_file_get_default()
This currently makes unit_file_get_default() fail if the default
target is transient which shouldn't make us fail to get the default
unit.
2023-08-18 20:48:47 +08:00
Lennart Poettering f51ed26b38 tpm2-util: add _const_/_pure_ to a couple of to_string()/from_string() functions 2023-08-18 11:54:25 +02:00
Lennart Poettering b060b9a492 tpm2-util: give PCR 6 a name too
The specs call this TCG PC Client Platform Firmware Profile
Specification says this PCR is owned by the Host Platform Manufacturer,
at various places. Hence let's give it that name.
2023-08-18 11:54:19 +02:00
Luca Boccassi f1a621b09b Merge pull request #28832 from dtardon/list-clear
Add LIST_CLEAR() helper that empties the list
2023-08-17 16:27:43 +01:00
Daan De Meyer be7d808c1c Merge pull request #28869 from DaanDeMeyer/repart-trailing
repart: Make sure we keep trailing slashes in ExcludeFiles=
2023-08-17 14:55:03 +02:00
Daan De Meyer ce60b3a40a parse-helpers: Add PATH_KEEP_TRAILING_SLASH 2023-08-17 13:23:39 +02:00
David Tardon 45b1c015b0 bus-polkit: don't propagate error from polkit
An error reply from polkit is a valid case and should not be propagated
as failure of async_polkit_callback(). It should only be saved here.
It'll be returned by bus_verify_polkit_async() later, when it's called
for the same method again.

Follow-up for #26365.
2023-08-17 12:08:32 +02:00