RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 09-May-2008 15:50:16 Branch: HEAD Handle: 2008050913501600 Modified files: rpm CHANGES rpm/lib rpmchecksig.c Log: - jbj: use loops instead of inline for sigtags (adapted from rpm.org). Summary: Revision Changes Path 1.2327 +1 -0 rpm/CHANGES 1.216 +24 -20 rpm/lib/rpmchecksig.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.2326 -r1.2327 CHANGES --- rpm/CHANGES 9 May 2008 13:29:13 -0000 1.2326 +++ rpm/CHANGES 9 May 2008 13:50:16 -0000 1.2327 @@ -1,5 +1,6 @@ 5.1.0 -> 5.2a0: + - jbj: use loops instead of inline for sigtags (adapted from rpm.org). - jbj: fix: is_selinux_enbled() > 0 is the correct test. - rpm.org: Avoid entirely unnecessary static temp string buffer. - rpm.org: Mask signals while moving rebuilt rpmdb into place. @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmchecksig.c ============================================================================ $ cvs diff -u -r1.215 -r1.216 rpmchecksig.c --- rpm/lib/rpmchecksig.c 2 Apr 2008 20:34:18 -0000 1.215 +++ rpm/lib/rpmchecksig.c 9 May 2008 13:50:16 -0000 1.216 @@ -192,6 +192,7 @@ int deleting = (qva->qva_mode == RPMSIGN_DEL_SIGNATURE); rpmRC rc; int xx; + int i; tmprpm[0] = '\0'; @@ -303,27 +304,28 @@ xx = headerDel(sigh, he, 0); /* Toss and recalculate header+payload size and digests. */ - he->tag = (rpmTag)RPMSIGTAG_SIZE; - xx = headerDel(sigh, he, 0); - xx = rpmAddSignature(sigh, sigtarget, RPMSIGTAG_SIZE, qva->passPhrase); - he->tag = (rpmTag)RPMSIGTAG_MD5; - xx = headerDel(sigh, he, 0); - xx = rpmAddSignature(sigh, sigtarget, RPMSIGTAG_MD5, qva->passPhrase); - he->tag = (rpmTag)RPMSIGTAG_SHA1; - xx = headerDel(sigh, he, 0); - xx = rpmAddSignature(sigh, sigtarget, RPMSIGTAG_SHA1, qva->passPhrase); + { static const uint32_t sigs[] = + { RPMSIGTAG_SIZE, RPMSIGTAG_MD5, RPMSIGTAG_SHA1 }; + int nsigs = sizeof(sigs) / sizeof(sigs[0]); + for (i = 0; i < nsigs; i++) { + he->tag = (rpmTag)sigs[i]; + xx = headerDel(sigh, he, 0); + xx = rpmAddSignature(sigh, sigtarget, he->tag, qva->passPhrase); + if (xx) + goto exit; + } + } - if (deleting) { /* Nuke all the signature tags. */ - he->tag = (rpmTag)RPMSIGTAG_GPG; - xx = headerDel(sigh, he, 0); - he->tag = (rpmTag)RPMSIGTAG_PGP5; - xx = headerDel(sigh, he, 0); - he->tag = (rpmTag)RPMSIGTAG_PGP; - xx = headerDel(sigh, he, 0); - he->tag = (rpmTag)RPMSIGTAG_DSA; - xx = headerDel(sigh, he, 0); - he->tag = (rpmTag)RPMSIGTAG_RSA; - xx = headerDel(sigh, he, 0); + if (deleting) { + /* Nuke all the signature tags. */ + static const uint32_t sigs[] = + { RPMSIGTAG_GPG, RPMSIGTAG_PGP5, RPMSIGTAG_PGP, + RPMSIGTAG_DSA, RPMSIGTAG_RSA }; + int nsigs = sizeof(sigs) / sizeof(sigs[0]); + for (i = 0; i < nsigs; i++) { + he->tag = (rpmTag)sigs[i]; + xx = headerDel(sigh, he, 0); + } } else { /* If gpg/pgp is configured, replace the signature. */ int addsig = 0; sigtag = RPMSIGTAG_GPG; @@ -361,6 +363,8 @@ he->tag = (rpmTag)sigtag; xx = headerDel(sigh, he, 0); xx = rpmAddSignature(sigh, sigtarget, sigtag, qva->passPhrase); + if (xx) + goto exit; /* If package was previously signed, check for same signer. */ memset(newsignid, 0, sizeof(newsignid)); @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org