RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson
Root: /v/rpm/cvs Email: jbj@rpm5.org
Module: rpm Date: 13-Oct-2007 10:42:08
Branch: HEAD Handle: 2007101309420701
Modified files:
rpm CHANGES
rpm/lib librpm.vers package.c rpmchecksig.c rpmts.h
rpm/rpmdb librpmdb.vers pkgio.c
rpm/rpmio rpmpgp.c
Log:
- jbj: eliminate rpmtsSetSig(), use pgpSetSig() instead.
- jbj: fix: trade a double free for a ~100b/header memleak.
Summary:
Revision Changes Path
1.1683 +2 -0 rpm/CHANGES
1.21 +0 -1 rpm/lib/librpm.vers
2.170 +1 -1 rpm/lib/package.c
1.153 +5 -5 rpm/lib/rpmchecksig.c
2.81 +0 -13 rpm/lib/rpmts.h
1.20 +0 -1 rpm/rpmdb/librpmdb.vers
1.16 +3 -15 rpm/rpmdb/pkgio.c
2.62 +2 -1 rpm/rpmio/rpmpgp.c
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.1682 -r1.1683 CHANGES
--- rpm/CHANGES 13 Oct 2007 07:26:37 -0000 1.1682
+++ rpm/CHANGES 13 Oct 2007 08:42:07 -0000 1.1683
@@ -1,4 +1,6 @@
4.5 -> 5.0:
+ - jbj: eliminate rpmtsSetSig(), use pgpSetSig() instead.
+ - jbj: fix: trade a double free for a ~100b/header memleak.
- jbj: fprint.c: use headerGetExtension everywhere.
- jbj: hdrNVR.c: use headerGetExtension everywhere.
- jbj: pkgio.c: use headerGetExtension everywhere.
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/librpm.vers
============================================================================
$ cvs diff -u -r1.20 -r1.21 librpm.vers
--- rpm/lib/librpm.vers 30 Sep 2007 22:38:28 -0000 1.20
+++ rpm/lib/librpm.vers 13 Oct 2007 08:42:08 -0000 1.21
@@ -379,7 +379,6 @@
rpmtsSetRelocateElement;
rpmtsSetRootDir;
rpmtsSetScriptFd;
- rpmtsSetSig;
rpmtsSetSolveCallback;
rpmtsSetSpec;
rpmtsSetTid;
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/package.c
============================================================================
$ cvs diff -u -r2.169 -r2.170 package.c
--- rpm/lib/package.c 11 Oct 2007 19:44:22 -0000 2.169
+++ rpm/lib/package.c 13 Oct 2007 08:42:08 -0000 2.170
@@ -352,7 +352,7 @@
goto exit;
}
/*@-noeffect@*/
- (void) rpmtsSetSig(ts, sigtag, sigtype, sig, siglen);
+ xx = pgpSetSig(rpmtsDig(ts), sigtag, sigtype, sig, siglen);
/*@=noeffect@*/
switch (sigtag) {
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmchecksig.c
============================================================================
$ cvs diff -u -r1.152 -r1.153 rpmchecksig.c
--- rpm/lib/rpmchecksig.c 11 Oct 2007 19:44:22 -0000 1.152
+++ rpm/lib/rpmchecksig.c 13 Oct 2007 08:42:08 -0000 1.153
@@ -882,19 +882,19 @@
if (sigh != NULL)
for (hi = headerInitIterator(sigh);
headerNextIterator(hi, &sigtag, &sigtype, &sig, &siglen) != 0;
- /*@-noeffect@*/(void) rpmtsSetSig(ts, sigtag, sigtype, NULL, siglen)/*@=noeffect@*/)
+ /*@-noeffect@*/ xx = pgpSetSig(rpmtsDig(ts), 0, 0, NULL, 0) /*@=noeffect@*/)
{
if (sig == NULL) /* XXX can't happen */
continue;
-/*@-noeffect@*/
- (void) rpmtsSetSig(ts, sigtag, sigtype, sig, siglen);
-/*@=noeffect@*/
-
/* Clean up parameters from previous sigtag. */
pgpCleanDig(dig);
+/*@-noeffect@*/
+ xx = pgpSetSig(rpmtsDig(ts), sigtag, sigtype, sig, siglen);
+/*@=noeffect@*/
+
switch (sigtag) {
case RPMSIGTAG_RSA:
case RPMSIGTAG_DSA:
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmts.h
============================================================================
$ cvs diff -u -r2.80 -r2.81 rpmts.h
--- rpm/lib/rpmts.h 7 Oct 2007 14:00:13 -0000 2.80
+++ rpm/lib/rpmts.h 13 Oct 2007 08:42:08 -0000 2.81
@@ -687,19 +687,6 @@
/*@modifies ts @*/;
/** \ingroup rpmts
- * Set signature tag info, i.e. from header.
- * @param ts transaction set
- * @param sigtag signature tag
- * @param sigtype signature tag type
- * @param sig signature tag data
- * @param siglen signature tag data length
- * @return 0 always
- */
-int rpmtsSetSig(rpmts ts, int_32 sigtag, int_32 sigtype,
- /*@kept@*/ /*@null@*/ const void * sig, int_32 siglen)
- /*@*/;
-
-/** \ingroup rpmts
* Get OpenPGP packet parameters, i.e. signature/pubkey constants.
* @param ts transaction set
* @return signature/pubkey constants.
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/librpmdb.vers
============================================================================
$ cvs diff -u -r1.19 -r1.20 librpmdb.vers
--- rpm/rpmdb/librpmdb.vers 30 Sep 2007 22:38:30 -0000 1.19
+++ rpm/rpmdb/librpmdb.vers 13 Oct 2007 08:42:08 -0000 1.20
@@ -94,7 +94,6 @@
rpmtsGetRdb;
rpmtsOp;
rpmtsPubkey;
- rpmtsSetSig;
rpmVerifySignature;
sqlitevec;
XrpmdbLink;
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/pkgio.c
============================================================================
$ cvs diff -u -r1.15 -r1.16 pkgio.c
--- rpm/rpmdb/pkgio.c 13 Oct 2007 00:27:17 -0000 1.15
+++ rpm/rpmdb/pkgio.c 13 Oct 2007 08:42:08 -0000 1.16
@@ -287,20 +287,6 @@
return ts->dig;
}
-int rpmtsSetSig(rpmts ts,
- int_32 sigtag, int_32 sigtype, const void * sig, int_32 siglen)
-{
- int ret = 0;
- if (ts != NULL) {
- const void * osig = pgpGetSig(rpmtsDig(ts));
-/*@-modobserver -observertrans -dependenttrans @*/ /* FIX: pgpSetSig() lazy free. */
- osig = _free(osig);
-/*@=modobserver =observertrans =dependenttrans @*/
- ret = pgpSetSig(rpmtsDig(ts), sigtag, sigtype, sig, siglen);
- }
- return ret;
-}
-
void rpmtsCleanDig(rpmts ts)
{
if (ts && ts->dig) {
@@ -310,7 +296,7 @@
opx = RPMTS_OP_SIGNATURE;
(void) rpmswAdd(rpmtsOp(ts, opx), pgpStatsAccumulator(ts->dig, opx));
/*@-noeffect@*/
- (void) rpmtsSetSig(ts, 0, 0, NULL, 0); /* XXX headerFreeData */
+ (void) pgpSetSig(ts->dig, 0, 0, NULL, 0); /* move to pgpFreeDig? */
/*@=noeffect@*/
ts->dig = pgpFreeDig(ts->dig);
}
@@ -1066,8 +1052,10 @@
/* XXX headerCheck can recurse, free info only at top level. */
if (hclvl == 1)
rpmtsCleanDig(ts);
+#ifdef DYING
if (info->tag == RPMTAG_SHA1HEADER)
sig = _free(sig);
+#endif
hclvl--;
return rc;
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmpgp.c
============================================================================
$ cvs diff -u -r2.61 -r2.62 rpmpgp.c
--- rpm/rpmio/rpmpgp.c 6 Oct 2007 21:33:50 -0000 2.61
+++ rpm/rpmio/rpmpgp.c 13 Oct 2007 08:42:08 -0000 2.62
@@ -1151,7 +1151,8 @@
int32_t sigtag, int32_t sigtype, const void * sig, int32_t siglen)
{
if (dig != NULL) {
- /* XXX lazy free? */
+ if (dig->sig)
+ dig->sig = _free(dig->sig);
dig->sigtag = sigtag;
dig->sigtype = (sig ? sigtype : 0);
/*@-assignexpose -kepttrans@*/
@@ .
Received on Sat Oct 13 10:42:08 2007