- rework most of rpmdb.c prepatory to implementing duplicates.
- fix: 2 memory leaks in headerSprintf.
- fix: db mire's access out-of-bounds memory.
+ - plug most install mode leaks.
4.0.3 -> 4.0.4:
- solaris: translate i86pc to i386 (#57182).
{ NULL, NULL }
};
#else
+/*@unchecked@*/
+static int badDepsInitialized = 0;
+
/*@unchecked@*/ /*@only@*/ /*@null@*/
static struct badDeps_s * badDeps = NULL;
#endif
/**
+ */
+static void freeBadDeps(void)
+ /*@globals badDeps, badDepsInitialized @*/
+ /*@modifies badDeps, badDepsInitialized @*/
+{
+ if (badDeps) {
+ struct badDeps_s * bdp;
+ for (bdp = badDeps; bdp->pname != NULL && bdp->qname != NULL; bdp++)
+ bdp->pname = _free(bdp->pname);
+ badDeps = _free(badDeps);
+ }
+ badDepsInitialized = 0;
+}
+
+/**
* Check for dependency relations to be ignored.
*
* @param p successor element (i.e. with Requires: )
*/
static int ignoreDep(const transactionElement p,
const transactionElement q)
- /*@*/
+ /*@globals badDeps, badDepsInitialized @*/
+ /*@modifies badDeps, badDepsInitialized @*/
{
struct badDeps_s * bdp;
- static int _initialized = 0;
/*@-globs -mods@*/
- if (!_initialized) {
+ if (!badDepsInitialized) {
char * s = rpmExpand("%{?_dependency_whiteout}", NULL);
const char ** av = NULL;
int ac = 0;
}
av = _free(av);
s = _free(s);
- _initialized++;
+ badDepsInitialized++;
}
/*@=globs =mods@*/
#else
rpmtransClean(ts);
#endif
+ freeBadDeps();
return 0;
}
p->altNEVR = _free(p->altNEVR);
p->str1 = _free(p->str1);
}
+ ps->probs = _free(ps->probs);
}
(void) rpmpsUnlink(ps, "destroy");
/*@-refcounttrans -usereleased@*/
fi->action = FA_UNKNOWN;
fi->flags = 0;
- if (fi->actions == NULL)
+
+if (fi->actions == NULL)
fi->actions = xcalloc(fi->fc, sizeof(*fi->actions));
+
fi->keep_header = (scareMem ? 1 : 0);
/* XXX TR_REMOVED needs CPIO_MAP_{ABSOLUTE,ADDDOT} CPIO_ALL_HARDLINKS */
xx = hge(h, RPMTAG_FILELANGS, NULL, (void **) &fi->flangs, NULL);
xx = hge(h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL);
+
t = xmalloc(fi->fc * 16);
fi->md5s = t;
for (i = 0; i < fi->fc; i++) {
/* XXX TR_REMOVED doesn;t need fmtimes or frdevs */
xx = hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &fi->fmtimes, NULL);
xx = hge(h, RPMTAG_FILERDEVS, NULL, (void **) &fi->frdevs, NULL);
+
fi->replacedSizes = xcalloc(fi->fc, sizeof(*fi->replacedSizes));
xx = hge(h, RPMTAG_FILEUSERNAME, NULL, (void **) &fi->fuser, NULL);
if (fi != NULL)
if (fi->te != NULL && fi->te->type == TR_ADDED) {
Header foo;
+/* XXX DYING */
+if (fi->actions == NULL)
fi->actions = xcalloc(fi->fc, sizeof(*fi->actions));
/*@-compdef@*/ /* FIX: fi-md5s undefined */
foo = relocateFileList(ts, fi, h, fi->actions);
if (ts->sig != NULL)
ts->sig = headerFreeData(ts->sig, ts->sigtype);
+
if (ts->dig != NULL)
ts->dig = pgpFreeDig(ts->dig);
}
ts->order = _free(ts->order);
/*@=type =voidabstract @*/
+ if (ts->pkpkt != NULL)
+ ts->pkpkt = _free(ts->pkpkt);
+ ts->pkpktlen = 0;
+ memset(ts->pksignid, 0, sizeof(ts->pksignid));
+
/*@-nullstate@*/ /* FIX: partial annotations */
rpmtransClean(ts);
/*@=nullstate@*/
ts->probs = NULL;
ts->sig = NULL;
+ ts->pkpkt = NULL;
+ ts->pkpktlen = 0;
+ memset(ts->pksignid, 0, sizeof(ts->pksignid));
ts->dig = NULL;
ts->nrefs = 0;
int_32 sigtype; /*!< Current package signature data type. */
/*@null@*/ const void * sig; /*!< Current package signature. */
int_32 siglen; /*!< Current package signature length. */
+
+/*@only@*/ /*@null@*/
+ const unsigned char * pkpkt;/*!< Current pubkey packet. */
+ size_t pkpktlen; /*!< Current pubkey packet length. */
+ unsigned char pksignid[8]; /*!< Current pubkey fingerprint. */
+
/*@null@*/
struct pgpDig_s * dig; /*!< Current signature/pubkey parametrs. */
{
struct pgpDigParams_s * sigp = NULL;
rpmVerifySignatureReturn res;
- /*@unchecked@*/ /*@only@*/ static const byte * pkpkt = NULL;
- /*@unchecked@*/ static size_t pkpktlen = 0;
- /*@unchecked@*/ static byte pksignid[8];
int xx;
if (ts->sig == NULL || ts->dig == NULL) {
}
sigp = &ts->dig->signature;
- if (pkpkt == NULL || memcmp(sigp->signid, pksignid, sizeof(pksignid))) {
+ if (ts->pkpkt == NULL
+ || memcmp(sigp->signid, ts->pksignid, sizeof(ts->pksignid)))
+ {
int ix = -1;
rpmdbMatchIterator mi;
Header h;
- pkpkt = _free(pkpkt);
- pkpktlen = 0;
- memset(pksignid, 0, sizeof(pksignid));
+ ts->pkpkt = _free(ts->pkpkt);
+ ts->pkpktlen = 0;
+ memset(ts->pksignid, 0, sizeof(ts->pksignid));
/* Make sure the database is open. */
(void) rpmtsOpenDB(ts, ts->dbmode);
continue;
ix = rpmdbGetIteratorFileNum(mi);
if (ix >= pc
- || b64decode(pubkeys[ix], (void **) &pkpkt, &pkpktlen))
+ || b64decode(pubkeys[ix], (void **) &ts->pkpkt, &ts->pkpktlen))
ix = -1;
pubkeys = headerFreeData(pubkeys, pt);
break;
mi = rpmdbFreeIterator(mi);
/* Was a matching pubkey found? */
- if (ix < 0 || pkpkt == NULL) {
+ if (ix < 0 || ts->pkpkt == NULL) {
res = RPMSIG_NOKEY;
goto exit;
}
* Can the pubkey packets be parsed?
* Do the parameters match the signature?
*/
- if (pgpPrtPkts(pkpkt, pkpktlen, NULL, 0)
+ if (pgpPrtPkts(ts->pkpkt, ts->pkpktlen, NULL, 0)
&& ts->dig->signature.pubkey_algo == ts->dig->pubkey.pubkey_algo
#ifdef NOTYET
&& ts->dig->signature.hash_algo == ts->dig->pubkey.hash_algo
#endif
&& !memcmp(ts->dig->signature.signid, ts->dig->pubkey.signid, 8))
{
- pkpkt = _free(pkpkt);
- pkpktlen = 0;
+ ts->pkpkt = _free(ts->pkpkt);
+ ts->pkpktlen = 0;
res = RPMSIG_NOKEY;
goto exit;
}
/* XXX Verify the pubkey signature. */
/* Packet looks good, save the signer id. */
- memcpy(pksignid, sigp->signid, sizeof(pksignid));
+ memcpy(ts->pksignid, sigp->signid, sizeof(ts->pksignid));
rpmMessage(RPMMESS_DEBUG, "========== %s pubkey id %s\n",
(sigp->pubkey_algo == PGPPUBKEYALGO_DSA ? "DSA" :
#ifdef NOTNOW
{
- if (pkpkt == NULL) {
+ if (ts->pkpkt == NULL) {
const char * pkfn = rpmExpand("%{_gpg_pubkey}", NULL);
- if (pgpReadPkts(pkfn, &pkpkt, &pkpktlen) != PGPARMOR_PUBKEY) {
+ if (pgpReadPkts(pkfn, &ts->pkpkt, &ts->pkpktlen) != PGPARMOR_PUBKEY) {
pkfn = _free(pkfn);
res = RPMSIG_NOKEY;
goto exit;
#endif
/* Retrieve parameters from pubkey packet(s). */
- xx = pgpPrtPkts(pkpkt, pkpktlen, ts->dig, 0);
+ xx = pgpPrtPkts(ts->pkpkt, ts->pkpktlen, ts->dig, 0);
/* Do the parameters match the signature? */
if (ts->dig->signature.pubkey_algo == ts->dig->pubkey.pubkey_algo
fi->fstates = NULL;
fi->actions = NULL;
+ psm->fi = fiFree(psm->fi, 1);
(void) fiFree(fi, 0);
/*@-usereleased@*/
fi->magic = TFIMAGIC;
fi->te = p;
fi->record = 0;
(void) fiNew(ts, fi, h, RPMTAG_BASENAMES, 1);
+ psm->fi = rpmfiLink(fi, "tsInstall");
fi->fstates = _free(fi->fstates);
fi->fstates = fstates;
fi->actions = _free(fi->actions);
p->fd = NULL;
/*@=type@*/
}
- (void) fiFree(fi, 0);
/*@switchbreak@*/ break;
case TR_REMOVED:
rpmMessage(RPMMESS_DEBUG, "========== --- %s\n", teGetNEVR(p));
if (psmStage(psm, PSM_PKGERASE))
ourrc++;
}
- (void) fiFree(fi, 0);
/*@switchbreak@*/ break;
}
xx = rpmdbSync(ts->rpmdb);
(void) rpmfiUnlink(psm->fi, "tsInstall");
psm->fi = NULL;
psm->te = NULL;
+ p->fi = fiFree(fi, 1);
}
/*@=branchstate@*/
pi = teFreeIterator(pi);
%define version @VERSION@
Version: %{version}
%{expand: %%define rpm_version %{version}}
-Release: 0.12
+Release: 0.13
Group: System Environment/Base
Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-%{rpm_version}.tar.gz
Copyright: GPL
- rework most of rpmdb.c prepatory to implementing duplicates.
- fix: 2 memory leaks in headerSprintf.
- fix: db mire's access out-of-bounds memory.
+- plug most install mode leaks.
* Fri May 3 2002 Jeff Johnson <jbj@redhat.com> 4.1-0.12
- use DBT_DB_MALLOC to eliminate re-malloc'ing header blobs.
{
if (h != NULL) h->nrefs++;
/*@-modfilesystem@*/
-if (_h_debug > 0 && msg != NULL)
-fprintf(stderr, "--> h %p ++ %d %s at %s:%u\n", h, (h != NULL ? h->nrefs : 0), msg, fn, ln);
+if ((_h_debug > 0 || (h->flags & HEADERFLAG_DEBUG)) && msg != NULL)
+fprintf(stderr, "--> h %p ++ %d blob %p flags %x %s at %s:%u\n", h, (h != NULL ? h->nrefs : 0), (h != NULL ? h->blob : NULL), (h != NULL ? h->flags : 0), msg, fn, ln);
/*@=modfilesystem@*/
/*@-refcounttrans -nullret @*/
return h;
/*@modifies h @*/
{
/*@-modfilesystem@*/
-if (_h_debug > 0 && msg != NULL)
-fprintf(stderr, "--> h %p -- %d %s at %s:%u\n", h, (h != NULL ? h->nrefs : 0), msg, fn, ln);
+if ((_h_debug > 0 || (h->flags & HEADERFLAG_DEBUG)) && msg != NULL)
+fprintf(stderr, "--> h %p -- %d blob %p flags %x %s at %s:%u\n", h, (h != NULL ? h->nrefs : 0), (h != NULL ? h->blob : NULL), (h != NULL ? h->flags : 0), msg, fn, ln);
/*@=modfilesystem@*/
if (h != NULL) h->nrefs--;
return NULL;
#define HEADERFLAG_SORTED (1 << 0) /*!< Are header entries sorted? */
#define HEADERFLAG_ALLOCATED (1 << 1) /*!< Is 1st header region allocated? */
#define HEADERFLAG_LEGACY (1 << 2) /*!< Header came from legacy source? */
+#define HEADERFLAG_DEBUG (1 << 3) /*!< Debug this header? */
/*@refs@*/ int nrefs; /*!< Reference count. */
};
/*@=branchstate@*/
dig->sha1ctx = NULL;
+ mp32bfree(&dig->p);
+ mp32bfree(&dig->q);
+ mp32nfree(&dig->g);
+ mp32nfree(&dig->y);
+ mp32nfree(&dig->hm);
+ mp32nfree(&dig->r);
+ mp32nfree(&dig->s);
+
+ mp32bfree(&dig->rsa_pk.n);
+ mp32nfree(&dig->rsa_pk.e);
+ mp32nfree(&dig->m);
+ mp32nfree(&dig->c);
+ mp32nfree(&dig->hm);
+
dig = _free(dig);
}
return dig;