summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-04-08 15:36:46 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-04-08 15:36:46 +0300
commitb2cfc89de58d856c4c1c26a3a24b91610b38b243 (patch)
tree60f4f8e93eac8654bfb1d1a64c392e23eac5c4d6 /lib
parent1721614d96499d0cf7bc1a31a133fa1c777aa841 (diff)
downloadrpm-b2cfc89de58d856c4c1c26a3a24b91610b38b243.tar.gz
rpm-b2cfc89de58d856c4c1c26a3a24b91610b38b243.tar.bz2
rpm-b2cfc89de58d856c4c1c26a3a24b91610b38b243.zip
Simplify rpmtsImportPubkey() a bit
Diffstat (limited to 'lib')
-rw-r--r--lib/rpmts.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/rpmts.c b/lib/rpmts.c
index fadd4b605..62eb6aac2 100644
--- a/lib/rpmts.c
+++ b/lib/rpmts.c
@@ -381,7 +381,6 @@ rpmRC rpmtsImportPubkey(const rpmts ts, const unsigned char * pkt, size_t pktlen
char * evr = NULL;
Header h = NULL;
rpmRC rc = RPMRC_FAIL; /* assume failure */
- char * t;
int xx;
if (pkt == NULL || pktlen == 0)
@@ -405,19 +404,9 @@ rpmRC rpmtsImportPubkey(const rpmts ts, const unsigned char * pkt, size_t pktlen
v = pgpHexStr(pubp->signid, sizeof(pubp->signid));
- t = pgpHexStr(pubp->time, sizeof(pubp->time));
-
- n = t = xmalloc(sizeof("gpg()")+8);
- t = stpcpy( stpcpy( stpcpy(t, "gpg("), v+8), ")");
-
- /* FIX: pubp->userid may be NULL */
- u = t = xmalloc(sizeof("gpg()")+strlen(pubp->userid));
- t = stpcpy( stpcpy( stpcpy(t, "gpg("), pubp->userid), ")");
-
- evr = t = xmalloc(sizeof("4X:-")+strlen(v)+strlen(r));
- t = stpcpy(t, (pubp->version == 4 ? "4:" : "3:"));
- t = stpcpy( stpcpy( stpcpy(t, v), "-"), r);
-
+ rasprintf(&n, "gpg(%s)", v+8);
+ rasprintf(&u, "gpg(%s)", pubp->userid ? pubp->userid : "none");
+ rasprintf(&evr, "%d:%s-%s", pubp->version, v, r);
/* Check for pre-existing header. */
/* Build pubkey header. */