From 599371415e232951128f3b8a4db46331d7a16647 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A1n=20Kupec?= Date: Thu, 7 Jan 2010 12:20:54 +0100 Subject: [PATCH] Set SignatureFileChecker context even if the key is unknown (bnc #495977). --- zypp/FileChecker.cc | 3 +++ zypp/FileChecker.h | 1 + zypp/repo/susetags/Downloader.cc | 12 ++++++++---- zypp/repo/yum/Downloader.cc | 16 ++++++++++------ 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/zypp/FileChecker.cc b/zypp/FileChecker.cc index d88243c..f6b7abc 100644 --- a/zypp/FileChecker.cc +++ b/zypp/FileChecker.cc @@ -105,6 +105,9 @@ namespace zypp { } + void SignatureFileChecker::setKeyContext(const KeyContext & keycontext) + { _context = keycontext; } + void SignatureFileChecker::addPublicKey( const Pathname & publickey, const KeyContext & keycontext ) { addPublicKey( PublicKey(publickey), keycontext ); } diff --git a/zypp/FileChecker.h b/zypp/FileChecker.h index 746dd69..65b72b5 100644 --- a/zypp/FileChecker.h +++ b/zypp/FileChecker.h @@ -99,6 +99,7 @@ namespace zypp */ SignatureFileChecker(); + void setKeyContext(const KeyContext & keycontext); /** * add a public key to the list of known keys diff --git a/zypp/repo/susetags/Downloader.cc b/zypp/repo/susetags/Downloader.cc index e83514a..f953c79 100644 --- a/zypp/repo/susetags/Downloader.cc +++ b/zypp/repo/susetags/Downloader.cc @@ -63,13 +63,17 @@ void Downloader::download( MediaSetAccess &media, this->enqueue( OnMediaLocation( key, 1 ).setOptional(true) ); this->start( dest_dir, media ); + + KeyContext context; + context.setRepoInfo(repoInfo()); // only if there is a key in the destination directory if ( PathInfo(dest_dir / key).isExist() ) - { - KeyContext context; - context.setRepoInfo(repoInfo()); sigchecker.addPublicKey(dest_dir + key, context); - } + // set the checker context even if the key is not known (unsigned repo, key + // file missing; bnc #495977) + else + sigchecker.setKeyContext(context); + this->reset(); if ( ! repoInfo().gpgCheck() ) diff --git a/zypp/repo/yum/Downloader.cc b/zypp/repo/yum/Downloader.cc index 587f6e0..a73b72f 100644 --- a/zypp/repo/yum/Downloader.cc +++ b/zypp/repo/yum/Downloader.cc @@ -134,13 +134,17 @@ void Downloader::download( MediaSetAccess &media, this->enqueue( OnMediaLocation(keypath,1).setOptional(true) ); this->start( dest_dir, *_media_ptr); - // only add the key if it exists + + KeyContext context; + context.setRepoInfo(repoInfo()); + // only add the key if it exists if ( PathInfo(dest_dir / keypath).isExist() ) - { - KeyContext context; - context.setRepoInfo(repoInfo()); - sigchecker.addPublicKey(dest_dir + keypath, context); - } + sigchecker.addPublicKey(dest_dir + keypath, context); + // set the checker context even if the key is not known (unsigned repo, key + // file missing; bnc #495977) + else + sigchecker.setKeyContext(context); + this->reset(); if ( ! progress.tick() ) -- 2.7.4