From: Panu Matilainen Date: Fri, 7 Dec 2012 11:54:23 +0000 (+0200) Subject: Ensure correct return code on malformed signature in packages X-Git-Tag: rpm-4.11.0-beta1~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=518514b8d8a7377f89ecc111f6434d4735a5a1f8;p=platform%2Fupstream%2Frpm.git Ensure correct return code on malformed signature in packages - rpmpkgRead() starts with assumed failure, but there are a number of places assigning the return code, and by the time we get to the parsePGPSig() calls its likely to be RPMRC_OK, so the jumps to exit result in "all is well" return code on a signature we couldn't even parse. Oops. - Set the failure status explicitly to fix this fairly nasty regression introduced in commit e8bc3ff5d780f4ee6656c24464402723e5fb04f4, ie rpm >= 4.10. (cherry picked from commit 96a616c6aed4c516789a154af188f005caf23f14) --- diff --git a/lib/package.c b/lib/package.c index 9ce7130..b6bea09 100644 --- a/lib/package.c +++ b/lib/package.c @@ -600,8 +600,10 @@ static rpmRC rpmpkgRead(rpmKeyring keyring, rpmVSFlags vsflags, switch (sigtag) { case RPMSIGTAG_RSA: case RPMSIGTAG_DSA: - if (parsePGPSig(&sigtd, "package", fn, &sig)) + if (parsePGPSig(&sigtd, "package", fn, &sig)) { + rc = RPMRC_FAIL; goto exit; + } /* fallthrough */ case RPMSIGTAG_SHA1: { struct rpmtd_s utd; @@ -619,8 +621,10 @@ static rpmRC rpmpkgRead(rpmKeyring keyring, rpmVSFlags vsflags, case RPMSIGTAG_GPG: case RPMSIGTAG_PGP5: /* XXX legacy */ case RPMSIGTAG_PGP: - if (parsePGPSig(&sigtd, "package", fn, &sig)) + if (parsePGPSig(&sigtd, "package", fn, &sig)) { + rc = RPMRC_FAIL; goto exit; + } /* fallthrough */ case RPMSIGTAG_MD5: /* Legacy signatures need the compressed payload in the digest too. */