diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-04-08 15:36:46 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-04-08 15:36:46 +0300 |
commit | b2cfc89de58d856c4c1c26a3a24b91610b38b243 (patch) | |
tree | 60f4f8e93eac8654bfb1d1a64c392e23eac5c4d6 /lib | |
parent | 1721614d96499d0cf7bc1a31a133fa1c777aa841 (diff) | |
download | rpm-b2cfc89de58d856c4c1c26a3a24b91610b38b243.tar.gz rpm-b2cfc89de58d856c4c1c26a3a24b91610b38b243.tar.bz2 rpm-b2cfc89de58d856c4c1c26a3a24b91610b38b243.zip |
Simplify rpmtsImportPubkey() a bit
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rpmts.c | 17 |
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. */ |