summaryrefslogtreecommitdiff
path: root/lib/rpmchecksig.c
diff options
context:
space:
mode:
authorPanu Matilainen <Panu Matilainen pmatilai@redhat.com>2011-07-07 11:55:28 +0300
committerPanu Matilainen <Panu Matilainen pmatilai@redhat.com>2011-07-07 11:55:28 +0300
commit78c95448a16f0c766e1fdd34db861b8150335484 (patch)
tree27e7e5ab638b154839f89a4fe15fd1e862ce3fff /lib/rpmchecksig.c
parente156eac1c8d1703d311277d177ddc0ebba9b187a (diff)
downloadrpm-78c95448a16f0c766e1fdd34db861b8150335484.tar.gz
rpm-78c95448a16f0c766e1fdd34db861b8150335484.tar.bz2
rpm-78c95448a16f0c766e1fdd34db861b8150335484.zip
Further streamline & sanitize lead handling
- Never log anything from rpmLeadRead(), instead return an error message the callers can log if they see fit - Add a return value for the lead type (which is the only bit of info from the lead we sometimes resort to using) - Permit NULL pointers on all return values - Eliminate rpmLeadCheck() and rpmLeadType() from the internal API, these are now combined into rpmLeadRead(). - Fix up the callers: only (re)signing needs the actual lead, signature verification only cares if its valid or not and package reading only wants the type from the lead (annoying but...)
Diffstat (limited to 'lib/rpmchecksig.c')
-rw-r--r--lib/rpmchecksig.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c
index 6927308ab..5b42a857d 100644
--- a/lib/rpmchecksig.c
+++ b/lib/rpmchecksig.c
@@ -268,7 +268,6 @@ static int rpmpkgVerifySigs(rpmKeyring keyring, rpmQueryFlags flags,
pgpDigParams sigp;
Header sigh = NULL;
HeaderIterator hi = NULL;
- rpmlead lead = NULL;
char * msg = NULL;
int res = 1; /* assume failure */
rpmRC rc;
@@ -278,15 +277,9 @@ static int rpmpkgVerifySigs(rpmKeyring keyring, rpmQueryFlags flags,
rpmDigestBundle plbundle = rpmDigestBundleNew();
rpmDigestBundle hdrbundle = rpmDigestBundleNew();
- if ((rc = rpmLeadRead(fd, &lead)) == RPMRC_OK) {
- const char *lmsg = NULL;
- rc = rpmLeadCheck(lead, &lmsg);
- if (rc != RPMRC_OK)
- rpmlog(RPMLOG_ERR, "%s: %s\n", fn, lmsg);
- lead = rpmLeadFree(lead);
- }
-
- if (rc != RPMRC_OK) {
+ if ((rc = rpmLeadRead(fd, NULL, NULL, &msg)) != RPMRC_OK) {
+ rpmlog(RPMLOG_ERR, "%s: %s\n", fn, msg);
+ free(msg);
goto exit;
}