]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolvectl: return earlier from openpgp command when OpenSSL support is disabled
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 26 Oct 2025 07:15:56 +0000 (16:15 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 2 Nov 2025 07:07:46 +0000 (16:07 +0900)
When OpenSSL is disabled, string_hashsum_sha256()/_sha224() in
resolve_openpgp() will fail anyway. Let's return earlier.

src/resolve/resolvectl.c

index 4e63565afeb117a9c65da5d56e81610c11b0b64f..478e870a430c37084f3e404e9aeac9d806c34c52 100644 (file)
@@ -1014,6 +1014,7 @@ static int verb_service(int argc, char **argv, void *userdata) {
                 return resolve_service(bus, argv[1], argv[2], argv[3]);
 }
 
+#if HAVE_OPENSSL
 static int resolve_openpgp(sd_bus *bus, const char *address) {
         int r;
 
@@ -1074,8 +1075,10 @@ static int resolve_openpgp(sd_bus *bus, const char *address) {
                         arg_type ?: DNS_TYPE_OPENPGPKEY,
                         /* warn_missing= */ true);
 }
+#endif
 
 static int verb_openpgp(int argc, char **argv, void *userdata) {
+#if HAVE_OPENSSL
         _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
         int r, ret = 0;
 
@@ -1090,6 +1093,9 @@ static int verb_openpgp(int argc, char **argv, void *userdata) {
                 RET_GATHER(ret, resolve_openpgp(bus, *p));
 
         return ret;
+#else
+        return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "OpenSSL support is disabled, cannot query Open PGP keys.");
+#endif
 }
 
 static int resolve_tlsa(sd_bus *bus, const char *family, const char *address) {