Author: jkupec Date: Thu Jun 19 11:14:14 2008 New Revision: 10394 URL: http://svn.opensuse.org/viewcvs/zypp?rev=10394&view=rev Log: - zypp-refresh: don't accept files with GPG problems (bnc #398530), report an error instead Modified: branches/SuSE-Linux-11_0-Branch/zypper/src/checkpatches-keyring-callbacks.h branches/SuSE-Linux-11_0-Branch/zypper/src/zypp-refresh.cc Modified: branches/SuSE-Linux-11_0-Branch/zypper/src/checkpatches-keyring-callbacks.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-11_0-Branch/zypper/src/checkpatches-keyring-callbacks.h?rev=10394&r1=10393&r2=10394&view=diff ============================================================================== --- branches/SuSE-Linux-11_0-Branch/zypper/src/checkpatches-keyring-callbacks.h (original) +++ branches/SuSE-Linux-11_0-Branch/zypper/src/checkpatches-keyring-callbacks.h Thu Jun 19 11:14:14 2008 @@ -29,7 +29,8 @@ static bool readCallbackAnswer() { - return true; + // bnc #398530 + return false; } /////////////////////////////////////////////////////////////////// Modified: branches/SuSE-Linux-11_0-Branch/zypper/src/zypp-refresh.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-11_0-Branch/zypper/src/zypp-refresh.cc?rev=10394&r1=10393&r2=10394&view=diff ============================================================================== --- branches/SuSE-Linux-11_0-Branch/zypper/src/zypp-refresh.cc (original) +++ branches/SuSE-Linux-11_0-Branch/zypper/src/zypp-refresh.cc Thu Jun 19 11:14:14 2008 @@ -29,6 +29,9 @@ #define ZYPP_REFRESH_LOG "/var/log/zypp-refresh.log" +using namespace std; +using namespace zypp; + // keyring and digest callbacks: accept everything, but don't import any keys /////////////////////////////////////////////////////////////////// @@ -36,7 +39,7 @@ /////////////////////////////////////////////////////////////////// static bool readCallbackAnswer() - { return true; } + { return false; } // bnc #398530 /////////////////////////////////////////////////////////////////// // KeyRingReceive @@ -44,23 +47,23 @@ struct KeyRingReceive : public zypp::callback::ReceiveReportzypp::KeyRingReport { virtual bool askUserToAcceptUnsignedFile( const std::string &file ) - { return readCallbackAnswer(); } - virtual bool askUserToAcceptUnknownKey( const std::string &/*file*/, const std::string &/*id*/ ) - { return readCallbackAnswer(); } + { cerr << ". Error:" << endl << "refusing unsigned file " << file << endl; return readCallbackAnswer(); } + virtual bool askUserToAcceptUnknownKey( const std::string &file, const std::string &id ) + { cerr << ". Error:" << endl << "refusing unknown key, id: '" << id << "' from file '" << file << "'" << endl; return readCallbackAnswer(); } virtual bool askUserToTrustKey( const PublicKey &key ) - { return readCallbackAnswer(); } + { cerr << ". Error:" << endl << "not trusting key '" << key << "'" << endl;return readCallbackAnswer(); } virtual bool askUserToAcceptVerificationFailed( const std::string &file, const PublicKey &key ) - { return readCallbackAnswer(); } + { cerr << ". Error:" << endl << "verification of '" << file << "' with key '" << key << "' failed" << endl; return readCallbackAnswer(); } }; struct DigestReceive : public zypp::callback::ReceiveReportzypp::DigestReport { virtual bool askUserToAcceptNoDigest( const zypp::Pathname &file ) - { return readCallbackAnswer(); } + { cerr << ". Error:" << endl << "refusing file '" << file << "': no digest" << endl; return readCallbackAnswer(); } virtual bool askUserToAccepUnknownDigest( const Pathname &file, const std::string &name ) - { return readCallbackAnswer(); } + { cerr << ". Error:" << endl << "refusing file '" << file << "': unknown digest" << endl; return readCallbackAnswer(); } virtual bool askUserToAcceptWrongDigest( const Pathname &file, const std::string &requested, const std::string &found ) - { return readCallbackAnswer(); } + { cerr << ". Error:" << endl << "refusing file '" << file << "': wrong digest" << endl; return readCallbackAnswer(); } }; /////////////////////////////////////////////////////////////////// }; // namespace zypp @@ -84,9 +87,6 @@ ~DigestCallbacks() { _digestReport.disconnect(); } }; -using namespace std; -using namespace zypp; - int main(int argc, char **argv) { const char *logfile = getenv("ZYPP_LOGFILE"); @@ -153,20 +153,19 @@ try { - cout << "refreshing '" << it->alias() << "' ."; + cout << "refreshing '" << it->alias() << "' ." << flush; manager.refreshMetadata(*it); - cout << "."; + cout << "." << flush; manager.buildCache(*it); cout << ". Done." << endl; } catch (const Exception &excpt_r ) { - cerr << ". Error." << endl; - // translators the first %s is the repository name and the second is an error message cerr + << " Error:" << endl << str::form( - "Could not refresh repository '%s':\n%s", - it->name().c_str(), excpt_r.msg().c_str()) + "Could not refresh repository '%s':\n%s\n%s", + it->name().c_str(), excpt_r.msg().c_str(), excpt_r.historyAsString().c_str()) << endl; ++errcount; } -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org