11 #include <zypp/base/String.h> 12 #include <zypp/base/Logger.h> 13 #include <zypp/base/Gettext.h> 33 typedef function<void( const Pathname & file_r )>
PreCheckCB;
60 if ( keyhints.empty() )
62 DBG <<
"Check keyhints: " << keyhints.size() << endl;
64 auto keyRing { getZYpp()->keyRing() };
65 for (
const auto & p : keyhints )
try {
66 const std::string & file { p.first };
67 const std::string & keyid { p.second };
69 if ( keyRing->trustedPublicKeyData( keyid ) ) {
70 DBG <<
"Keyhint is already trusted: " << keyid <<
" (" << file <<
")" << endl;
74 DBG <<
"Keyhint search key " << keyid <<
" (" << file <<
")" << endl;
84 if ( not key.fileProvidesKey( keyid ) ) {
87 if ( not key.fileProvidesKey( keyid ) ) {
89 WAR <<
"Keyhint " << file <<
" does not contain a key with id " << keyid <<
". Skipping it." << endl;
96 keyRing->importKey( key,
false );
97 keyData = keyRing->publicKeyData( keyid );
101 WAR <<
"Keyhint " << keyid <<
" for " << keyData <<
" is not strong enough for auto import. Just caching it." << endl;
105 DBG <<
"Keyhint remember buddy " << keyData << endl;
110 catch (
const std::exception & exp )
113 {
INT <<
"Oops!" << endl; }
114 MIL <<
"Check keyhints done. Buddy keys: " << sigchecker_r.
buddyKeys().size() << endl;
130 WAR <<
"Non implemented" << endl;
138 WAR <<
"Non implemented" << endl;
161 if ( isSigned ||
repoInfo().repoGpgCheckIsMandatory() )
165 sigchecker.
signature( destdir_r / sigpath );
168 if (
PathInfo(destdir_r / keypath).isExist() )
176 if ( masterIndex_r.
basename() ==
"repomd.xml" ) {
184 catch (
const std::exception & exp )
187 {
INT <<
"Oops!" << endl; }
194 WAR <<
"Accept unsigned repository because repoGpgCheck is not mandatory for " <<
repoInfo().
alias() << endl;
199 WAR <<
"Signature checking disabled in config of repository " <<
repoInfo().
alias() << endl;
203 start( destdir_r, media_r );
bool fileValidated() const
Whether the signature was actually successfully verified.
void checkExtraKeysInRepomd(MediaSetAccess &media_r, const Pathname &destdir_r, const Pathname &repomd_r, SignatureFileChecker &sigchecker_r)
Checks for nothing Used as the default checker.
void defaultDownloadMasterIndex(MediaSetAccess &media_r, const Pathname &destdir_r, const Pathname &masterIndex_r)
Common workflow downloading a (signed) master index file.
static ZConfig & instance()
Singleton ctor.
Checks for the validity of a signature.
void addPublicKey(const PublicKey &publickey_r)
Add a public key to the list of known keys.
Store and operate with byte count.
Class representing one GPG Public Keys data.
Pathname pubkeyCachePath() const
Path where the pubkey caches.
void operator()(const Pathname &file_r) const
Call KeyRing::verifyFileSignatureWorkflow to verify the file.
Pathname extend(const std::string &r) const
Append string r to the last component of the path.
What is known about a repository.
static const Unit MB
1000^2 Byte
std::string basename() const
Return the last component of this path.
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
void setValidRepoSignature(TriBool value_r)
Set the value for validRepoSignature (or indeterminate if unsigned).
const KeyContext & keyContext() const
KeyContext passed to callbacks
void setMediaSetAccess(MediaSetAccess &media)
Sets the media set access that will be used to precache and to download the files when start is calle...
Pathname repoManagerRoot() const
The RepoManager root directory.
void start(const Pathname &dest_dir, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
start the transfer to a destination directory dest_dir The media has to be provides with setMediaSetA...
const Pathname & signature() const
Detached signature or empty.
std::string alias() const
unique identifier for this source.
bool isExist() const
Return whether valid stat info exists.
std::vector< std::pair< std::string, std::string > > keyhints() const
gpg key hits shipped in keywords (bsc#1184326)
void reset()
Reset the transfer (jobs) list.
Interim helper class to collect global options and settings.
void setMetadataPath(const Pathname &path)
Set the path where the local metadata is stored.
int hardlinkCopy(const Pathname &oldpath, const Pathname &newpath)
Create newpath as hardlink or copy of oldpath.
const RepoInfo & repoInfo() const
const BuddyKeys & buddyKeys() const
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).
Reads through a repomd.xml file and collects type, location, checksum and other data about metadata f...
Base class for Exception.
static bool isSafeKeyId(const std::string &id_r)
!<
virtual void download(MediaSetAccess &media, const Pathname &dest_dir, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Download metadata to a local directory.
Wrapper class for ::stat/::lstat.
Interface of repomd.xml file reader.
Track changing files or directories.
static PublicKey noThrow(const Pathname &keyFile_r)
Static ctor returning an empty PublicKey rather than throwing.
function< void(const Pathname &file)> FileChecker
Functor signature used to check files.
virtual RepoStatus status(MediaSetAccess &media)
Status of the remote repository.
void enqueue(const OnMediaLocation &resource, const FileChecker &checker=FileChecker())
Enqueue a object for transferal, they will not be transferred until start() is called.
void addBuddyKey(std::string sid_r)
Easy-to use interface to the ZYPP dependency resolver.