1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-28 02:50:16 +03:00

homed: fix build without p11kit

homectl-pkcs11.c: In function 'identity_add_pkcs11_key_data':
homectl-pkcs11.c:155:13: error: implicit declaration of function 'pkcs11_acquire_certificate' [-Werror=implicit-function-declaration]

Restores the P11KIT compile-time test that was removed in 2289a78473282902db1108168df6414ae7d91b2f
("homed: move pkcs11 LUKS glue into shared code").
This commit is contained in:
Florian Westphal 2021-01-19 09:25:15 +01:00 committed by Lennart Poettering
parent 7b5ed18779
commit bf108eb942

View File

@ -142,6 +142,20 @@ int identity_add_token_pin(JsonVariant **v, const char *pin) {
return 1;
}
static int acquire_pkcs11_certificate(
const char *uri,
const char *askpw_friendly_name,
const char *askpw_icon_name,
X509 **ret_cert,
char **ret_pin_used) {
#if HAVE_P11KIT
return pkcs11_acquire_certificate(uri, askpw_friendly_name, askpw_icon_name, ret_cert, ret_pin_used);
#else
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
"PKCS#11 tokens not supported on this build.");
#endif
}
int identity_add_pkcs11_key_data(JsonVariant **v, const char *uri) {
_cleanup_(erase_and_freep) void *decrypted_key = NULL, *encrypted_key = NULL;
_cleanup_(erase_and_freep) char *pin = NULL;
@ -152,7 +166,7 @@ int identity_add_pkcs11_key_data(JsonVariant **v, const char *uri) {
assert(v);
r = pkcs11_acquire_certificate(uri, "home directory operation", "user-home", &cert, &pin);
r = acquire_pkcs11_certificate(uri, "home directory operation", "user-home", &cert, &pin);
if (r < 0)
return r;