1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-18 06:03:42 +03:00

55881 Commits

Author SHA1 Message Date
Ansgar Burchardt
99a630479b base-filesystem.c: add trailing zero byte for s390x entry
(cherry picked from commit 4167e2135e0df7ce21820107e73492bb749280b9)
(cherry picked from commit 654ae8c1e4b6ba367ba09936462fe2eb1ad8ea2e)
2022-11-04 13:02:21 +01:00
Yu Watanabe
260633c50b mount-util: fix error code
If multiple service is starting simultaneously with a shared image,
then one of the service may fail to create a mount node:

systemd[695]: Bind-mounting /usr/lib/os-release on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC "")...
systemd[696]: Bind-mounting /usr/lib/os-release on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC "")...
systemd[695]: Failed to mount /usr/lib/os-release (type n/a) on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC ""): No such file or directory
systemd[696]: Failed to mount /usr/lib/os-release (type n/a) on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC ""): No such file or directory
systemd[695]: Bind-mounting /usr/lib/os-release on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC "")...
systemd[696]: Failed to create destination mount point node '/run/systemd/unit-root/run/host/os-release': Operation not permitted
systemd[695]: Successfully mounted /usr/lib/os-release to /run/systemd/unit-root/run/host/os-release

The function apply_one_mount() in src/core/namespace.c gracefully
handles -EEXIST from make_mount_point_inode_from_path(), but it erroneously
returned -EPERM previously. This fixes the issue.

Fixes one of the issues in #24147, especially reported at
https://github.com/systemd/systemd/issues/24147#issuecomment-1236194671.

(cherry picked from commit b6ca2b281eff254dce2293990360e799af806ad4)
(cherry picked from commit 24238be484e6d7633bc68c784f7b3180299a80d4)
2022-11-04 13:02:21 +01:00
Jan Janssen
b2082bbad0 stub: Use EfiLoaderCode for kernel memory
Fixes: #24237
(cherry picked from commit 79a7ef89aa5dd9d99a904f1253bad7512d3feee5)
(cherry picked from commit 7dacfb3fb4eaceedf994705d63fa1a1b72f8f12a)
2022-11-04 13:02:21 +01:00
David Rheinsberg
a9b264eb6b bus: use inline trace argument for ANONYMOUS auth
Rather than using a separate DATA round to transmit the trace-string of
the ANONYMOUS authentication scheme, transmit it inline as argument.
This requires a refactor of the client-side SASL parser, as we now have
a different set of replies depending on the mode used.

This fixes an issue where libdbus-1 does not query for trace-strings if
not transmit inline as AUTH-ANONYMOUS argument. It is unclear from the
wording of the spec whether this is a violation by libdbus-1. However,
we can work around it by simply changing our mode of transmittal.

(cherry picked from commit 347f48246f7014f2e266b1fcb4527edee93037da)
(cherry picked from commit bb803856bc8f86c76fbfdd3f5c61f84264e79ab4)
2022-11-04 13:02:21 +01:00
Christian Hesse
eb06b4cd8f systemctl: color ignored exit status in yellow, not red
If the executable path is prefixed with "-", an exit code of the command
normally considered a failure (i.e. non-zero exit status or abnormal exit
due to signal) is recorded, but has no further effect and is considered
equivalent to success.

Let's honor this with `systemctl status`, and color ignored exit status
in yellow, not red.

(cherry picked from commit e879434df550c6dcfc02f23e613f4dda7f741089)
(cherry picked from commit de08edca171be09c10e6860664497b101fc36bc6)
2022-11-04 13:02:21 +01:00
Lennart Poettering
787034e091 manager: make clear internal Dump() logic is debugging only.
(cherry picked from commit acf2de52171106f7084e9410f4cc838b9a4183dd)
(cherry picked from commit 1531a496e37be4da0e094f72f6f5c8eb8d4a150a)
2022-11-04 13:02:21 +01:00
Lennart Poettering
d4b9c0477d man: document the Dump() calls of the PID 1 D-Bus interface, and what they are
(cherry picked from commit 0df8512124b05ed2d3be1537a4023e89ec33f0f7)
(cherry picked from commit c4fd38f7d221ae5b438f81df6171701fcf3df352)
2022-11-04 13:02:21 +01:00
Yu Watanabe
165b8f8853 resolve: do not cache mDNS goodbye packet
Fixes #24842.

