summaryrefslogtreecommitdiffstats
path: root/src/shared (follow)
Commit message (Collapse)AuthorAgeFilesLines
* various: drop unnecessary DISABLE_WARNING_FORMAT_NONLITERALMike Yuan2024-04-281-2/+0
| | | | | We use _printf_ for these functions, so there shouldn't be a warning in the first place.
* treewide: fix a few typos in NEWS, docs, comments, and log messagesDmitry V. Levin2024-04-274-4/+4
|
* mount-setup: fix typoMike Yuan2024-04-261-1/+1
|
* varlink: make errors returned by verify_unix_socket() systematicLennart Poettering2024-04-251-1/+12
| | | | | | Previously, if we encountered a non-socket fd we'd return ENOTSOCK the first time, but the subsequent times we'd return ENOMEDIUM, due to caching. Let's make sure we return the same errors all the the time.
* Merge pull request #32477 from DaanDeMeyer/fixesDaan De Meyer2024-04-251-2/+1
|\ | | | | Various fixes
| * tree-wide: Use log_setup() everywhereDaan De Meyer2024-04-251-2/+1
| | | | | | | | | | Otherwise the default log target is the console and we won't use the journal socket even if it is available.
* | varlink: fix varlink_get_peer_pidref() fallbackLennart Poettering2024-04-251-1/+1
|/ | | | | let's properly handle old kernels that have no pidfd, and use regular pids in that case, as intended originally.
* run/run: fix invocation ID handlingYu Watanabe2024-04-251-4/+3
| | | | Fixes a regression introduced by 8157cc0e3e33c97b406cc088cf001ca524154f64.
* mount-setup: use mount_verbose_full where appropriateMike Yuan2024-04-241-4/+1
|
* Merge pull request #32392 from DaanDeMeyer/executor-log-levelDaan De Meyer2024-04-221-1/+3
|\ | | | | core: Set a sensible systemd-executor log level in test runs
| * mount-util: Silence noisy trace log messageDaan De Meyer2024-04-221-1/+3
| |
* | shared/verbs: show list of verbs when missingMike Yuan2024-04-221-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaces #32062 As discussed in #32062, making 'help' the default verb is not very appealing for two reasons: 1) If the verb is missing, showing a help which is pages long isn't really helpful to locate the problem. (https://github.com/systemd/systemd/pull/32062#issuecomment-2064997158) 2) We want to reserve the right to set default verbs to be more useful ones, instead of help. E.g. 'busctl' lists all bus peers by default. So, when there are more than 2 verbs, let's instead add the list of available verbs to the "Command verb required" message, that serves as a hint. That way we try to be friendlier to users, but still make the problem obvious.
* | shared/verbs: minor modernizationMike Yuan2024-04-221-10/+8
|/
* tpm2-util: add generic wrapper tpm2_context_new_or_warn() that wrpas ↵Lennart Poettering2024-04-224-9/+28
| | | | | | | | | | tpm2_context_new and logs about errors We so far just print a short log message that is not very useful, let's add some recognizable error codes, and output better log messages if we can't get TPM stuff to work. Fixes: #31925
* test: Don't allocate scope if already running in unit with delegated cgroupDaan De Meyer2024-04-221-1/+5
| | | | | | | If we're already running in a unit with delegation turned on, let's skip allocation of a scope unit and cgroup subroot. This allows journald to correctly attribute the logs of all subprocesses spawned by tests such as test-execute to the test-execute service when the test is running in a service.
* test: Use log_setup()Daan De Meyer2024-04-221-2/+1
| | | | | | Specifically, this will make tests log to the journal if stderr is connected to the journal. This means we get proper log priorities and such compared to if we just logged to stderr.
* test: Add ASSERT_ERROR() and ASSERT_ERROR_ERRNO()Daan De Meyer2024-04-221-0/+31
| | | | For when we expect something to fail with a specific error.
* Merge pull request #32370 from YHNdnzj/vpick-check-earlyMike Yuan2024-04-201-14/+9
|\ | | | | shared/vpick: some minor cleanups
| * shared/vpick: check deterministic suffix earlierMike Yuan2024-04-201-5/+3
| | | | | | | | Follow-up for 421a4ba7e4a26332c271359a7a114a1da7a2afad
| * shared/vpick: flatten errno checkMike Yuan2024-04-201-4/+3
| |
| * shared/vpick: use strdup_to where appropriateMike Yuan2024-04-201-5/+3
| |
* | timedate: handle gracefully if RTC lost time because of power lossLennart Poettering2024-04-201-3/+4
|/ | | | | | | Apparently some RTC drivers return EINVAL in that case when we try to read it. Handle that reasonably gracefully. Fixes: #31854
* Merge pull request #32142 from bluca/portable_vpickLuca Boccassi2024-04-193-17/+28
|\ | | | | portable: support vpick
| * vpick: add pick_filter_image_any filter that matches both dirs and imagesLuca Boccassi2024-04-193-17/+28
| |
* | Merge pull request #31978 from nolange/fix_openssl_deprecationsLuca Boccassi2024-04-193-4/+19
|\ \ | | | | | | Fix openssl deprecations
| * | openssl-util: compatible with restricted openssl3Norbert Lange2024-04-183-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | openssl can be built without support for engines or with deprecated definitions disabled. This also will not pull in most headers automatically, so add the rsa.h and ec.h header explicitly. Remove Engine stuff from the header - it is only needed in one source file. Make Engine support dependent on the macros.
* | | Merge pull request #32340 from YHNdnzj/wait-for-unit-cleanupYu Watanabe2024-04-192-55/+32
|\ \ \ | | | | | | | | bus-wait-for-units: some cleanup
| * | | bus-wait-for-units: simplify property_map_job_idMike Yuan2024-04-191-13/+7
| | | |
| * | | bus-wait-for-units: drop 'current' fieldMike Yuan2024-04-191-7/+0
| | | | | | | | | | | | | | | | This is not used anywhere.
| * | | bus-wait-for-units: check for existing unit first, use hashmap_ensure_putMike Yuan2024-04-192-10/+13
| | | |
| * | | bus-wait-for-units: make callback type end with "_t"Mike Yuan2024-04-192-5/+11
| | | |
| * | | bus-wait-for-units: drop ready_callbackMike Yuan2024-04-192-20/+1
| | | | | | | | | | | | | | | | | | | | This is never used, and given that bus_wait_for_units_run returns BusWaitForUnits.state it's not really useful.
* | | | conf-parser: move config_parse_timezone() to conf-parser.[ch]Yu Watanabe2024-04-192-0/+35
|/ / / | | | | | | | | | | | | Even though it is currently only used by networkd, the parser itself is quite generic. Let's move it to the shared library.
* | / copy: ignore -EOPNOTSUPP from copy_file_range()Nick Rosbrook2024-04-191-1/+1
| |/ |/| | | | | | | | | | | According to copy_file_range (2), errno will be set to EOPNOTSUPP when the file system does not support copy_file_range(). Since there is already fallback logic in place here for other kinds of errors, add -EOPNOTSUPP to the list of ignored errors.
* | Merge pull request #31790 from poettering/pcrlock-policy-fixLennart Poettering2024-04-182-24/+237
|\ \ | | | | | | Replace PolicyAuthValue by PolicySigned as access policy for pcrlock policy nvindex
| * | tpm2-util: now that we don't use PolicyAuthValue anymore, let's not set an ↵Lennart Poettering2024-04-182-16/+2
| | | | | | | | | | | | | | | | | | | | | | | | authValue anymore for the policy nvindex We have now switched from PolicyAuthValue to PolicySigned to control access to the policy nvindex to. This means there's no point in setting an authValue on the nvindex anymore, hence drop this.
| * | pcrlock: switch access policy for nvindex to store policy in from ↵Lennart Poettering2024-04-182-0/+218
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PolicyAuthValue to PolicySigned (with an HMAC-SHA256 key) So far the nvindex to store the pcrlock policy in was protected via a PolicyAuthValue policy (i.e. with a simple PIN set on the nvindex). That's a bad idea however, as it means an attacker can simply remove and re-create the nvindex and the "name" of the nvindex does not change, thus defeating the logic. (This is because the authValue is *not* part of the "name" of an nvindex!). Fix this by switching from PolicyAuthValue to PolicySigned with an HMAC-SHA256 key. Behaviour is very similar: however, the PIN is now part of of the access policy hash, which *is* part of the "name" of an nvindex. Thus, if an attacker removes and recreates the nvindex it has to provide the same PIN again or the "name" of the nvindex will change. Mission accomplished. I'd like to thank Chris Coulson for finding this issue (and helping me address it). Thank you!
| * | tpm2-util: add comment explaining what tpm2_define_policy_nv_index() ↵Lennart Poettering2024-04-181-0/+4
| | | | | | | | | | | | actually does
| * | tpm2-util: load external key into NULL hierarchy if private key is providedLennart Poettering2024-04-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | If we load an external key into the TPM we must do so in the NULL hierarchy. An external key after all is one that is not wrapped by any hierarchy's seed. See TPM2 spec, Part 3, Section 12.3.1
| * | tpm2-util: rename tpm2_get_pin_auth() → tpm2_auth_value_from_pin()Lennart Poettering2024-04-182-6/+6
| | | | | | | | | | | | | | | | | | | | | Just some renaming. I found the old name a bit confusing since it sounds as if this would get the pin from somewhere, but it really doesn't. It just converts a PIN into an auth_value, and I think saying so explicitly makes things easier to grok.
| * | tpm2: export tpm2_get_name()Lennart Poettering2024-04-182-1/+2
| | | | | | | | | | | | We later want to use this from pcrlock.c, hence export it.
| * | tpm2-util: import two more symbols from tpm2-tss librariesLennart Poettering2024-04-181-0/+4
| |/ | | | | | | | | We want to make use of TPM_PolicySigned soon, hence import the necessary symbols from tpm2-tss.
* / use FOREACH_ELEMENTMatteo Croce2024-04-188-10/+10
|/ | | | | | | | Use FOREACH_ELEMENT where possible. Generated with this command, and checked manually: git grep -l 'FOREACH_ARRAY.*ELEMENTSOF' | \ xargs sed -ri 's/FOREACH_ARRAY\((.*), (.*), (ELEMENTSOF.*)\)/FOREACH_ELEMENT(\1, \2)/'
* blockdev-util: fix typoYu Watanabe2024-04-181-1/+1
| | | | Follow-up for 33ff155957327f51dde740a7a75f19122bff1ebc.
* Merge pull request #32192 from yuwata/part-scanYu Watanabe2024-04-181-16/+40
|\ | | | | blockdev-util: fix detection of partscan
| * blockdev-util: also read 'ext_range' sysattr to check if the partscan is enabledYu Watanabe2024-04-181-16/+40
| | | | | | | | | | The 'capability' sysattr was deprecated by https://github.com/torvalds/linux/commit/e81cd5a983bb35dabd38ee472cf3fea1c63e0f23 (v6.3).
* | Merge pull request #32249 from CodethinkLabs/vmspawn/predicatable_tap_namesYu Watanabe2024-04-182-0/+86
|\ \ | |/ |/| vmspawn: generate predicatable TAP device names and MAC addresses
| * nspawn,shared/netif-util: move generate_mac and shorten_ifname to ↵Sam Leonard2024-04-152-0/+86
| | | | | | | | shared/netif-util
* | Merge pull request #32143 from yuwata/magicLennart Poettering2024-04-171-2/+2
|\ \ | | | | | | basic/linux: copy magic.h from kernel to our code
| * | home,resize-fs: replace XFS_SB_MAGIC -> XFS_SUPER_MAGICYu Watanabe2024-04-091-2/+2
| | |