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: 07-Oct-2007 16:00:14
Branch: HEAD Handle: 2007100715001201
Modified files:
rpm CHANGES rpmqv.c system.h
rpm/lib package.c rpmchecksig.c rpmts.c rpmts.h
rpm/rpmdb .splintrc hdrinline.h header.c header.h
header_internal.h pkgio.c pkgio.h poptDB.c rpmdb.c
signature.c signature.h
Log:
- mark --initdb and --verifydb code paths for destruction.
splint fiddles.
Summary:
Revision Changes Path
1.1656 +1 -0 rpm/CHANGES
2.166 +2 -0 rpm/lib/package.c
1.149 +3 -1 rpm/lib/rpmchecksig.c
2.105 +11 -5 rpm/lib/rpmts.c
2.80 +2 -3 rpm/lib/rpmts.h
1.8 +3 -9 rpm/rpmdb/.splintrc
1.15 +1 -1 rpm/rpmdb/hdrinline.h
1.67 +3 -0 rpm/rpmdb/header.c
1.26 +3 -3 rpm/rpmdb/header.h
1.20 +1 -0 rpm/rpmdb/header_internal.h
1.12 +21 -8 rpm/rpmdb/pkgio.c
1.5 +3 -4 rpm/rpmdb/pkgio.h
1.8 +4 -0 rpm/rpmdb/poptDB.c
1.165 +12 -6 rpm/rpmdb/rpmdb.c
1.3 +4 -4 rpm/rpmdb/signature.c
1.2 +2 -3 rpm/rpmdb/signature.h
1.127 +8 -0 rpm/rpmqv.c
2.89 +7 -1 rpm/system.h
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.1655 -r1.1656 CHANGES
--- rpm/CHANGES 6 Oct 2007 17:46:46 -0000 1.1655
+++ rpm/CHANGES 7 Oct 2007 14:00:12 -0000 1.1656
@@ -1,4 +1,5 @@
4.5 -> 5.0:
+ - jbj: mark --initdb and --verifydb code paths for destruction.
- jbj: start making miRE abstract and refcounted.
- jbj: convert rel to abs linkto depedency iff directory is known.
- rpm.org: correct typo in comment.
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/package.c
============================================================================
$ cvs diff -u -r2.165 -r2.166 package.c
--- rpm/lib/package.c 4 Oct 2007 07:20:43 -0000 2.165
+++ rpm/lib/package.c 7 Oct 2007 14:00:13 -0000 2.166
@@ -351,7 +351,9 @@
rc = RPMRC_FAIL;
goto exit;
}
+/*@-noeffect@*/
(void) rpmtsSetSig(ts, sigtag, sigtype, sig, siglen);
+/*@=noeffect@*/
switch (sigtag) {
case RPMSIGTAG_RSA:
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmchecksig.c
============================================================================
$ cvs diff -u -r1.148 -r1.149 rpmchecksig.c
--- rpm/lib/rpmchecksig.c 30 Sep 2007 22:38:28 -0000 1.148
+++ rpm/lib/rpmchecksig.c 7 Oct 2007 14:00:13 -0000 1.149
@@ -883,13 +883,15 @@
if (sigh != NULL)
for (hi = headerInitIterator(sigh);
headerNextIterator(hi, &sigtag, &sigtype, &sig, &siglen) != 0;
- (void) rpmtsSetSig(ts, sigtag, sigtype, NULL, siglen))
+ /*@-noeffect@*/(void) rpmtsSetSig(ts, sigtag, sigtype, NULL, siglen)/*@=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);
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmts.c
============================================================================
$ cvs diff -u -r2.104 -r2.105 rpmts.c
--- rpm/lib/rpmts.c 30 Sep 2007 22:38:28 -0000 2.104
+++ rpm/lib/rpmts.c 7 Oct 2007 14:00:13 -0000 2.105
@@ -132,30 +132,36 @@
int rpmtsInitDB(rpmts ts, int dbmode)
{
+#if defined(SUPPORT_INITDB)
void *lock = rpmtsAcquireLock(ts);
int rc = rpmdbInit(ts->rootDir, dbmode);
lock = rpmtsFreeLock(lock);
return rc;
+#else
+ return -1;
+#endif
}
int rpmtsRebuildDB(rpmts ts)
{
void *lock = rpmtsAcquireLock(ts);
int rc;
- if (!(rpmtsVSFlags(ts) & RPMVSF_NOHDRCHK))
- rc = rpmdbRebuild(ts->rootDir, ts);
- else
- rc = rpmdbRebuild(ts->rootDir, NULL);
+ rc = rpmdbRebuild(ts->rootDir,
+ (!(rpmtsVSFlags(ts) & RPMVSF_NOHDRCHK) ? ts : NULL));
lock = rpmtsFreeLock(lock);
return rc;
}
int rpmtsVerifyDB(rpmts ts)
{
+#if defined(SUPPORT_VERIFYDB)
return rpmdbVerify(ts->rootDir);
+#else
+ return -1;
+#endif
}
-/*@-compdef@*/ /* keyp might no be defined. */
+/*@-compdef@*/ /* keyp might not be defined. */
rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
const void * keyp, size_t keylen)
{
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmts.h
============================================================================
$ cvs diff -u -r2.79 -r2.80 rpmts.h
--- rpm/lib/rpmts.h 6 Oct 2007 21:33:48 -0000 2.79
+++ rpm/lib/rpmts.h 7 Oct 2007 14:00:13 -0000 2.80
@@ -695,10 +695,9 @@
* @param siglen signature tag data length
* @return 0 always
*/
-int rpmtsSetSig(rpmts ts,
- int_32 sigtag, int_32 sigtype,
+int rpmtsSetSig(rpmts ts, int_32 sigtag, int_32 sigtype,
/*@kept@*/ /*@null@*/ const void * sig, int_32 siglen)
- /*@modifies ts @*/;
+ /*@*/;
/** \ingroup rpmts
* Get OpenPGP packet parameters, i.e. signature/pubkey constants.
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/.splintrc
============================================================================
$ cvs diff -u -r1.7 -r1.8 .splintrc
--- rpm/rpmdb/.splintrc 6 Oct 2007 21:33:49 -0000 1.7
+++ rpm/rpmdb/.splintrc 7 Oct 2007 14:00:13 -0000 1.8
@@ -15,6 +15,9 @@
+slovak-fcns
-bufferoverflowhigh
+-internalglobs # 35
+-unrecog # 2 rpmcliPackagesTotal misplaced
+
# --- +partial artifacts
-declundef
-exportheadervar
@@ -26,15 +29,6 @@
-varuse
# --- not-yet at strict level
--globs
--globuse
--incondefs
--internalglobs # 16
--paramuse # 6
--mustmod # 8
--type # 4
--unrecog # 2
-
-bitwisesigned # 160
-branchstate # 65
-elseifcomplete # 9
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/hdrinline.h
============================================================================
$ cvs diff -u -r1.14 -r1.15 hdrinline.h
--- rpm/rpmdb/hdrinline.h 30 Sep 2007 17:29:05 -0000 1.14
+++ rpm/rpmdb/hdrinline.h 7 Oct 2007 14:00:13 -0000 1.15
@@ -133,7 +133,7 @@
*/
/*@unused@*/ static inline
/*@only@*/ /*@null@*/
-void * headerUnload(Header h, size_t * lenp)
+void * headerUnload(Header h, /*@out@*/ /*@null@*/ size_t * lenp)
/*@modifies h @*/
{
return (h2hv(h)->hdrunload) (h, lenp);
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/header.c
============================================================================
$ cvs diff -u -r1.66 -r1.67 header.c
--- rpm/rpmdb/header.c 30 Sep 2007 17:29:05 -0000 1.66
+++ rpm/rpmdb/header.c 7 Oct 2007 14:00:13 -0000 1.67
@@ -30,6 +30,7 @@
/*@access sprintfTag @*/
/*@access sprintfToken @*/
/*@access HV_t @*/
+/*@access FD_t @*/ /* XXX void * arg headerRead/headerWrite */
#define PARSER_BEGIN 0
#define PARSER_IN_ARRAY 1
@@ -448,6 +449,7 @@
* @param regionid region offset
* @return no. bytes of data in region, -1 on error
*/
+/*@-globs@*/ /* XXX rpm_typeAlign usage */
static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl,
entryInfo pe,
unsigned char * dataStart,
@@ -581,6 +583,7 @@
return dl;
}
+/*@=globs@*/
/** \ingroup header
* @param h header
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/header.h
============================================================================
$ cvs diff -u -r1.25 -r1.26 header.h
--- rpm/rpmdb/header.h 30 Sep 2007 17:29:05 -0000 1.25
+++ rpm/rpmdb/header.h 7 Oct 2007 14:00:13 -0000 1.26
@@ -408,11 +408,11 @@
/** \ingroup header
* Convert header to on-disk representation.
* @param h header (with pointers)
- * @retval *lenp length of header in bytes (or NULL);
+ * @retval *lenp length of header in bytes (or NULL)
* @return on-disk header blob (i.e. with offsets)
*/
typedef
-/*@only@*/ /*@null@*/ void * (*HDRunload) (Header h, size_t * lenp)
+/*@only@*/ /*@null@*/ void * (*HDRunload) (Header h, /*@out@*/ /*@null@*/ size_t * lenp)
/*@modifies h, *lenp @*/;
/** \ingroup header
@@ -783,7 +783,7 @@
* @return per-header accumulator pointer
*/
typedef
-void * (*HDRgetstats) (/*@null@*/ Header h, int opx)
+/*@null@*/ void * (*HDRgetstats) (Header h, int opx)
/*@*/;
/** \ingroup header
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/header_internal.h
============================================================================
$ cvs diff -u -r1.19 -r1.20 header_internal.h
--- rpm/rpmdb/header_internal.h 4 Oct 2007 07:20:43 -0000 1.19
+++ rpm/rpmdb/header_internal.h 7 Oct 2007 14:00:13 -0000 1.20
@@ -31,6 +31,7 @@
/**
* Sanity check on data alignment for data type.
*/
+/*@unchecked@*/ /*@observer@*/
extern int rpm_typeAlign[16];
#define hdrchkAlign(_type, _off) ((_off) & (rpm_typeAlign[_type]-1))
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/pkgio.c
============================================================================
$ cvs diff -u -r1.11 -r1.12 pkgio.c
--- rpm/rpmdb/pkgio.c 6 Oct 2007 21:33:49 -0000 1.11
+++ rpm/rpmdb/pkgio.c 7 Oct 2007 14:00:13 -0000 1.12
@@ -312,7 +312,9 @@
(void) rpmswAdd(rpmtsOp(ts, opx), pgpStatsAccumulator(ts->dig, opx));
opx = RPMTS_OP_SIGNATURE;
(void) rpmswAdd(rpmtsOp(ts, opx), pgpStatsAccumulator(ts->dig, opx));
+/*@-noeffect@*/
(void) rpmtsSetSig(ts, 0, 0, NULL, 0); /* XXX headerFreeData */
+/*@=noeffect@*/
ts->dig = pgpFreeDig(ts->dig);
}
}
@@ -392,7 +394,7 @@
*/
static rpmRC rdLead(FD_t fd, /*@out@*/ /*@null@*/ void * ptr,
const char ** msg)
- /*@modifies fd, *ptr, *msg @*/
+ /*@modifies *ptr, *msg @*/
{
struct rpmlead ** leadp = ptr;
struct rpmlead * l = xcalloc(1, sizeof(*l));
@@ -403,7 +405,6 @@
buf[0] = '\0';
if (leadp != NULL) *leadp = NULL;
-/*@-type@*/ /* FIX: remove timed read */
if ((xx = timedRead(fd, (char *)l, sizeof(*l))) != sizeof(*l)) {
if (Ferror(fd)) {
(void) snprintf(buf, sizeof(buf),
@@ -418,7 +419,7 @@
}
goto exit;
}
-/*@=type@*/
+
l->type = ntohs(l->type);
l->archnum = ntohs(l->archnum);
l->osnum = ntohs(l->osnum);
@@ -483,7 +484,7 @@
* @retval *msg failure msg
* @return rpmRC return code
*/
-static rpmRC wrSignature(FD_t fd, void * ptr, const char ** msg)
+static rpmRC wrSignature(FD_t fd, void * ptr, /*@unused@*/ const char ** msg)
/*@globals fileSystem @*/
/*@modifies fd, ptr, fileSystem @*/
{
@@ -554,7 +555,7 @@
static rpmRC rdSignature(FD_t fd, /*@out@*/ /*@null@*/ void * ptr,
const char ** msg)
/*@globals fileSystem @*/
- /*@modifies fd, *ptr, *msg, fileSystem @*/
+ /*@modifies *ptr, *msg, fileSystem @*/
{
Header * sighp = ptr;
char buf[BUFSIZ];
@@ -1089,11 +1090,20 @@
* @retval *msg failure msg
* @return rpmRC return code
*/
-static rpmRC ckHeader(FD_t fd, const void * ptr, const char ** msg)
+static rpmRC ckHeader(/*@unused@*/ FD_t fd, const void * ptr, const char ** msg)
/*@globals fileSystem @*/
- /*@modifies fd, ptr, fileSystem @*/
+ /*@modifies ptr, *msg, fileSystem @*/
{
rpmRC rc = RPMRC_OK;
+ Header h;
+
+ if (msg)
+ *msg = NULL;
+
+ h = headerLoad(ptr);
+ if (h == NULL)
+ rc = RPMRC_BAD;
+ h = headerFree(h);
return rc;
}
@@ -1114,6 +1124,9 @@
Header h = NULL;
rpmRC rc = RPMRC_OK;
+ if (msg)
+ *msg = NULL;
+
h = headerRead(fd);
if (h == NULL)
rc = RPMRC_FAIL;
@@ -1132,7 +1145,7 @@
* @retval *msg failure msg
* @return rpmRC return code
*/
-static rpmRC wrHeader(FD_t fd, void * ptr, const char ** msg)
+static rpmRC wrHeader(FD_t fd, void * ptr, /*@unused@*/ const char ** msg)
/*@globals fileSystem @*/
/*@modifies fd, ptr, fileSystem @*/
{
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/pkgio.h
============================================================================
$ cvs diff -u -r1.4 -r1.5 pkgio.h
--- rpm/rpmdb/pkgio.h 30 Sep 2007 17:29:05 -0000 1.4
+++ rpm/rpmdb/pkgio.h 7 Oct 2007 14:00:13 -0000 1.5
@@ -28,9 +28,8 @@
*/
rpmRC headerCheck(rpmts ts, const void * uh, size_t uc,
/*@out@*/ /*@null@*/ const char ** msg)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, *msg, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+ /*@globals fileSystem, internalState @*/
+ /*@modifies ts, *msg, fileSystem, internalState @*/;
/**
* Return size of item in bytes.
@@ -76,7 +75,7 @@
*/
rpmRC rpmpkgCheck(const char * fn, FD_t fd, const void * ptr, const char ** msg)
/*@globals fileSystem @*/
- /*@modifies fd, ptr, *msg, fileSystem @*/;
+ /*@modifies ptr, *msg, fileSystem @*/;
#ifdef __cplusplus
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/poptDB.c
============================================================================
$ cvs diff -u -r1.7 -r1.8 poptDB.c
--- rpm/rpmdb/poptDB.c 16 Jul 2007 01:32:32 -0000 1.7
+++ rpm/rpmdb/poptDB.c 7 Oct 2007 14:00:13 -0000 1.8
@@ -15,13 +15,17 @@
/**
*/
struct poptOption rpmDatabasePoptTable[] = {
+#if defined(SUPPORT_INITDB)
{ "initdb", '\0', POPT_ARG_VAL, &rpmDBArgs.init, 1,
N_("initialize database"), NULL},
+#endif
{ "rebuilddb", '\0', POPT_ARG_VAL, &rpmDBArgs.rebuild, 1,
N_("rebuild database inverted lists from installed package headers"),
NULL},
+#if defined(SUPPORT_VERIFYDB)
{ "verifydb", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &rpmDBArgs.verify, 1,
N_("verify database files"), NULL},
+#endif
POPT_TABLEEND
};
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/rpmdb.c
============================================================================
$ cvs diff -u -r1.164 -r1.165 rpmdb.c
--- rpm/rpmdb/rpmdb.c 6 Oct 2007 21:33:49 -0000 1.164
+++ rpm/rpmdb/rpmdb.c 7 Oct 2007 14:00:13 -0000 1.165
@@ -1304,9 +1304,10 @@
int rpmdbInit (const char * prefix, int perms)
{
+ int rc = -1; /* RPMRC_NOTFOUND somewhen */
+#ifdef SUPPORT_INITDB
rpmdb db = NULL;
int _dbapi = rpmExpandNumeric("%{_dbapi}");
- int rc;
rc = rpmdbOpenDatabase(prefix, NULL, _dbapi, &db, (O_CREAT | O_RDWR),
perms, RPMDB_FLAG_JUSTCHECK);
@@ -1318,13 +1319,15 @@
if (xx && rc == 0) rc = xx;
db = NULL;
}
+#endif
return rc;
}
int rpmdbVerifyAllDBI(rpmdb db)
{
- int rc = 0;
+ int rc = -1; /* RPMRC_NOTFOUND somewhen */
+#if defined(SUPPORT_VERIFYDB)
if (db != NULL) {
int dbix;
int xx;
@@ -1347,17 +1350,21 @@
if (xx && rc == 0) rc = xx;
db = NULL;
}
+#endif
return rc;
}
int rpmdbVerify(const char * prefix)
{
+ int rc = -1; /* RPMRC_NOTFOUND somewhen */
+#if defined(SUPPORT_VERIFYDB)
rpmdb db = NULL;
int _dbapi = rpmExpandNumeric("%{_dbapi}");
- int rc = rpmdbOpenDatabase(prefix, NULL, _dbapi, &db, O_RDONLY, 0644, 0);
+ rc = rpmdbOpenDatabase(prefix, NULL, _dbapi, &db, O_RDONLY, 0644, 0);
if (!rc && db != NULL)
rc = rpmdbVerifyAllDBI(db);
+#endif
return rc;
}
@@ -1815,9 +1822,8 @@
* @return 0 on success
*/
static int miFreeHeader(rpmdbMatchIterator mi, dbiIndex dbi)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies mi, dbi,
- rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
+ /*@globals fileSystem, internalState @*/
+ /*@modifies mi, dbi, fileSystem, internalState @*/
{
int rc = 0;
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/signature.c
============================================================================
$ cvs diff -u -r1.2 -r1.3 signature.c
--- rpm/rpmdb/signature.c 6 Oct 2007 21:33:49 -0000 1.2
+++ rpm/rpmdb/signature.c 7 Oct 2007 14:00:13 -0000 1.3
@@ -987,8 +987,8 @@
static rpmRC
verifyRSASignature(pgpDig dig, /*@out@*/ char * t,
/*@null@*/ DIGEST_CTX md5ctx)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies dig, *t, rpmGlobalMacroContext, fileSystem, internalState */
+ /*@globals internalState @*/
+ /*@modifies dig, *t, internalState */
{
const void * sig = pgpGetSig(dig);
#ifdef NOTYET
@@ -1181,8 +1181,8 @@
static rpmRC
verifyDSASignature(pgpDig dig, /*@out@*/ char * t,
/*@null@*/ DIGEST_CTX sha1ctx)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies dig, *t, rpmGlobalMacroContext, fileSystem, internalState */
+ /*@globals internalState @*/
+ /*@modifies dig, *t, internalState */
{
const void * sig = pgpGetSig(dig);
#ifdef NOTYET
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/signature.h
============================================================================
$ cvs diff -u -r1.1 -r1.2 signature.h
--- rpm/rpmdb/signature.h 30 Sep 2007 22:38:30 -0000 1.1
+++ rpm/rpmdb/signature.h 7 Oct 2007 14:00:13 -0000 1.2
@@ -74,9 +74,8 @@
* @return result of signature verification
*/
rpmRC rpmVerifySignature(void * _dig, /*@out@*/ char * result)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies _dig, *result, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+ /*@globals internalState @*/
+ /*@modifies _dig, *result, internalState @*/;
#ifdef __cplusplus
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmqv.c
============================================================================
$ cvs diff -u -r1.126 -r1.127 rpmqv.c
--- rpm/rpmqv.c 19 Aug 2007 15:26:11 -0000 1.126
+++ rpm/rpmqv.c 7 Oct 2007 14:00:12 -0000 1.127
@@ -541,7 +541,11 @@
switch (bigMode) {
#ifdef IAM_RPMDB
case MODE_INITDB:
+#if defined(SUPPORT_INITDB)
ec = rpmtsInitDB(ts, 0644);
+#else
+ ec = -1;
+#endif
break;
case MODE_REBUILDDB:
@@ -551,7 +555,11 @@
vsflags = rpmtsSetVSFlags(ts, ovsflags);
} break;
case MODE_VERIFYDB:
+#if defined(SUPPORT_VERIFYDB)
ec = rpmtsVerifyDB(ts);
+#else
+ ec = -1;
+#endif
break;
#endif /* IAM_RPMDB */
@@ .
patch -p0 <<'@@ .'
Index: rpm/system.h
============================================================================
$ cvs diff -u -r2.88 -r2.89 system.h
--- rpm/system.h 30 Sep 2007 17:29:04 -0000 2.88
+++ rpm/system.h 7 Oct 2007 14:00:12 -0000 2.89
@@ -736,7 +736,13 @@
* Turn off pgp/pgp5 signing (hasn't been looked at seriously for years).
*/
#if 0
-#define SUPPORT_PGP_SIGNING 1
+#define SUPPORT_PGP_SIGNING 1
#endif
+/**
+ * Mark --initdb and --verifydb for destruction.
+ */
+#define SUPPORT_INITDB 1
+#define SUPPORT_VERIFYDB 1
+
#endif /* H_SYSTEM */
@@ .
Received on Sun Oct 7 16:00:14 2007