From 4188f39b6d4f718c2691f6dbf68c9a18cbbcdd3c Mon Sep 17 00:00:00 2001 From: Stanislav Visnovsky Date: Fri, 14 Apr 2006 14:05:49 +0000 Subject: [PATCH] - new callbacks for failing digest --- package/libzypp.changes | 6 ++++++ zypp/Digest.h | 16 ++++++++++++++++ zypp/KeyRing.h | 10 ++++------ zypp/source/susetags/SuseTagsImpl.cc | 13 ++++++++++--- 4 files changed, 36 insertions(+), 9 deletions(-) diff --git a/package/libzypp.changes b/package/libzypp.changes index 4daa04d..1638600 100644 --- a/package/libzypp.changes +++ b/package/libzypp.changes @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Fri Apr 14 16:04:35 CEST 2006 - visnov@suse.cz + +- new callbacks for failing digest +- rev 3098 + +------------------------------------------------------------------- Thu Apr 13 16:59:38 CEST 2006 - kkaempf@suse.de - dont install satisfied resolvables (#165843) diff --git a/zypp/Digest.h b/zypp/Digest.h index 784b478..c02d347 100644 --- a/zypp/Digest.h +++ b/zypp/Digest.h @@ -18,8 +18,24 @@ #include #include +#include +#include + namespace zypp { + + struct DigestReport : public callback::ReportBase + { + virtual bool askUserToAcceptNoDigest( const zypp::Pathname &file ) + { return true; } + virtual bool askUserToAccepUnknownDigest( const Pathname &file, const std::string &name ) + { return true; } + virtual bool askUserToAcceptWrongDigest( const Pathname &file, const std::string &requested, const std::string &found ) + { return true; } + }; + + + /** \brief Compute Message Digests (MD5, SHA1 etc) * * The computation works by initializing the algorithm using create(). This diff --git a/zypp/KeyRing.h b/zypp/KeyRing.h index c012279..3d78035 100644 --- a/zypp/KeyRing.h +++ b/zypp/KeyRing.h @@ -32,15 +32,13 @@ namespace zypp struct KeyRingReport : public callback::ReportBase { virtual bool askUserToAcceptUnsignedFile( const Pathname &file ) - { return true; } + { return false; } virtual bool askUserToAcceptUnknownKey( const Pathname &file, const std::string &keyid, const std::string &keyname ) - { return true; } + { return false; } virtual bool askUserToTrustKey( const std::string &keyid, const std::string &keyname, const std::string &keydetails ) - { return true; } + { return false; } virtual bool askUserToAcceptVerificationFailed( const Pathname &file, const std::string &keyid, const std::string &keyname ) - { return true; } - virtual bool askUserToAcceptFileWithoutChecksum( const zypp::Pathname &file ) - { return true; } + { return false; } }; struct KeyRingSignals : public callback::ReportBase diff --git a/zypp/source/susetags/SuseTagsImpl.cc b/zypp/source/susetags/SuseTagsImpl.cc index fed5b50..e7c1815 100644 --- a/zypp/source/susetags/SuseTagsImpl.cc +++ b/zypp/source/susetags/SuseTagsImpl.cc @@ -407,6 +407,13 @@ namespace zypp else if (!PathInfo(_content_file_sig).isExist() && !PathInfo(_content_file_key).isExist() ) { // old source? + + // verify the content file anyway (with empty signature) + bool valid = getZYpp()->keyRing()->verifyFileSignatureWorkflow( _content_file, Pathname() ); + + // the source is not valid and the user did not want to continue + if (!valid) + ZYPP_THROW (Exception( "Error. Source signature does not validate and user does not want to continue. ")); } else { @@ -458,11 +465,11 @@ namespace zypp CheckSum checksum = _prodImpl->_descr_files_checksums[key]; if (checksum.empty()) { - callback::SendReport report; + callback::SendReport report; - if ( report->askUserToAcceptFileWithoutChecksum(path) ) + if ( report->askUserToAcceptNoDigest(path) ) { - MIL << path << " user accepted unsigned file " << endl; + MIL << path << " user accepted file without a checksum " << endl; return; } -- 2.7.4