1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-13 12:58:20 +03:00

cryptenroll: Fix reading keyfile from socket

systemd-cryptenroll uses the READ_FULL_FILE_CONNECT_SOCKET flag when
reading the keyfile to also allow reading it from a socket. But it also
sets the offset to 0, causing an unnecessary seek to the beginning of
the newly opened keyfile and disables socket support again, as these do
not support seeking.

Disable seeking entirely to remove the unneeded seek and restore support
for reading the keyfile from a socket again as with systemd-cryptsetup.

(cherry picked from commit 0119370cbba902cdb162cc4a1eb2ac8a38058bdd)
(cherry picked from commit d8be85261911f2655f19c668590bece1295aadce)
(cherry picked from commit 065aac178a4beb59f492a0c70b18e639adb62f33)
This commit is contained in:
Felix Riemann 2024-02-02 18:08:52 +01:00 committed by Luca Boccassi
parent c5d0b3e51c
commit 9507df1ac0

View File

@ -531,7 +531,7 @@ static int load_volume_key_keyfile(
r = read_full_file_full(
AT_FDCWD,
arg_unlock_keyfile,
0,
UINT64_MAX,
SIZE_MAX,
READ_FULL_FILE_SECURE|READ_FULL_FILE_WARN_WORLD_READABLE|READ_FULL_FILE_CONNECT_SOCKET,
NULL,