(cherry picked from commit a78049fc0e6a75446cb782b548ae9db8edf7a107)
(cherry picked from commit 140fee4627dccf0e5ad5fed9dacb9384698668f8)
2022-11-04 13:02:21 +01:00
Adam Williamson
d44dbdb682 kbd-model-map: correct variants for cz-qwerty to include comma
As explained by @poncovka , the 'xvariant' string should contain
the same number of comma-separated elements as 'xlayout'. When
we have two layouts we need two items in xvariant, in this case
one of them is empty.

See https://github.com/rhinstaller/anaconda/pull/4355#pullrequestreview-1119913870
for @poncovka's full explanation.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
(cherry picked from commit 950aeeb8ffc950637fac22cb5a42074f227d57f3)
(cherry picked from commit 1a2d93a7700d5056f01ee5b42605b1245310f690)
2022-11-04 13:02:21 +01:00
msizanoen1
5670a04b3d resolve: persist DNSOverTLS configuration in state file
Currently, NetworkManager will set DNSOverTLS according to its
`connection.dnsovertls` configuration only once during connection,
instead of every single restart of systemd-resolved, causing resolved to
lose the configuration on restart.

Fix this by persisting DNSOverTLS in the runtime state file, which will
also make it more consistent with other interface-specific settings.

(cherry picked from commit b49e029a9953dd0f327efe9035a7c429c3cfeb92)
(cherry picked from commit 9d1ebb22479b16e10623138ccbf3cd27378bf230)
2022-11-04 13:02:21 +01:00
Yu Watanabe
d24b858687 udev: support by-path devlink for multipath nvme block devices
If multipath feature is enabled, nvme block devices may belong to the
"nvme-subsystem" subsystem, instead of "nvme" subsystem.
(What a confusing name...)

Then, the syspath is something like the following,
    /sys/devices/virtual/nvme-subsystem/nvme-subsys0/nvme0n1
Hence, we need to find the 'real parent' device, such as
    /sys/devices/pci0000:00/0000:00:1c.4/0000:3c:00.0/nvme/nvme0

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2031810.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2124964.
Replaces #24748.

(cherry picked from commit 67c3e1f63a5221b47a8fea85ae421671f29f3b7e)
(cherry picked from commit 3137ac6ef5db1dcebd297e6d8c6af372d6acf23d)
2022-11-04 13:02:21 +01:00
Lennart Poettering
3f074e438a run: make --working-directory= work for --scope too
This sounds like a more user-friendly alternative to #24780

