From 0d67f44198daa829d947436884e00f2030642136 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 10 May 2023 10:29:58 +0300 Subject: [PATCH 1/3] Eliminate redundant and obsolete cruft from dnf_keyring_add_public_key() These APIs have been obsolete for years and now removed in rpm 4.19. Luckily the usage here is entirely redundant, rpmKeyringAddKey() checks for duplicates and that case is even handled in this code. --- libdnf/dnf-keyring.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/libdnf/dnf-keyring.cpp b/libdnf/dnf-keyring.cpp index 550d5ce2..a8fdb993 100644 --- a/libdnf/libdnf/dnf-keyring.cpp +++ b/libdnf/libdnf/dnf-keyring.cpp @@ -63,7 +63,6 @@ dnf_keyring_add_public_key(rpmKeyring keyring, int rc; gsize len; pgpArmor armor; - pgpDig dig = NULL; rpmPubkey pubkey = NULL; rpmPubkey *subkeys = NULL; int nsubkeys = 0; @@ -116,16 +115,7 @@ dnf_keyring_add_public_key(rpmKeyring keyring, goto out; } - /* does the key exist in the keyring */ - dig = rpmPubkeyDig(pubkey); - rc = rpmKeyringLookup(keyring, dig); - if (rc == RPMRC_OK) { - ret = TRUE; - g_debug("%s is already present", filename); - goto out; - } - - /* add to rpmdb automatically, without a prompt */ + /* add to in-memory keyring */ rc = rpmKeyringAddKey(keyring, pubkey); if (rc == 1) { ret = TRUE; @@ -169,8 +159,6 @@ out: } free(subkeys); } - if (dig != NULL) - pgpFreeDig(dig); return ret; } CATCH_TO_GERROR(FALSE) -- 2.41.0.rc1