Pass verify sets to rpmpkgRead() instead of flags and keyrings
This is the pre-requisite for post-processing verification results rather than handling them on as they come up, at which point it's often not yet possible to make decisions.
This commit is contained in:
parent
8741e9913f
commit
61d23649cb
|
@ -310,6 +310,7 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp)
|
|||
{
|
||||
rpmVSFlags vsflags = rpmtsVSFlags(ts) | RPMVSF_NEEDPAYLOAD;
|
||||
rpmKeyring keyring = rpmtsGetKeyring(ts, 1);
|
||||
struct rpmvs_s *vs = rpmvsCreate(vsflags, keyring);
|
||||
struct pkgdata_s pkgdata = {
|
||||
.fn = fn ? fn : Fdescr(fd),
|
||||
.rc = RPMRC_OK,
|
||||
|
@ -319,13 +320,14 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp)
|
|||
if (hdrp)
|
||||
*hdrp = NULL;
|
||||
|
||||
rpmRC rc = rpmpkgRead(keyring, vsflags, fd, handlePkgVS, &pkgdata, hdrp);
|
||||
rpmRC rc = rpmpkgRead(vs, fd, handlePkgVS, &pkgdata, hdrp);
|
||||
|
||||
/* If there was a "substatus" (NOKEY in practise), return that instead */
|
||||
if (rc == RPMRC_OK && pkgdata.rc)
|
||||
rc = pkgdata.rc;
|
||||
|
||||
rpmKeyringFree(keyring);
|
||||
rpmvsFree(vs);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ static int vfyCb(struct rpmsinfo_s *sinfo, void *cbdata)
|
|||
return 1;
|
||||
}
|
||||
|
||||
rpmRC rpmpkgRead(rpmKeyring keyring, rpmVSFlags flags, FD_t fd,
|
||||
rpmRC rpmpkgRead(struct rpmvs_s *sigset, FD_t fd,
|
||||
rpmsinfoCb cb, void *cbdata, Header *hdrp)
|
||||
{
|
||||
|
||||
|
@ -162,7 +162,6 @@ rpmRC rpmpkgRead(rpmKeyring keyring, rpmVSFlags flags, FD_t fd,
|
|||
int failed = 0;
|
||||
int leadtype = -1;
|
||||
struct hdrblob_s sigblob, blob;
|
||||
struct rpmvs_s *sigset = rpmvsCreate(flags, keyring);
|
||||
Header h = NULL;
|
||||
Header sigh = NULL;
|
||||
rpmDigestBundle bundle = fdGetBundle(fd, 1); /* freed with fd */
|
||||
|
@ -237,7 +236,6 @@ exit:
|
|||
free(blob.ei);
|
||||
headerFree(h);
|
||||
headerFree(sigh);
|
||||
rpmvsFree(sigset);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -249,10 +247,11 @@ static int rpmpkgVerifySigs(rpmKeyring keyring, rpmVSFlags flags,
|
|||
.verbose = rpmIsVerbose(),
|
||||
};
|
||||
int rc;
|
||||
struct rpmvs_s *vs = rpmvsCreate(flags, keyring);
|
||||
|
||||
rpmlog(RPMLOG_NOTICE, "%s:%s", fn, vd.verbose ? "\n" : "");
|
||||
|
||||
rc = rpmpkgRead(keyring, flags, fd, vfyCb, &vd, NULL);
|
||||
rc = rpmpkgRead(vs, fd, vfyCb, &vd, NULL);
|
||||
|
||||
if (!vd.verbose) {
|
||||
if (vd.seen & RPMSIG_DIGEST_TYPE) {
|
||||
|
@ -265,6 +264,7 @@ static int rpmpkgVerifySigs(rpmKeyring keyring, rpmVSFlags flags,
|
|||
}
|
||||
rpmlog(RPMLOG_NOTICE, " %s\n", rc ? _("NOT OK") : _("OK"));
|
||||
}
|
||||
rpmvsFree(vs);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ int rpmvsVerifyItems(struct rpmvs_s *sis, int range,
|
|||
rpmsinfoCb cb, void *cbdata);
|
||||
|
||||
RPM_GNUC_INTERNAL
|
||||
rpmRC rpmpkgRead(rpmKeyring keyring, rpmVSFlags flags, FD_t fd,
|
||||
rpmRC rpmpkgRead(struct rpmvs_s *vs, FD_t fd,
|
||||
rpmsinfoCb cb, void *cbdata, Header *hdrp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Reference in New Issue