diff options
author | jbj <devnull@localhost> | 2002-03-10 15:16:57 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2002-03-10 15:16:57 +0000 |
commit | f5dbab424baea97859d250d5d33d435ddf6ae73e (patch) | |
tree | c3a6812e844eb2c3a1a86bdddccce02b23879711 /lib/rpmchecksig.c | |
parent | f0907e2f267a05348e4f0a6bbe2afde5d4a49c07 (diff) | |
download | librpm-tizen-f5dbab424baea97859d250d5d33d435ddf6ae73e.tar.gz librpm-tizen-f5dbab424baea97859d250d5d33d435ddf6ae73e.tar.bz2 librpm-tizen-f5dbab424baea97859d250d5d33d435ddf6ae73e.zip |
- make --addsign and --resign behave exactly the same.
CVS patchset: 5350
CVS date: 2002/03/10 15:16:57
Diffstat (limited to 'lib/rpmchecksig.c')
-rw-r--r-- | lib/rpmchecksig.c | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c index 2a977bdf4..16b22f168 100644 --- a/lib/rpmchecksig.c +++ b/lib/rpmchecksig.c @@ -139,7 +139,7 @@ static int rpmReSign(/*@unused@*/ rpmTransactionSet ts, FD_t fd = NULL; FD_t ofd = NULL; struct rpmlead lead, *l = &lead; - int sigtype; + int_32 sigtag; const char *rpm, *trpm; const char *sigtarget = NULL; char tmprpm[1024+1]; @@ -205,24 +205,33 @@ static int rpmReSign(/*@unused@*/ rpmTransactionSet ts, nh = headerFree(nh, NULL); } - /* Toss the current signatures and recompute if not --addsign. */ - if (qva->qva_mode != RPMSIGN_ADD_SIGNATURE) { - - (void) headerRemoveEntry(sig, RPMSIGTAG_SIZE); - (void) rpmAddSignature(sig, sigtarget, RPMSIGTAG_SIZE, qva->passPhrase); - (void) headerRemoveEntry(sig, RPMSIGTAG_LEMD5_1); - (void) headerRemoveEntry(sig, RPMSIGTAG_LEMD5_2); - (void) headerRemoveEntry(sig, RPMSIGTAG_MD5); - (void) rpmAddSignature(sig, sigtarget, RPMSIGTAG_MD5, qva->passPhrase); - (void) headerRemoveEntry(sig, RPMSIGTAG_SHA1); - (void) rpmAddSignature(sig, sigtarget, RPMSIGTAG_SHA1, qva->passPhrase); + /* Eliminate broken digest values. */ + (void) headerRemoveEntry(sig, RPMSIGTAG_LEMD5_1); + (void) headerRemoveEntry(sig, RPMSIGTAG_LEMD5_2); + (void) headerRemoveEntry(sig, RPMSIGTAG_BADSHA1_1); + (void) headerRemoveEntry(sig, RPMSIGTAG_BADSHA1_2); - } + /* Toss and recalculate header+payload size and digests. */ + (void) headerRemoveEntry(sig, RPMSIGTAG_SIZE); + (void) rpmAddSignature(sig, sigtarget, RPMSIGTAG_SIZE, qva->passPhrase); + (void) headerRemoveEntry(sig, RPMSIGTAG_MD5); + (void) rpmAddSignature(sig, sigtarget, RPMSIGTAG_MD5, qva->passPhrase); + (void) headerRemoveEntry(sig, RPMSIGTAG_SHA1); + (void) rpmAddSignature(sig, sigtarget, RPMSIGTAG_SHA1, qva->passPhrase); /* If gpg/pgp is configured, replace the signature. */ - if ((sigtype = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY)) > 0) { - (void) headerRemoveEntry(sig, sigtype); - (void) rpmAddSignature(sig, sigtarget, sigtype, qva->passPhrase); + if ((sigtag = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY)) > 0) { + switch (sigtag) { + case RPMSIGTAG_GPG: + (void) headerRemoveEntry(sig, RPMSIGTAG_DSA); + /*@fallthrough@*/ + case RPMSIGTAG_PGP5: + case RPMSIGTAG_PGP: + (void) headerRemoveEntry(sig, RPMSIGTAG_RSA); + break; + } + (void) headerRemoveEntry(sig, sigtag); + (void) rpmAddSignature(sig, sigtarget, sigtag, qva->passPhrase); } /* Reallocate the signature into one contiguous region. */ |