summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2021-01-19 09:25:15 +0100
committerLennart Poettering <lennart@poettering.net>2021-01-19 14:38:39 +0100
commitbf108eb9429496c4f1d8b30139136f95687307f1 (patch)
treed70f9b7eced829309dd1a836d753a509d53cc6d4 /src
parentMerge pull request #18294 from ssahani/net-2 (diff)
downloadsystemd-bf108eb9429496c4f1d8b30139136f95687307f1.tar.xz
systemd-bf108eb9429496c4f1d8b30139136f95687307f1.zip
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").
Diffstat (limited to '')
-rw-r--r--src/home/homectl-pkcs11.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/home/homectl-pkcs11.c b/src/home/homectl-pkcs11.c
index c6aaa2e6d6..52cee9a173 100644
--- a/src/home/homectl-pkcs11.c
+++ b/src/home/homectl-pkcs11.c
@@ -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;