RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES TODO rpm/lib/ rpmchecksig.c rpm/rpmdb/ hdrinli...

From: Jeff Johnson <jbj@rpm5.org>
Date: Sat 17 Nov 2007 - 17:56:21 CET
Message-Id: <20071117165621.B8024347E82@rpm5.org>
  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:   17-Nov-2007 17:56:21
  Branch: HEAD                             Handle: 2007111716562001

  Modified files:
    rpm                     CHANGES TODO system.h
    rpm/lib                 rpmchecksig.c
    rpm/rpmdb               hdrinline.h header_internal.h pkgio.c signature.c
                            tagname.c

  Log:
    - revert the noisy tag data type validation. explicit typing for 5.0.
    - add HEADERFLAG_SIGNATURE, revert he->signature access markers.

  Summary:
    Revision    Changes     Path
    1.1834      +4  -1      rpm/CHANGES
    1.14        +9  -5      rpm/TODO
    1.179       +9  -17     rpm/lib/rpmchecksig.c
    1.33        +8  -4      rpm/rpmdb/hdrinline.h
    1.32        +1  -0      rpm/rpmdb/header_internal.h
    1.37        +1  -2      rpm/rpmdb/pkgio.c
    1.23        +0  -14     rpm/rpmdb/signature.c
    1.13        +2  -0      rpm/rpmdb/tagname.c
    2.97        +5  -0      rpm/system.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1833 -r1.1834 CHANGES
  --- rpm/CHANGES	16 Nov 2007 19:56:45 -0000	1.1833
  +++ rpm/CHANGES	17 Nov 2007 16:56:20 -0000	1.1834
  @@ -1,10 +1,13 @@
   5.0a1 -> 5.0a2:
  +    - jbj: revert the noisy tag data type validation. explicit typing for 5.0.
  +    - jbj: add HEADERFLAG_SIGNATURE, revert he->signature access markers.
       - afb: upgrade internal rsyncable zlib, from 1.2.2.4 to 1.2.3
       - jbj: fix: segfault with corrupted rpm reported at
   	http://qa.mandriva.com/show_bug.cgi?id=33735
       No change needed to rpm-5.0 whatsoever:
   	   % rpm -K rep-gtk-debug-0.18-6mdv2008.0.x86_64.rpm 
  -	   error: /tmp/rep-gtk-debug-0.18-6mdv2008.0.x86_64.rpm: Header: region trailer: BAD, tag 63 type 7 offset 848 count 1524040208
  +	   error: /tmp/rep-gtk-debug-0.18-6mdv2008.0.x86_64.rpm: \
  +	Header: region trailer: BAD, tag 63 type 7 offset 848 count 1524040208
       - jbj: handle --root/--dbpath variants, with/without URL, using --rebuilddb.
       - jbj: rpmdb: casts for integral conversions.
       - jbj: lib: identify and repair several minor flaws caught by splint.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/TODO
  ============================================================================
  $ cvs diff -u -r1.13 -r1.14 TODO
  --- rpm/TODO	15 Nov 2007 23:50:21 -0000	1.13
  +++ rpm/TODO	17 Nov 2007 16:56:20 -0000	1.14
  @@ -60,11 +60,6 @@
       - jbj: C++ and C have different rules regarding typedef'd enums like rpmTag.
   	The definitions and usage are currently split awkwardly between
   	rpmtag.h and header.h.
  -    - jbj: Heh, --import has *always* used the wrong data type for
  -	Summary/Description/Group. The header that carries the pubkey
  -	lacks RPMTAG_ARCH/RPMTAG_OS as well. Re-importing all pubkeys is
  -	one solution, but perhaps a "just works" slam-dunk hack is needed
  -	during --rebuildb, or with header extensions.
       - jbj: markReplacedFiles() subtly rewrites header back into rpmdb
   	with altered RPMTAG_FILESTATES data. get/del/add sequence
   	is needed instead.
  @@ -78,3 +73,12 @@
     o to be resolved before RPM 5.0.0:
       - rse: NEWS polishing
   
  +  RPM 5.1 ROADMAP ISSUES
  +  ----------------------
  +    - jbj: Heh, --import has *always* used the wrong data type for
  +	Summary/Description/Group. The header that carries the pubkey
  +	lacks RPMTAG_ARCH/RPMTAG_OS as well. Re-importing all pubkeys is
  +	one solution, but perhaps a "just works" slam-dunk hack is needed
  +	during --rebuildb, or with header extensions. When this issue is
  +	resolved, then rpm can/should use implicit, rather than explicit, data
  +	types for tag data.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmchecksig.c
  ============================================================================
  $ cvs diff -u -r1.178 -r1.179 rpmchecksig.c
  --- rpm/lib/rpmchecksig.c	15 Nov 2007 20:26:04 -0000	1.178
  +++ rpm/lib/rpmchecksig.c	17 Nov 2007 16:56:21 -0000	1.179
  @@ -272,9 +272,7 @@
   
   	/* Lose the immutable region (if present). */
   	he->tag = RPMTAG_HEADERSIGNATURES;
  -	he->signature = 1;
   	xx = hge(sigh, he, 0);
  -	he->signature = 0;
   	if (xx) {
   	    HE_t ohe = memset(alloca(sizeof(*ohe)), 0, sizeof(*ohe));
   	    HeaderIterator hi;
  @@ -287,7 +285,6 @@
   		goto exit;
   	    }
   
  -	    ohe->signature = 1;
   	    oh = headerCopyLoad(he->p.ptr);
   	    for (hi = headerInitExtension(oh);
   		headerNextExtension(hi, ohe, 0);
  @@ -299,7 +296,6 @@
   	    }
   	    hi = headerFreeIterator(hi);
   	    oh = headerFree(oh);
  -	    ohe->signature = 0;
   
   	    sigh = headerFree(sigh);
   	    sigh = headerLink(nh);
  @@ -581,24 +577,24 @@
       /* Add Summary/Description/Group. */
       he->tag = RPMTAG_DESCRIPTION;
       he->p.str = d;
  -#ifdef	BORKED	/* XXX RPM_I18NSTRING_TYPE fixing. */
  -    xx = hae(h, he, 0);
  -#else
  +#if defined(SUPPORT_IMPLICIT_TAG_DATA_TYPES)
       xx = headerAddI18NString(h, he->tag, he->p.ptr, "C");
  +#else
  +    xx = hae(h, he, 0);
   #endif
       he->tag = RPMTAG_GROUP;
       he->p.str = group;
  -#ifdef	BORKED	/* XXX RPM_I18NSTRING_TYPE fixing. */
  -    xx = hae(h, he, 0);
  -#else
  +#if defined(SUPPORT_IMPLICIT_TAG_DATA_TYPES)
       xx = headerAddI18NString(h, he->tag, he->p.ptr, "C");
  +#else
  +    xx = hae(h, he, 0);
   #endif
       he->tag = RPMTAG_SUMMARY;
       he->p.str = u;
  -#ifdef	BORKED	/* XXX RPM_I18NSTRING_TYPE fixing. */
  -    xx = hae(h, he, 0);
  -#else
  +#if defined(SUPPORT_IMPLICIT_TAG_DATA_TYPES)
       xx = headerAddI18NString(h, he->tag, he->p.ptr, "C");
  +#else
  +    xx = hae(h, he, 0);
   #endif
   
       /* Add a "pubkey" arch/os to avoid missing value NULL ptrs. */
  @@ -989,9 +985,7 @@
   #endif
   	) {
   	    he->tag = she->tag;
  -	    he->signature = 1;
   	    xx = hge(sigh, he, 0);
  -	    he->signature = 0;
   	    xx = pgpPrtPkts(he->p.ptr, he->c, dig, 0);
   	    he->p.ptr = _free(he->p.ptr);
   #if defined(SUPPORT_RPMV3_VERIFY_RSA)
  @@ -1030,7 +1024,6 @@
   	sprintf(b, "%s:%c", fn, (rpmIsVerbose() ? '\n' : ' ') );
   	b += strlen(b);
   
  -	she->signature = 1;
   	if (sigh != NULL)
   	for (hi = headerInitExtension(sigh);
   	    headerNextExtension(hi, she, 0) != 0;
  @@ -1238,7 +1231,6 @@
   	    }
   	}
   	hi = headerFreeIterator(hi);
  -	she->signature = 0;
   	/* XXX clear the already free'd signature data. */
   /*@-noeffect@*/
   	xx = pgpSetSig(rpmtsDig(ts), 0, 0, NULL, 0);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/hdrinline.h
  ============================================================================
  $ cvs diff -u -r1.32 -r1.33 hdrinline.h
  --- rpm/rpmdb/hdrinline.h	15 Nov 2007 23:14:53 -0000	1.32
  +++ rpm/rpmdb/hdrinline.h	17 Nov 2007 16:56:21 -0000	1.33
  @@ -270,10 +270,12 @@
       int xx;
       if (h == NULL) return 0;
       xx = (h2hv(h)->hdrext) (h, he->tag, &he->t, &he->p, &he->c);
  +#if defined(SUPPORT_IMPLICIT_TAG_DATA_TYPES)
   /*@-modfilesys@*/
  -/* XXX verify that explicit and implicit types are identical. */
  -if (xx) tagTypeValidate(he);
  +    /* XXX verify that explicit and implicit types are identical. */
  +    if (xx) tagTypeValidate(he);
   /*@=modfilesys@*/
  +#endif
       return xx;
   }
   
  @@ -291,10 +293,12 @@
   	/*@modifies h @*/
   {
       int xx;
  +#if defined(SUPPORT_IMPLICIT_TAG_DATA_TYPES)
   /*@-modfilesys@*/
  -/* XXX verify that explicit and implicit types are identical. */
  -tagTypeValidate(he);
  +    /* XXX verify that explicit and implicit types are identical. */
  +    tagTypeValidate(he);
   /*@=modfilesys@*/
  +#endif
       if (he->append)
   	xx = (h2hv(h)->hdraddorappend) (h, he->tag, he->t, he->p.ptr, he->c);
       else
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/header_internal.h
  ============================================================================
  $ cvs diff -u -r1.31 -r1.32 header_internal.h
  --- rpm/rpmdb/header_internal.h	15 Nov 2007 23:14:53 -0000	1.31
  +++ rpm/rpmdb/header_internal.h	17 Nov 2007 16:56:21 -0000	1.32
  @@ -101,6 +101,7 @@
   #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? */
  +#define HEADERFLAG_SIGNATURE	(1 << 4) /*!< Signature header? */
   /*@refs@*/
       int nrefs;			/*!< Reference count. */
   };
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/pkgio.c
  ============================================================================
  $ cvs diff -u -r1.36 -r1.37 pkgio.c
  --- rpm/rpmdb/pkgio.c	15 Nov 2007 23:14:53 -0000	1.36
  +++ rpm/rpmdb/pkgio.c	17 Nov 2007 16:56:21 -0000	1.37
  @@ -726,6 +726,7 @@
   	goto exit;
       }
       sigh->flags |= HEADERFLAG_ALLOCATED;
  +    sigh->flags |= HEADERFLAG_SIGNATURE;
       if (_newmagic)	/* XXX FIXME: sigh needs its own magic. */
   	(void) headerSetMagic(sigh, sigh_magic, sizeof(sigh_magic));
   
  @@ -743,9 +744,7 @@
   	/* Print package component sizes. */
   
   	he->tag = RPMSIGTAG_SIZE;
  -	he->signature = 1;
   	xx = hge(sigh, he, 0);
  -	he->signature = 0;
   	if (xx) {
   	    size_t datasize = he->p.ui32p[0];
   	    rc = printSize(fd, sigSize, pad, datasize);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/signature.c
  ============================================================================
  $ cvs diff -u -r1.22 -r1.23 signature.c
  --- rpm/rpmdb/signature.c	14 Nov 2007 23:56:33 -0000	1.22
  +++ rpm/rpmdb/signature.c	17 Nov 2007 16:56:21 -0000	1.23
  @@ -582,9 +582,7 @@
   	he->t = RPM_STRING_TYPE;
   	he->p.str = SHA1;
   	he->c = 1;
  -	he->signature = 1;
   	xx = hae(sigh, he, 0);
  -	he->signature = 0;
   	SHA1 = _free(SHA1);
   	if (!xx)
   	    goto exit;
  @@ -609,9 +607,7 @@
   	he->t = RPM_BIN_TYPE;
   	he->p.ptr = pkt;
   	he->c = pktlen;
  -	he->signature = 1;
   	xx = hae(sigh, he, 0);
  -	he->signature = 0;
   	if (!xx)
   	    goto exit;
   	ret = 0;
  @@ -636,9 +632,7 @@
   	he->t = RPM_BIN_TYPE;
   	he->p.ptr = pkt;
   	he->c = pktlen;
  -	he->signature = 1;
   	xx = hae(sigh, he, 0);
  -	he->signature = 0;
   	if (!xx)
   	    goto exit;
   	ret = 0;
  @@ -677,9 +671,7 @@
   	he->t = RPM_UINT32_TYPE;
   	he->p.ui32p = &pktlen;
   	he->c = 1;
  -	he->signature = 1;
   	xx = hae(sigh, he, 0);
  -	he->signature = 0;
   	if (!xx)
   	    break;
   	ret = 0;
  @@ -693,9 +685,7 @@
   	he->t = RPM_BIN_TYPE;
   	he->p.ptr = pkt;
   	he->c = pktlen;
  -	he->signature = 1;
   	xx = hae(sigh, he, 0);
  -	he->signature = 0;
   	if (!xx)
   	    break;
   	ret = 0;
  @@ -710,9 +700,7 @@
   	he->t = RPM_BIN_TYPE;
   	he->p.ptr = pkt;
   	he->c = pktlen;
  -	he->signature = 1;
   	xx = hae(sigh, he, 0);
  -	he->signature = 0;
   	if (!xx)
   	    break;
   	/* XXX Piggyback a header-only RSA signature as well. */
  @@ -731,9 +719,7 @@
   	he->t = RPM_BIN_TYPE;
   	he->p.ptr = pkt;
   	he->c = pktlen;
  -	he->signature = 1;
   	xx = hae(sigh, he, 0);
  -	he->signature = 0;
   	if (!xx)
   	    break;
   	/* XXX Piggyback a header-only DSA signature as well. */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/tagname.c
  ============================================================================
  $ cvs diff -u -r1.12 -r1.13 tagname.c
  --- rpm/rpmdb/tagname.c	14 Nov 2007 23:56:33 -0000	1.12
  +++ rpm/rpmdb/tagname.c	17 Nov 2007 16:56:21 -0000	1.13
  @@ -272,6 +272,7 @@
       return 0xffffffff;	/* XXX arbitrary tags */
   }
   
  +#if defined(SUPPORT_IMPLICIT_TAG_DATA_TYPES)
   /**
    * Validate that implicit and explicit types are identical.
    * @param he		tag container
  @@ -284,3 +285,4 @@
   if ((tagType(he->tag) & 0xffff) != he->t)
   fprintf(stderr, "==> warning: tag %u type(0x%x) != implicit type(0x%x)\n", (unsigned) he->tag, he->t, tagType(he->tag));
   }
  +#endif
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/system.h
  ============================================================================
  $ cvs diff -u -r2.96 -r2.97 system.h
  --- rpm/system.h	12 Nov 2007 14:33:57 -0000	2.96
  +++ rpm/system.h	17 Nov 2007 16:56:20 -0000	2.97
  @@ -753,4 +753,9 @@
   #define	SUPPORT_INITDB		1
   #define	SUPPORT_VERIFYDB	1
   
  +/**
  + * Use the tag data type compiled into rpm, not the type from the header.
  + */
  +#undef SUPPORT_IMPLICIT_TAG_DATA_TYPES	/* XXX postpone to rpm-5.1 */
  +
   #endif	/* H_SYSTEM */
  @@ .
Received on Sat Nov 17 17:56:21 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.