From: Lennart Poettering Date: Mon, 18 Oct 2021 12:58:36 +0000 (+0200) Subject: homework: make PasswordCache const wherever we can X-Git-Tag: v250-rc1~482^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=37a1bf7f76c5a58a3f3dac3241d1ba292d370b42;p=thirdparty%2Fsystemd.git homework: make PasswordCache const wherever we can --- diff --git a/src/home/homework-fscrypt.c b/src/home/homework-fscrypt.c index 37903b8fff6..899d4e10c6c 100644 --- a/src/home/homework-fscrypt.c +++ b/src/home/homework-fscrypt.c @@ -280,7 +280,7 @@ static int fscrypt_setup( int home_setup_fscrypt( UserRecord *h, - PasswordCache *cache, + const PasswordCache *cache, HomeSetup *setup) { _cleanup_(erase_and_freep) void *volume_key = NULL; @@ -584,7 +584,7 @@ int home_create_fscrypt( int home_passwd_fscrypt( UserRecord *h, HomeSetup *setup, - PasswordCache *cache, /* the passwords acquired via PKCS#11/FIDO2 security tokens */ + const PasswordCache *cache, /* the passwords acquired via PKCS#11/FIDO2 security tokens */ char **effective_passwords /* new passwords */) { _cleanup_(erase_and_freep) void *volume_key = NULL; diff --git a/src/home/homework-fscrypt.h b/src/home/homework-fscrypt.h index d8e0b8a2d13..736bcb9dcd9 100644 --- a/src/home/homework-fscrypt.h +++ b/src/home/homework-fscrypt.h @@ -4,7 +4,7 @@ #include "homework.h" #include "user-record.h" -int home_setup_fscrypt(UserRecord *h, PasswordCache *cache, HomeSetup *setup); +int home_setup_fscrypt(UserRecord *h, const PasswordCache *cache, HomeSetup *setup); int home_create_fscrypt(UserRecord *h, char **effective_passwords, UserRecord **ret_home); -int home_passwd_fscrypt(UserRecord *h, HomeSetup *setup, PasswordCache *cache, char **effective_passwords); +int home_passwd_fscrypt(UserRecord *h, HomeSetup *setup, const PasswordCache *cache, char **effective_passwords); diff --git a/src/home/homework-luks.c b/src/home/homework-luks.c index 7185b68ef5a..48ac20c9666 100644 --- a/src/home/homework-luks.c +++ b/src/home/homework-luks.c @@ -384,7 +384,7 @@ static int luks_setup( static int luks_open( const char *dm_name, char **passwords, - PasswordCache *cache, + const PasswordCache *cache, struct crypt_device **ret, sd_id128_t *ret_found_uuid, void **ret_volume_key, @@ -1952,7 +1952,7 @@ static int home_truncate( int home_create_luks( UserRecord *h, - PasswordCache *cache, + const PasswordCache *cache, char **effective_passwords, UserRecord **ret_home) { @@ -3014,7 +3014,7 @@ int home_resize_luks( int home_passwd_luks( UserRecord *h, HomeSetup *setup, - PasswordCache *cache, /* the passwords acquired via PKCS#11/FIDO2 security tokens */ + const PasswordCache *cache, /* the passwords acquired via PKCS#11/FIDO2 security tokens */ char **effective_passwords /* new passwords */) { size_t volume_key_size, max_key_slots, n_effective; @@ -3179,7 +3179,7 @@ static int luks_try_resume( return -ENOKEY; } -int home_unlock_luks(UserRecord *h, PasswordCache *cache) { +int home_unlock_luks(UserRecord *h, const PasswordCache *cache) { _cleanup_free_ char *dm_name = NULL, *dm_node = NULL; _cleanup_(sym_crypt_freep) struct crypt_device *cd = NULL; char **list; diff --git a/src/home/homework-luks.h b/src/home/homework-luks.h index 1225adafdc4..c9aab9a69e2 100644 --- a/src/home/homework-luks.h +++ b/src/home/homework-luks.h @@ -13,16 +13,16 @@ int home_trim_luks(UserRecord *h); int home_store_header_identity_luks(UserRecord *h, HomeSetup *setup, UserRecord *old_home); -int home_create_luks(UserRecord *h, PasswordCache *cache, char **effective_passwords, UserRecord **ret_home); +int home_create_luks(UserRecord *h, const PasswordCache *cache, char **effective_passwords, UserRecord **ret_home); int home_get_state_luks(UserRecord *h, HomeSetup *setup); int home_resize_luks(UserRecord *h, HomeSetupFlags flags, PasswordCache *cache, HomeSetup *setup, UserRecord **ret_home); -int home_passwd_luks(UserRecord *h, HomeSetup *setup, PasswordCache *cache, char **effective_passwords); +int home_passwd_luks(UserRecord *h, HomeSetup *setup, const PasswordCache *cache, char **effective_passwords); int home_lock_luks(UserRecord *h); -int home_unlock_luks(UserRecord *h, PasswordCache *cache); +int home_unlock_luks(UserRecord *h, const PasswordCache *cache); static inline uint64_t luks_volume_key_size_convert(struct crypt_device *cd) { int k;