From bbdfd6d46db847e63cd8058612f7c50ea01c0c94 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Wed, 31 Jul 2013 15:03:50 +0200 Subject: [PATCH] No rpmdb key import in readony mode (bnc#828672) --- zypp/ZYppFactory.cc | 5 +++++ zypp/target/rpm/RpmDb.cc | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/zypp/ZYppFactory.cc b/zypp/ZYppFactory.cc index 11a7435..45fc1c2 100644 --- a/zypp/ZYppFactory.cc +++ b/zypp/ZYppFactory.cc @@ -74,6 +74,11 @@ namespace zypp MIL << "ZYPP_READONLY promised." << endl; } + bool IGotIt() + { + return active; + } + ///////////////////////////////////////////////////////////////// } // namespace zypp_readonly_hack /////////////////////////////////////////////////////////////////// diff --git a/zypp/target/rpm/RpmDb.cc b/zypp/target/rpm/RpmDb.cc index c5faac5..cabb17c 100644 --- a/zypp/target/rpm/RpmDb.cc +++ b/zypp/target/rpm/RpmDb.cc @@ -58,6 +58,10 @@ using namespace zypp::filesystem; namespace zypp { + namespace zypp_readonly_hack + { + bool IGotIt(); // in readonly-mode + } namespace target { namespace rpm @@ -1031,6 +1035,13 @@ void RpmDb::importPubkey( const PublicKey & pubkey_r ) { FAILIFNOTINITIALIZED; + // bnc#828672: On the fly key import in READONLY + if ( zypp_readonly_hack::IGotIt() ) + { + WAR << "Key " << pubkey_r << " can not be imported. (READONLY MODE)" << endl; + return; + } + // check if the key is already in the rpm database Edition keyEd( pubkey_r.gpgPubkeyVersion(), pubkey_r.gpgPubkeyRelease() ); set rpmKeys = pubkeyEditions(); -- 2.7.4