summaryrefslogtreecommitdiff
path: root/lib/rpmts.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-05-23 11:54:08 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-05-23 17:07:34 +0300
commit3a9ff8fc41dcf3fc5b4ca3eff42d389ec35c1089 (patch)
treea2e7699a2c992859264e8694a3239735f3b2d6ea /lib/rpmts.c
parent9c209c8a2de5adb741f90c37a59c99d3578f4bdf (diff)
downloadlibrpm-tizen-3a9ff8fc41dcf3fc5b4ca3eff42d389ec35c1089.tar.gz
librpm-tizen-3a9ff8fc41dcf3fc5b4ca3eff42d389ec35c1089.tar.bz2
librpm-tizen-3a9ff8fc41dcf3fc5b4ca3eff42d389ec35c1089.zip
Convert rpmtsFindPubkey() to new headerGet() interface
Diffstat (limited to 'lib/rpmts.c')
-rw-r--r--lib/rpmts.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/rpmts.c b/lib/rpmts.c
index f80cd1749..d333db783 100644
--- a/lib/rpmts.c
+++ b/lib/rpmts.c
@@ -300,18 +300,20 @@ fprintf(stderr, "*** free pkt %p[%d] id %08x %08x\n", ts->pkpkt, ts->pkpktlen, p
/* Retrieve the pubkey that matches the signature. */
mi = rpmtsInitIterator(ts, RPMTAG_PUBKEYS, sigp->signid, sizeof(sigp->signid));
while ((h = rpmdbNextIterator(mi)) != NULL) {
- const char ** pubkeys;
- rpmTagType pt;
- rpm_count_t pc;
+ struct rpmtd_s pubkeys;
- if (!headerGetEntry(h, RPMTAG_PUBKEYS, &pt, (rpm_data_t *)&pubkeys, &pc))
+ if (!headerGet(h, RPMTAG_PUBKEYS, &pubkeys, HEADERGET_MINMEM))
continue;
hx = rpmdbGetIteratorOffset(mi);
- ix = rpmdbGetIteratorFileNum(mi);
- if (ix >= pc
- || b64decode(pubkeys[ix], (void **) &ts->pkpkt, &ts->pkpktlen))
- ix = -1;
- pubkeys = headerFreeData(pubkeys, pt);
+ ix = rpmtdSetIndex(&pubkeys, rpmdbGetIteratorFileNum(mi));
+
+ if (ix >= 0) {
+ const char *key = rpmtdGetString(&pubkeys);
+ if (b64decode(key, (void **) &ts->pkpkt, &ts->pkpktlen)) {
+ ix = -1;
+ }
+ }
+ rpmtdFreeData(&pubkeys);
break;
}
mi = rpmdbFreeIterator(mi);