From ebc406862053815528c00095f9f991d649fa33a0 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 28 Oct 2024 13:54:07 +0200 Subject: [PATCH] Make flags an optional argument to keystore->import_key This is currently unused, move it last and give it a default value to avoid callers needing to bother. No functional changes. --- lib/keystore.cc | 4 ++-- lib/keystore.hh | 6 +++--- lib/rpmts.cc | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/keystore.cc b/lib/keystore.cc index 01fc81cee6..a3f7f1b777 100644 --- a/lib/keystore.cc +++ b/lib/keystore.cc @@ -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); @@ -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; diff --git a/lib/keystore.hh b/lib/keystore.hh index f031c99afb..2511b5f95b 100644 --- a/lib/keystore.hh +++ b/lib/keystore.hh @@ -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; @@ -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: @@ -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: diff --git a/lib/rpmts.cc b/lib/rpmts.cc index d40473cd7d..cb894af532 100644 --- a/lib/rpmts.cc +++ b/lib/rpmts.cc @@ -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 */ }