summaryrefslogtreecommitdiff
path: root/lib/rpmchecksig.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2011-04-19 10:32:31 +0300
committerPanu Matilainen <pmatilai@redhat.com>2011-04-19 10:32:31 +0300
commit643626a32e045b44b8a9a863f889f714af408cd9 (patch)
treefe707924d4b01fe463ba5100b198a87acceebecc /lib/rpmchecksig.c
parent92ccb5f822c6b8889dbb784182f5da82f88f6102 (diff)
downloadrpm-643626a32e045b44b8a9a863f889f714af408cd9.tar.gz
rpm-643626a32e045b44b8a9a863f889f714af408cd9.tar.bz2
rpm-643626a32e045b44b8a9a863f889f714af408cd9.zip
Actually handle headerGet() / pgpPrtPkts() failure on signature verify
- Failure to decode the hash algo here would probably trip up something later on in the verification but...
Diffstat (limited to 'lib/rpmchecksig.c')
-rw-r--r--lib/rpmchecksig.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c
index 4937e59f2..850ca6204 100644
--- a/lib/rpmchecksig.c
+++ b/lib/rpmchecksig.c
@@ -270,7 +270,6 @@ static int rpmpkgVerifySigs(rpmKeyring keyring, rpmQueryFlags flags,
HeaderIterator hi = NULL;
char * msg = NULL;
int res = 1; /* assume failure */
- int xx;
rpmRC rc;
int failed = 0;
int nodigests = !(flags & VERIFY_DIGEST);
@@ -317,9 +316,13 @@ static int rpmpkgVerifySigs(rpmKeyring keyring, rpmQueryFlags flags,
/* XXX RSA needs the hash_algo, so decode early. */
if (sigtag == RPMSIGTAG_RSA || sigtag == RPMSIGTAG_PGP ||
sigtag == RPMSIGTAG_DSA || sigtag == RPMSIGTAG_GPG) {
- xx = headerGet(sigh, sigtag, &sigtd, HEADERGET_DEFAULT);
- xx = pgpPrtPkts(sigtd.data, sigtd.count, dig, 0);
- rpmtdFreeData(&sigtd);
+ int xx = -1;
+ if (headerGet(sigh, sigtag, &sigtd, HEADERGET_DEFAULT)) {
+ xx = pgpPrtPkts(sigtd.data, sigtd.count, dig, 0);
+ rpmtdFreeData(&sigtd);
+ }
+ if (xx) goto exit;
+
/* XXX assume same hash_algo in header-only and header+payload */
rpmDigestBundleAdd(plbundle, sigp->hash_algo, RPMDIGEST_NONE);
rpmDigestBundleAdd(hdrbundle, sigp->hash_algo, RPMDIGEST_NONE);