Skip to content

Commit

Permalink
Make flags an optional argument to keystore->import_key
Browse files Browse the repository at this point in the history
This is currently unused, move it last and give it a default
value to avoid callers needing to bother. No functional changes.
  • Loading branch information
pmatilai authored and ffesti committed Oct 28, 2024
1 parent 2e5730c commit ebc4068
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/keystore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ rpmRC keystore_fs::delete_key(rpmtxn txn, rpmPubkey key)
return delete_key(txn, rpmPubkeyFingerprintAsHex(key));
}

rpmRC keystore_fs::import_key(rpmtxn txn, rpmPubkey key, rpmFlags flags, int replace)
rpmRC keystore_fs::import_key(rpmtxn txn, rpmPubkey key, int replace, rpmFlags flags)
{
rpmRC rc = RPMRC_FAIL;
const char *fp = rpmPubkeyFingerprintAsHex(key);
Expand Down Expand Up @@ -199,7 +199,7 @@ rpmRC keystore_rpmdb::delete_key(rpmtxn txn, rpmPubkey key)
return delete_key(txn, rpmPubkeyFingerprintAsHex(key));
}

rpmRC keystore_rpmdb::import_key(rpmtxn txn, rpmPubkey key, rpmFlags flags, int replace)
rpmRC keystore_rpmdb::import_key(rpmtxn txn, rpmPubkey key, int replace, rpmFlags flags)
{
Header h = NULL;
rpmRC rc = RPMRC_FAIL;
Expand Down
6 changes: 3 additions & 3 deletions lib/keystore.hh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace rpm {
class keystore {
public:
virtual rpmRC load_keys(rpmtxn txn, rpmKeyring keyring) = 0;
virtual rpmRC import_key(rpmtxn txn, rpmPubkey key, rpmFlags flags = 0, int replace = 1) = 0;
virtual rpmRC import_key(rpmtxn txn, rpmPubkey key, int replace = 1, rpmFlags flags = 0) = 0;
virtual rpmRC delete_key(rpmtxn txn, rpmPubkey key) = 0;

virtual ~keystore() = default;
Expand All @@ -20,7 +20,7 @@ public:
class keystore_fs : public keystore {
public:
virtual rpmRC load_keys(rpmtxn txn, rpmKeyring keyring);
virtual rpmRC import_key(rpmtxn txn, rpmPubkey key, rpmFlags flags = 0, int replace = 1);
virtual rpmRC import_key(rpmtxn txn, rpmPubkey key, int replace = 1, rpmFlags flags = 0);
virtual rpmRC delete_key(rpmtxn txn, rpmPubkey key);

private:
Expand All @@ -30,7 +30,7 @@ private:
class keystore_rpmdb : public keystore {
public:
virtual rpmRC load_keys(rpmtxn txn, rpmKeyring keyring);
virtual rpmRC import_key(rpmtxn txn, rpmPubkey key, rpmFlags flags = 0, int replace = 1);
virtual rpmRC import_key(rpmtxn txn, rpmPubkey key, int replace = 1, rpmFlags flags = 0);
virtual rpmRC delete_key(rpmtxn txn, rpmPubkey key);

private:
Expand Down
2 changes: 1 addition & 1 deletion lib/rpmts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ rpmRC rpmtxnImportPubkey(rpmtxn txn, const unsigned char * pkt, size_t pktlen)

/* If we dont already have the key, make a persistent record of it */
if (krc == 0) {
rc = ts->keystore->import_key(txn, pubkey, 0, oldkey ? 1 : 0);
rc = ts->keystore->import_key(txn, pubkey, oldkey ? 1 : 0);
} else {
rc = RPMRC_OK; /* already have key */
}
Expand Down

0 comments on commit ebc4068

Please sign in to comment.