No rpmdb key import in readony mode (bnc#828672)
authorMichael Andres <ma@suse.de>
Wed, 31 Jul 2013 13:03:50 +0000 (15:03 +0200)
committerMichael Andres <ma@suse.de>
Tue, 27 Aug 2013 16:44:36 +0000 (18:44 +0200)
zypp/ZYppFactory.cc
zypp/target/rpm/RpmDb.cc

index 11a7435..45fc1c2 100644 (file)
@@ -74,6 +74,11 @@ namespace zypp
       MIL << "ZYPP_READONLY promised." <<  endl;
     }
 
+    bool IGotIt()
+    {
+      return active;
+    }
+
     /////////////////////////////////////////////////////////////////
   } // namespace zypp_readonly_hack
   ///////////////////////////////////////////////////////////////////
index c5faac5..cabb17c 100644 (file)
@@ -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<Edition> rpmKeys = pubkeyEditions();