Skip to content

Commit

Permalink
Eliminate redundant and obsolete cruft from dnf_keyring_add_public_key()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pmatilai authored and jan-kolarik committed May 15, 2023
1 parent a283cc4 commit 0d67f44
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions libdnf/dnf-keyring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -169,8 +159,6 @@ dnf_keyring_add_public_key(rpmKeyring keyring,
}
free(subkeys);
}
if (dig != NULL)
pgpFreeDig(dig);
return ret;
} CATCH_TO_GERROR(FALSE)

Expand Down

0 comments on commit 0d67f44

Please sign in to comment.