resolvectl: return earlier from openpgp command when OpenSSL support is disabled

When OpenSSL is disabled, string_hashsum_sha256()/_sha224() in
resolve_openpgp() will fail anyway. Let's return earlier.
This commit is contained in:
Yu Watanabe
2025-11-02 16:07:46 +09:00
parent a7807e66b7
commit a47a403ca2
+6
View 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) {