summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZdenek Prikryl <zprikryl@redhat.com>2009-02-26 12:16:12 +0100
committerZdenek Prikryl <zprikryl@redhat.com>2009-02-26 12:16:12 +0100
commit6276ccfba9ea29d2fc78293968246af9c2e2c800 (patch)
tree3a27dd88f5f8cc8d3f6c395acb3c4377cc8b664c
parent825f406304145d719e9b8b1eeeb70a2d78b7bf9a (diff)
downloadabrt-6276ccfba9ea29d2fc78293968246af9c2e2c800.tar.gz
abrt-6276ccfba9ea29d2fc78293968246af9c2e2c800.tar.xz
abrt-6276ccfba9ea29d2fc78293968246af9c2e2c800.zip
added check for publick key
-rw-r--r--lib/MiddleWare/RPMInfo.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/MiddleWare/RPMInfo.cpp b/lib/MiddleWare/RPMInfo.cpp
index 605f698c..64f0628a 100644
--- a/lib/MiddleWare/RPMInfo.cpp
+++ b/lib/MiddleWare/RPMInfo.cpp
@@ -17,7 +17,12 @@ void CRPMInfo::LoadOpenGPGPublicKey(const std::string& pFileName)
uint8_t* pkt = NULL;
size_t pklen;
pgpKeyID_t keyID;
- pgpReadPkts(pFileName.c_str(), &pkt, &pklen);
+ if (pgpReadPkts(pFileName.c_str(), &pkt, &pklen) != PGPARMOR_PUBKEY)
+ {
+ free(pkt);
+ std::cerr << "CRPMInfo::LoadOpenGPGPublicKey(): Can not load publick key " + pFileName << std::endl;
+ return;
+ }
if (pgpPubkeyFingerprint(pkt, pklen, keyID) == 0)
{
char* fedoraFingerprint = pgpHexStr(keyID, sizeof(keyID));
@@ -26,10 +31,7 @@ void CRPMInfo::LoadOpenGPGPublicKey(const std::string& pFileName)
m_setFingerprints.insert(fedoraFingerprint);
}
}
- if (pkt)
- {
- free(pkt);
- }
+ free(pkt);
}
bool CRPMInfo::CheckFingerprint(const std::string& pPackage)