(cherry picked from commit fecc44776638a24099ce7e9ac227bcaa2c34f1e0)
(cherry picked from commit c948091cc54fda83923f3c13be51f4de1b422c59)
2022-11-04 13:02:21 +01:00
Adam Williamson
40766f6a48 kbd-model-map: add a mapping for switched czech qwerty/us
See https://bugzilla.redhat.com/show_bug.cgi?id=2121106 for the
background on this. One of Fedora's QA folks ran an install
and chose two keyboard layouts: Czech (qwerty) and US. Due to
the sad details of how the whole logic flow for trying to decide
what kbd layout best matches a given xkb config works (see
details in the bug comments), we wound up deciding the best-
matching kbd layout for this situation was cz-us-qwertz, which
is a czech/us switched layout, but is qwertz, not qwerty. This
seems like a poor outcome. Adding this line should result in us
picking cz-qwerty in this case. Which may be the 'legacy'
cz-qwerty.map from upstream kbd project (which is switched
cz/us), or may be the auto-converted xkb layout (which obviously
isn't switched). But either way, at least its primary mode is
Czech qwerty, which seems like a *better* choice than a layout
whose primary mode is Czech qwertz.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
(cherry picked from commit 97f99506980d92e858dc4685a2e84d9548d6eca4)
(cherry picked from commit 7bb204620dc7515146d02fc475768203d0037f9d)
2022-11-04 13:02:21 +01:00
Yu Watanabe
0ae11d2942 test: add more test cases for mkdir_p_safe() and mkdir_p_root()
(cherry picked from commit f8d5048dbf633f1bcccedbd337d751b33c5996a2)
(cherry picked from commit e5157050d1012cc621dd5608efbad366f57f8b12)
2022-11-04 13:02:21 +01:00
Yu Watanabe
259a84d5c2 mkdir: chase_symlinks_and_stat() does not return 0
This reverts commits e22916e61d1fdb7b46918b605ebf783d9017f9d8 and
1e146d738232acbe7f72903e9c5e4d1166ea67f5.

(cherry picked from commit f1d93b84bcc7c722a03928587023b144d4cc5e48)
(cherry picked from commit b3a9f7b5cb6a6ff56c60232b63f56d4b3cbae92f)
2022-11-04 13:02:21 +01:00
Daniel Braunwarth
bb2d46fc68 journalctl: respect --quiet flag during file concistency verification
Fixes #24563.

(cherry picked from commit 43deb1a8dce012c67a1285f7ef1bd40d971a4730)
(cherry picked from commit ac805eac156155bb8afdbaf704400e0ef854a6c9)
2022-11-04 13:02:21 +01:00
Sebastian Scheibner
6fd508a3ae busctl: Fix warning about invaild introspection data
The set_put function returns 0 if the element is already in the set and
not EEXIST, like e.g. hashmap does.

(cherry picked from commit bdff06de069fc83f18a126bf6b899ae2341572c3)
(cherry picked from commit 175ba30cf64772b136b5b982f04ff3c9a8295e23)
2022-11-04 13:02:21 +01:00
Lennart Poettering
7831972971 units: prolong the stop timeout for homed
Let's give IO/resizing/… more time then usual.

Fixes: #22901
(cherry picked from commit d3d2dd5e4f07c5d513c06df69f2c214681ddcd2a)
(cherry picked from commit 8b89e677e92b728383e203d98db45ae919fe6c97)
2022-11-04 13:02:21 +01:00
Lennart Poettering
7c2a025984 homed: don't wait indefinitely for workers on exit
Let's put some time-limit on it.

Fixes: #22901
(cherry picked from commit f8f621821a30b5b7e6c69dfb770e1c4cbc3db715)
(cherry picked from commit 202a79e7c506df0606bd17d1c7522bacc776398d)
2022-11-04 13:02:21 +01:00
Jade Bilkey
559e851a95 man: fix static bridge example
A NetDev is needed to create the bridge in order to match the example's description "This creates a bridge..."

(cherry picked from commit bc33789a06e5a727fa4662b0dfcbe02ef7e46687)
(cherry picked from commit 44660d2e12d8fb418307f2a701cd97823618574c)
2022-11-04 13:02:21 +01:00
Lennart Poettering
40cedddab7 log: don't attempt to duplicate closed fd
if the console fd is not open we shouldn#t try to move it out of the 0…2
range.

Fixes: #24535
Alternative-for: #24537
(cherry picked from commit f1ee066840eea748ad4074ac2bc859bb897953b9)
(cherry picked from commit e0dde8a14f8b05b88e1add1abdb68c364913346b)
2022-11-04 13:02:21 +01:00
Daniel Braunwarth
ba29bb342d condition: fix device-tree firmware path
The path /sys/firmware/device-tree doesn't exist. This should be either
/proc/device-tree or /sys/firmware/devicetree.

The first path is only a link. So lets use the second path.

See https://github.com/torvalds/linux/blob/v4.14/drivers/of/base.c#L218.

(cherry picked from commit 1037178acfd093fb10d8f5e74f3072f78afdf7e8)
(cherry picked from commit 254b77e73cb81265146de653563a7fe3f9936b56)
2022-11-04 13:02:21 +01:00
Yu Watanabe
e22632a9da udev-util: minor cleanups for on_ac_power()
Follow-ups for #24420.

(cherry picked from commit 8676bdb70842ebb8d55fcc50774ba69f8a14b51a)
(cherry picked from commit 96da39ddb11cd4ea5514def19480c0b88b4b33f5)
2022-11-04 13:02:21 +01:00
Yu Watanabe
deb03fe7e5 shell-completion: drop unused $mode
Fixes #24473.

(cherry picked from commit c4c9714464a0e8138f247405c3a52bab00f60781)
(cherry picked from commit 49f9fa87b2186fe77c373dc8a8cf6759ff285687)
2022-11-04 13:02:21 +01:00
Zbigniew Jędrzejewski-Szmek
1f5ccc9931 on-ac-power: ignore devices with scope==Device
My mouse is reported as:

P: /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4:1.2/0003:046D:C52B.001E/0003:046D:4051.001F/power_supply/hidpp_battery_4
M: hidpp_battery_4
R: 4
U: power_supply
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4:1.2/0003:046D:C52B.001E/0003:046D:4051.001F/power_supply/hidpp_battery_4
E: SUBSYSTEM=power_supply
E: POWER_SUPPLY_NAME=hidpp_battery_4
E: POWER_SUPPLY_TYPE=Battery
E: POWER_SUPPLY_ONLINE=1
E: POWER_SUPPLY_STATUS=Discharging
E: POWER_SUPPLY_SCOPE=Device
E: POWER_SUPPLY_MODEL_NAME=Wireless Mouse M510
E: POWER_SUPPLY_MANUFACTURER=Logitech
E: POWER_SUPPLY_SERIAL_NUMBER=4051-bc-cd-d2-5b
E: POWER_SUPPLY_CAPACITY_LEVEL=Normal

See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=25a0bc2dfc2ea732f40af2dae52426ead66ae76e
Effectively, "System" and "Unkown" are passed through, "Device" is rejected.

(cherry picked from commit 3c69e94a5ce8076fa1240028f24d9b4ba1b67408)
(cherry picked from commit b00cb050c80e8a8005420020bc1ea8f432992de8)
2022-11-04 13:02:21 +01:00
Zbigniew Jędrzejewski-Szmek
9e62e7facb on-ac-power: rework logic
History of the function:
96788d2aa4f4b0b49874b4a240ce47d9e8485d1b assume system is running on AC power when no battery found
795e86b4f1e8a1fd440f8c817621779c6aedbdb5 ignore USB-C ports in power source mode when detecting system is running on AC power
c19a51bec40ae5e5073464e72411e7920d05d683 invert ac_power() source type check
6d89003462484c8656b698e07b9cf0a337e3818e assume ac when /sys/class/power_supply is missing
240dbaa44f8e5ad51775c776fc3ce9cd2f19f037 add ConditionACPower=

Interestingly, the return condition 'on_ac_power == found_online || !found_offline'
was there from the very beginning, and even Yu's latest change doesn't change this,
but only extends it to 'on_ac_power == found_online || !found_offline || !found_battery'.
This means that any system with no AC power supply will be unconditionally classified
as on_ac_power.

Let's change the logic: if we have an online AC supply, answer is "yes". If no
supplies, but we have a battery, answer is "no". Otherwise, assume "yes", based
on the assumption that presense of a battery would at least be always reported,
even if an AC power supply might not be.

Fixes #24407. It also shouldn't impact previous fixes: assume ac when
/sys/class/power_supply is missing, ignore USB-C ports in power source mode,
assume system is running on AC power when no battery found.

(cherry picked from commit 4a52514b371bf8013e89c421dfc2405a443feef8)
(cherry picked from commit 9886011356f9cd3737263b5bf9070181c7859f26)
2022-11-04 13:02:21 +01:00
Zbigniew Jędrzejewski-Szmek
3ce09d9127 shared/udev-util: say "ignoring device", not "ignoring"
The short form sounds like we're ignoring the error.

(cherry picked from commit 406fbeca32d9abacdcc28b0cc00d2beefcc4feb2)
(cherry picked from commit 6d4c1385347e73fd68466f51eae33dad78a46125)
2022-11-04 13:02:20 +01:00
Zhaofeng Li
86e121dd7b virt: Support detection of Apple Virtualization.framework guests
(cherry picked from commit f5558306746c0791dab666e76d51e7ef1ce38362)
(cherry picked from commit cd2fad23008f1f339625904925e21ccf9147b50a)
2022-11-04 13:02:20 +01:00
Yu Watanabe
85ec3345fc virt: align tables
(cherry picked from commit 5c86cec1f3466b2f4ed169fd3f32e944a0bca06e)
(cherry picked from commit 6e47e75c86965e4f28ac94970116f86b99be8851)
2022-11-04 13:02:20 +01:00
David Jaša
7cb0c3bc99 check-os-release.py compatible with Python < 3.8
The ":=" operator was only added in Python 3.8 so splitting the line with it into two makes check-os-release.py actually fulfill its claim of working with any python version.

(cherry picked from commit ce0a056abc41168e1b45537505ca9f65bf6f5c30)
(cherry picked from commit 951e99231e539c11861d62ce9cfc5b186a3a3e6e)
2022-11-04 13:02:20 +01:00
Yu Watanabe
d59171e362 core/mount: adjust deserialized state based on /proc/self/mountinfo
Fixes #23796.
Replaces #23803 and #23851.

(cherry picked from commit 01400460ae16c6522d11d08dd9a4b0928e7980d9)
(cherry picked from commit d572a74163428e52982ee70844f8cc54c814a741)
2022-11-04 13:02:20 +01:00
Goffredo Baroncelli
eb53ee4a2f Allow uneven length BootXXXX variables
The BootXXXX variables may have an uneven length. Don't return error
in this case.

Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
(cherry picked from commit 046f101bf6ecbe2c18fd969760256ada3e6230f0)
(cherry picked from commit 2e372afc358f50408580323c56a44a7a6284cce0)
2022-11-04 13:02:20 +01:00
Yu Watanabe
5fe4b668cd gpt: fix native uuids for s390x
__s390__ is defined for both s390 and s390x. Hence, we need to define
the native uuids for s390x at first.

(cherry picked from commit 4565246911adbdd1b20d8944c0754772788a768c)
(cherry picked from commit 8ad143e684c57d8fd9801fad3c379253d2cec92f)
2022-11-04 13:02:20 +01:00
Antonio Alvarez Feijoo
683980d551 bash-completion: add systemd-sysext support
(cherry picked from commit aa2118cb0b5478c6b8a30f8c55507ee5d5854943)
(cherry picked from commit cf67d5ed1be38db5ea3f54551f4509ce315f7877)
2022-11-04 13:02:20 +01:00
Antonio Alvarez Feijoo
bff3edb1ca sysext: add missing COMMAND to the help output and man synopsis
(cherry picked from commit 782e41ab8891673575ec03366d17d5e5c1da7b0d)
(cherry picked from commit ada437cfb1e1d8feeecab9f6391561027d5987f1)
2022-11-04 13:02:20 +01:00
Zbigniew Jędrzejewski-Szmek
503ebc858f booctl: do not say uuids differ if one of the uuids is unset
We allow ESP autodetection to fail, e.g. if it is not mounted, but then we'd
say that the detected one is different than the one reported by the bootloader,
which is rather confusing.

While at it, if we actually detect a mismatch, print the two uuids.

(cherry picked from commit 22e54dd6de4d0be41ab70e0a94d7bd273e47c60a)
(cherry picked from commit 4ffde70981b2502cc5c13fffbfe77c72b59b460a)
2022-11-04 13:02:20 +01:00
Luca Boccassi
ef7b17be53 bash-completion: autocomplete cgroup names in systemd-cgtop
(cherry picked from commit 0a152619aca5b6c16d022cc3e6ab2fc3786d0284)
(cherry picked from commit 5219a99ccbaaf3b7a13bec74441443560b3f23fc)
2022-11-04 13:02:20 +01:00
Avram Lubkin
7ca021b87e sysusers: add fsync for passwd (#24324)
https://github.com/systemd/systemd/pull/6636 added `fsync()` when
temporary shadow, group, and gshadow files are created, but it was
not added for passwd. As far as I can tell, this seems to have been
an oversight. I'm seeing real world issues where a blank /etc/passwd
file is being created if a machine loses power early in the boot process.

(cherry picked from commit 19193b489841a7bcccda7122ac0849cf6efe59fd)
(cherry picked from commit 9f2f3911539c453037aecd51f875dfd75ed04113)
2022-11-04 13:02:20 +01:00
Yu Watanabe
c3fcff5291 udev/cdrom_id: check last track info
Fixes off-by-one issue.

Fixes #24306.

(cherry picked from commit 628998ecfa0d39b38874e1aecdb28022f80f3269)
(cherry picked from commit c67a388aeffcdc27ff280f01b7939005f7a9c8e9)
2022-11-04 13:02:20 +01:00
bin456789
da1589db45 firstboot: fix can't overwrite timezone
(cherry picked from commit e56dc320d39ade1795118ebe400308a80511e9c9)
(cherry picked from commit 52c631b02edcd32e4d20bc8c390df54e4cc40fa8)
2022-11-04 13:02:20 +01:00
Lennart Poettering
462b20cbd6 cryptenroll: fix memory leak
(cherry picked from commit 7e196e9aac41da206792d96a16b712dd300b0e82)
(cherry picked from commit f279a6f4d1feceaf32fdc790ae242044bb672a16)
2022-11-04 13:02:20 +01:00
Yu Watanabe
b48a17f13f sd-device-monitor: actually refuse to send invalid devices
Fixes an issue introduced by 9e79123884a36ce095b98d1c0fe247dddf02dbec.

(cherry picked from commit 8bb4989906a1659b0f6adfa03dc7585e294a392b)
(cherry picked from commit 6e1acfe81823b67b6b830d3ae8d0f0184eab8b2f)
2022-11-04 13:02:20 +01:00
Yu Watanabe
02a5c22ec1 sd-device-monitor: fix inversed condition
Fixes an issue introduced by b3d06b9226db96fddb6bb45a4708e2e8d413d91d.

(cherry picked from commit 133d78966fe8b1469e593bd467d9055f7afa5858)
(cherry picked from commit 81339c45e8d3372096599525397a632714da2dd5)
2022-11-04 13:02:20 +01:00
exploide
45e46fb4b2 resolvctl: only remove protocol after last dot when mangling ifname for resolvconf
ifname_resolvconf_mangle is supposed to remove protocol suffixes like .dhcp
from interface names. But this removed also valid parts of the ifname like
VLAN IDs, e.g. enp2s0u4.72.dhcp -> enp2s0u4 instead of enp2s0u4.72

After this change, everything behind the last dot is removed instead of the first.

(cherry picked from commit e8d0eb3915ac33cc0d3da87a836cee6e61645227)
(cherry picked from commit 1760559918c6299a31c4b28a4ce07e5d6322d986)
2022-11-04 13:02:20 +01:00
Yu Watanabe
2aeff0f39a oom: drop invalid %m in the log message
Fixes https://github.com/systemd/systemd/issues/23785#issuecomment-1210030100.

(cherry picked from commit b6f6df4cb07ebf736f0f4b60a845049306088797)
(cherry picked from commit a3348ba748e17d18e2bbf56776cdb1b331cd4525)
2022-11-04 13:02:20 +01:00
Jan Janssen
658013a7f7 meson: Test correct efi linker for supported args
Fixes: #24241
(cherry picked from commit 6a941db798e3c5d896f6732afb4e6e482d708900)
Closes https://github.com/systemd/systemd-stable/issues/216
(cherry picked from commit b3dd66f32beb1e2daea31c73ce4c3b4c4ad844fb)
2022-11-04 13:02:20 +01:00
Luca BRUNO
3733943f5a sysusers: properly process user entries with an explicit GID
This tweaks user creation logic to properly take into consideration
an explicitly requested GID.
It fixes a bug where the creation flow would mistakenly fall back
to use the username instead, resulting in wrong lookups in case of
users and groups using the same name.

(cherry picked from commit 5ed47c4d230b9491339c16c6ea4181dfd293bc98)
(cherry picked from commit f9d936b86561c23f5b40211254544b91e33eae7a)
2022-11-04 13:02:20 +01:00
Luca BRUNO
6ab318435e sysusers: only check whether the requested GID is available
This relaxes the availability check when creating a group, if an
explicit GID has been requested.
It avoids mixing up users and groups entries with valid and unique
UIDs/GIDs, but each having the same ID number.

(cherry picked from commit 6b6e45eb7386bb4399746b70f6f606caea450fed)
(cherry picked from commit ec5a46ca341f4f62779a54385ba7cae6a1dfcdb3)
2022-11-04 13:02:20 +01:00
Yu Watanabe
887837a5a9 dhcp: fix potential buffer overflow
Fixes a bug introduced by 324f818781a250b60f2fcfa74ff1c9101d2d1315.

This also renames several macros for DHCP packet size.

(cherry picked from commit 4473cd7f61b9eb0860f2daab81491ad2145d554b)
(cherry picked from commit 037b1a8acc50cbeeebb82f95594a4909375577c2)
2022-11-04 13:02:20 +01:00
Yu Watanabe
647c44c21a udev-util: assume system is running on AC power when no battery found
Fixes #24214.

(cherry picked from commit 96788d2aa4f4b0b49874b4a240ce47d9e8485d1b)
(cherry picked from commit ed2955f8fe194040c3b29fb58e6dc02d397d79d5)
2022-11-04 13:02:20 +01:00