RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm-4_5: rpm/ CHANGES rpm/lib/ rpmchecksig.c rpmcli.h rpmts...

From: Per Øyvind Karlsen <pkarlsen@rpm5.org>
Date: Wed 12 Dec 2007 - 03:00:10 CET
Message-Id: <20071212020010.3E4E734845A@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Per Øyvind Karlsen
  Root:   /v/rpm/cvs                       Email:  pkarlsen@rpm5.org
  Module: rpm                              Date:   12-Dec-2007 03:00:10
  Branch: rpm-4_5                          Handle: 2007121202000801

  Modified files:           (Branch: rpm-4_5)
    rpm                     CHANGES
    rpm/lib                 rpmchecksig.c rpmcli.h rpmts.c rpmts.h
    rpm/python              rpmts-py.c

  Log:
    Rename rpmcliImportPubkey() -> rpmtsImportPubkey() (from and for
    rpm.org compatibility)

  Summary:
    Revision    Changes     Path
    1.1360.2.58 +1  -0      rpm/CHANGES
    1.114.2.2   +1  -136    rpm/lib/rpmchecksig.c
    2.67.2.2    +0  -15     rpm/lib/rpmcli.h
    2.79.2.4    +135 -0     rpm/lib/rpmts.c
    2.63.2.1    +15 -0      rpm/lib/rpmts.h
    1.65.2.3    +1  -1      rpm/python/rpmts-py.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1360.2.57 -r1.1360.2.58 CHANGES
  --- rpm/CHANGES	12 Dec 2007 01:40:53 -0000	1.1360.2.57
  +++ rpm/CHANGES	12 Dec 2007 02:00:09 -0000	1.1360.2.58
  @@ -1,4 +1,5 @@
   4.4.9 -> 4.5:
  +    - proyvind: Rename rpmcliImportPubkey() -> rpmtsImportPubkey() (from and for rpm.org compatibility)
       - proyvind: expose more functions in rpmps API (as rpm.org, initially based on us ;p)
       - proyvind: fix built-in zlib dependencies (from gb)
       - proyvind: force generation of PIC code for static libs that can be built into a DSO (zlib, file) (from gb)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmchecksig.c
  ============================================================================
  $ cvs diff -u -r1.114.2.1 -r1.114.2.2 rpmchecksig.c
  --- rpm/lib/rpmchecksig.c	13 Jun 2007 00:59:31 -0000	1.114.2.1
  +++ rpm/lib/rpmchecksig.c	12 Dec 2007 02:00:08 -0000	1.114.2.2
  @@ -421,141 +421,6 @@
       return res;
   }
   
  -rpmRC rpmcliImportPubkey(const rpmts ts, const unsigned char * pkt, ssize_t pktlen)
  -{
  -    static unsigned char zeros[] =
  -	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  -    const char * afmt = "%{pubkeys:armor}";
  -    const char * group = "Public Keys";
  -    const char * license = "pubkey";
  -    const char * buildhost = "localhost";
  -    int_32 pflags = (RPMSENSE_KEYRING|RPMSENSE_EQUAL);
  -    int_32 zero = 0;
  -    pgpDig dig = NULL;
  -    pgpDigParams pubp = NULL;
  -    const char * d = NULL;
  -    const char * enc = NULL;
  -    const char * n = NULL;
  -    const char * u = NULL;
  -    const char * v = NULL;
  -    const char * r = NULL;
  -    const char * evr = NULL;
  -    Header h = NULL;
  -    rpmRC rc = RPMRC_FAIL;		/* assume failure */
  -    char * t;
  -    int xx;
  -
  -    if (pkt == NULL || pktlen <= 0)
  -	return RPMRC_FAIL;
  -    if (rpmtsOpenDB(ts, (O_RDWR|O_CREAT)))
  -	return RPMRC_FAIL;
  -
  -    if ((enc = b64encode(pkt, pktlen)) == NULL)
  -	goto exit;
  -
  -    dig = pgpNewDig();
  -
  -    /* Build header elements. */
  -    (void) pgpPrtPkts(pkt, pktlen, dig, 0);
  -    pubp = &dig->pubkey;
  -
  -    if (!memcmp(pubp->signid, zeros, sizeof(pubp->signid))
  -     || !memcmp(pubp->time, zeros, sizeof(pubp->time))
  -     || pubp->userid == NULL)
  -	goto exit;
  -
  -/*@-boundswrite@*/
  -    v = t = xmalloc(16+1);
  -    t = stpcpy(t, pgpHexStr(pubp->signid, sizeof(pubp->signid)));
  -
  -    r = t = xmalloc(8+1);
  -    t = stpcpy(t, pgpHexStr(pubp->time, sizeof(pubp->time)));
  -
  -    n = t = xmalloc(sizeof("gpg()")+8);
  -    t = stpcpy( stpcpy( stpcpy(t, "gpg("), v+8), ")");
  -
  -    /*@-nullpass@*/ /* FIX: pubp->userid may be NULL */
  -    u = t = xmalloc(sizeof("gpg()")+strlen(pubp->userid));
  -    t = stpcpy( stpcpy( stpcpy(t, "gpg("), pubp->userid), ")");
  -    /*@=nullpass@*/
  -
  -    evr = t = xmalloc(sizeof("4X:-")+strlen(v)+strlen(r));
  -    t = stpcpy(t, (pubp->version == 4 ? "4:" : "3:"));
  -    t = stpcpy( stpcpy( stpcpy(t, v), "-"), r);
  -/*@=boundswrite@*/
  -
  -    /* Check for pre-existing header. */
  -
  -    /* Build pubkey header. */
  -    h = headerNew();
  -
  -    xx = headerAddOrAppendEntry(h, RPMTAG_PUBKEYS,
  -			RPM_STRING_ARRAY_TYPE, &enc, 1);
  -
  -    d = headerSprintf(h, afmt, rpmTagTable, rpmHeaderFormats, NULL);
  -    if (d == NULL)
  -	goto exit;
  -
  -    xx = headerAddEntry(h, RPMTAG_NAME, RPM_STRING_TYPE, "gpg-pubkey", 1);
  -    xx = headerAddEntry(h, RPMTAG_VERSION, RPM_STRING_TYPE, v+8, 1);
  -    xx = headerAddEntry(h, RPMTAG_RELEASE, RPM_STRING_TYPE, r, 1);
  -    xx = headerAddEntry(h, RPMTAG_DESCRIPTION, RPM_STRING_TYPE, d, 1);
  -    xx = headerAddEntry(h, RPMTAG_GROUP, RPM_STRING_TYPE, group, 1);
  -    xx = headerAddEntry(h, RPMTAG_LICENSE, RPM_STRING_TYPE, license, 1);
  -    xx = headerAddEntry(h, RPMTAG_SUMMARY, RPM_STRING_TYPE, u, 1);
  -
  -    xx = headerAddEntry(h, RPMTAG_SIZE, RPM_INT32_TYPE, &zero, 1);
  -
  -    xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDENAME,
  -			RPM_STRING_ARRAY_TYPE, &u, 1);
  -    xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION,
  -			RPM_STRING_ARRAY_TYPE, &evr, 1);
  -    xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS,
  -			RPM_INT32_TYPE, &pflags, 1);
  -
  -    xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDENAME,
  -			RPM_STRING_ARRAY_TYPE, &n, 1);
  -    xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION,
  -			RPM_STRING_ARRAY_TYPE, &evr, 1);
  -    xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS,
  -			RPM_INT32_TYPE, &pflags, 1);
  -
  -    xx = headerAddEntry(h, RPMTAG_RPMVERSION, RPM_STRING_TYPE, RPMVERSION, 1);
  -
  -    /* XXX W2DO: tag value inheirited from parent? */
  -    xx = headerAddEntry(h, RPMTAG_BUILDHOST, RPM_STRING_TYPE, buildhost, 1);
  -    {   int_32 tid = rpmtsGetTid(ts);
  -	xx = headerAddEntry(h, RPMTAG_INSTALLTIME, RPM_INT32_TYPE, &tid, 1);
  -	/* XXX W2DO: tag value inheirited from parent? */
  -	xx = headerAddEntry(h, RPMTAG_BUILDTIME, RPM_INT32_TYPE, &tid, 1);
  -    }
  -
  -#ifdef	NOTYET
  -    /* XXX W2DO: tag value inheirited from parent? */
  -    xx = headerAddEntry(h, RPMTAG_SOURCERPM, RPM_STRING_TYPE, fn, 1);
  -#endif
  -
  -    /* Add header to database. */
  -    xx = rpmdbAdd(rpmtsGetRdb(ts), rpmtsGetTid(ts), h, NULL, NULL);
  -    if (xx != 0)
  -	goto exit;
  -    rc = RPMRC_OK;
  -
  -exit:
  -    /* Clean up. */
  -    h = headerFree(h);
  -    dig = pgpFreeDig(dig);
  -    n = _free(n);
  -    u = _free(u);
  -    v = _free(v);
  -    r = _free(r);
  -    evr = _free(evr);
  -    enc = _free(enc);
  -    d = _free(d);
  -    
  -    return rc;
  -}
  -
   /** \ingroup rpmcli
    * Import public key(s).
    * @todo Implicit --update policy for gpg-pubkey headers.
  @@ -617,7 +482,7 @@
   	}
   
   	/* Import pubkey packet(s). */
  -	if ((rpmrc = rpmcliImportPubkey(ts, pkt, pktlen)) != RPMRC_OK) {
  +	if ((rpmrc = rpmtsImportPubkey(ts, pkt, pktlen)) != RPMRC_OK) {
   	    rpmError(RPMERR_IMPORT, _("%s: import failed.\n"), fn);
   	    res++;
   	    continue;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmcli.h
  ============================================================================
  $ cvs diff -u -r2.67.2.1 -r2.67.2.2 rpmcli.h
  --- rpm/lib/rpmcli.h	30 Jul 2007 03:07:58 -0000	2.67.2.1
  +++ rpm/lib/rpmcli.h	12 Dec 2007 02:00:08 -0000	2.67.2.2
  @@ -665,21 +665,6 @@
   /*@{*/
   
   /** \ingroup rpmcli
  - * Import public key packet(s).
  - * @todo Implicit --update policy for gpg-pubkey headers.
  - * @param ts		transaction set
  - * @param pkt		pgp pubkey packet(s)
  - * @param pktlen	pgp pubkey length
  - * @return		RPMRC_OK/RPMRC_FAIL
  - */
  -rpmRC rpmcliImportPubkey(const rpmts ts,
  -		const unsigned char * pkt, ssize_t pktlen)
  -	/*@globals RPMVERSION, rpmGlobalMacroContext, h_errno,
  -		fileSystem, internalState @*/
  -	/*@modifies ts, rpmGlobalMacroContext,
  -		fileSystem, internalState @*/;
  -
  -/** \ingroup rpmcli
    * Bit(s) to control rpmReSign() operation.
    */
   /*@-typeuse@*/
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmts.c
  ============================================================================
  $ cvs diff -u -r2.79.2.3 -r2.79.2.4 rpmts.c
  --- rpm/lib/rpmts.c	9 Dec 2007 17:46:48 -0000	2.79.2.3
  +++ rpm/lib/rpmts.c	12 Dec 2007 02:00:08 -0000	2.79.2.4
  @@ -11,6 +11,9 @@
   #define	_RPMDB_INTERNAL		/* XXX almost opaque sigh */
   #include "rpmdb.h"		/* XXX stealing db->db_mode. */
   
  +#define	_RPMEVR_INTERNAL	/* XXX RPMSENSE_KEYRING */
  +#include "rpmevr.h"
  +
   #include "rpmal.h"
   #include "rpmds.h"
   #include "rpmfi.h"
  @@ -385,6 +388,138 @@
       return res;
   }
   
  +rpmRC rpmtsImportPubkey(const rpmts ts, const unsigned char * pkt, ssize_t pktlen)
  +{
  +    static unsigned char zeros[] =
  +	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  +    const char * afmt = "%{pubkeys:armor}";
  +    const char * group = "Public Keys";
  +    const char * license = "pubkey";
  +    const char * buildhost = "localhost";
  +    int32_t pflags = (RPMSENSE_KEYRING|RPMSENSE_EQUAL);
  +    int32_t zero = 0;
  +    pgpDig dig = NULL;
  +    pgpDigParams pubp = NULL;
  +    const char * d = NULL;
  +    const char * enc = NULL;
  +    const char * n = NULL;
  +    const char * u = NULL;
  +    const char * v = NULL;
  +    const char * r = NULL;
  +    const char * evr = NULL;
  +    Header h = NULL;
  +    rpmRC rc = RPMRC_FAIL;		/* assume failure */
  +    char * t;
  +    int xx;
  +
  +    if (pkt == NULL || pktlen <= 0)
  +	return RPMRC_FAIL;
  +    if (rpmtsOpenDB(ts, (O_RDWR|O_CREAT)))
  +	return RPMRC_FAIL;
  +
  +    if ((enc = b64encode(pkt, pktlen)) == NULL)
  +	goto exit;
  +
  +    dig = pgpNewDig();
  +
  +    /* Build header elements. */
  +    (void) pgpPrtPkts(pkt, pktlen, dig, 0);
  +    pubp = &dig->pubkey;
  +
  +    if (!memcmp(pubp->signid, zeros, sizeof(pubp->signid))
  +     || !memcmp(pubp->time, zeros, sizeof(pubp->time))
  +     || pubp->userid == NULL)
  +	goto exit;
  +
  +    v = t = xmalloc(16+1);
  +    t = stpcpy(t, pgpHexStr(pubp->signid, sizeof(pubp->signid)));
  +
  +    r = t = xmalloc(8+1);
  +    t = stpcpy(t, pgpHexStr(pubp->time, sizeof(pubp->time)));
  +
  +    n = t = xmalloc(sizeof("gpg()")+8);
  +    t = stpcpy( stpcpy( stpcpy(t, "gpg("), v+8), ")");
  +
  +    /* FIX: pubp->userid may be NULL */
  +    u = t = xmalloc(sizeof("gpg()")+strlen(pubp->userid));
  +    t = stpcpy( stpcpy( stpcpy(t, "gpg("), pubp->userid), ")");
  +
  +    evr = t = xmalloc(sizeof("4X:-")+strlen(v)+strlen(r));
  +    t = stpcpy(t, (pubp->version == 4 ? "4:" : "3:"));
  +    t = stpcpy( stpcpy( stpcpy(t, v), "-"), r);
  +
  +    /* Check for pre-existing header. */
  +
  +    /* Build pubkey header. */
  +    h = headerNew();
  +
  +    xx = headerAddOrAppendEntry(h, RPMTAG_PUBKEYS,
  +			RPM_STRING_ARRAY_TYPE, &enc, 1);
  +
  +    d = headerSprintf(h, afmt, rpmTagTable, rpmHeaderFormats, NULL);
  +    if (d == NULL)
  +	goto exit;
  +
  +    xx = headerAddEntry(h, RPMTAG_NAME, RPM_STRING_TYPE, "gpg-pubkey", 1);
  +    xx = headerAddEntry(h, RPMTAG_VERSION, RPM_STRING_TYPE, v+8, 1);
  +    xx = headerAddEntry(h, RPMTAG_RELEASE, RPM_STRING_TYPE, r, 1);
  +    xx = headerAddEntry(h, RPMTAG_DESCRIPTION, RPM_STRING_TYPE, d, 1);
  +    xx = headerAddEntry(h, RPMTAG_GROUP, RPM_STRING_TYPE, group, 1);
  +    xx = headerAddEntry(h, RPMTAG_LICENSE, RPM_STRING_TYPE, license, 1);
  +    xx = headerAddEntry(h, RPMTAG_SUMMARY, RPM_STRING_TYPE, u, 1);
  +
  +    xx = headerAddEntry(h, RPMTAG_SIZE, RPM_INT32_TYPE, &zero, 1);
  +
  +    xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDENAME,
  +			RPM_STRING_ARRAY_TYPE, &u, 1);
  +    xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION,
  +			RPM_STRING_ARRAY_TYPE, &evr, 1);
  +    xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS,
  +			RPM_INT32_TYPE, &pflags, 1);
  +
  +    xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDENAME,
  +			RPM_STRING_ARRAY_TYPE, &n, 1);
  +    xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION,
  +			RPM_STRING_ARRAY_TYPE, &evr, 1);
  +    xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS,
  +			RPM_INT32_TYPE, &pflags, 1);
  +
  +    xx = headerAddEntry(h, RPMTAG_RPMVERSION, RPM_STRING_TYPE, RPMVERSION, 1);
  +
  +    /* XXX W2DO: tag value inheirited from parent? */
  +    xx = headerAddEntry(h, RPMTAG_BUILDHOST, RPM_STRING_TYPE, buildhost, 1);
  +    {   int32_t tid = rpmtsGetTid(ts);
  +	xx = headerAddEntry(h, RPMTAG_INSTALLTIME, RPM_INT32_TYPE, &tid, 1);
  +	/* XXX W2DO: tag value inheirited from parent? */
  +	xx = headerAddEntry(h, RPMTAG_BUILDTIME, RPM_INT32_TYPE, &tid, 1);
  +    }
  +
  +#ifdef	NOTYET
  +    /* XXX W2DO: tag value inheirited from parent? */
  +    xx = headerAddEntry(h, RPMTAG_SOURCERPM, RPM_STRING_TYPE, fn, 1);
  +#endif
  +
  +    /* Add header to database. */
  +    xx = rpmdbAdd(rpmtsGetRdb(ts), rpmtsGetTid(ts), h, NULL, NULL);
  +    if (xx != 0)
  +	goto exit;
  +    rc = RPMRC_OK;
  +
  +exit:
  +    /* Clean up. */
  +    h = headerFree(h);
  +    dig = pgpFreeDig(dig);
  +    n = _free(n);
  +    u = _free(u);
  +    v = _free(v);
  +    r = _free(r);
  +    evr = _free(evr);
  +    enc = _free(enc);
  +    d = _free(d);
  +    
  +    return rc;
  +}
  +
   int rpmtsCloseSDB(rpmts ts)
   {
       int rc = 0;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmts.h
  ============================================================================
  $ cvs diff -u -r2.63 -r2.63.2.1 rpmts.h
  --- rpm/lib/rpmts.h	25 May 2007 17:36:02 -0000	2.63
  +++ rpm/lib/rpmts.h	12 Dec 2007 02:00:08 -0000	2.63.2.1
  @@ -466,6 +466,21 @@
   /*@=exportlocal@*/
   
   /** \ingroup rpmts
  + * Import public key packet(s).
  + * @todo Implicit --update policy for gpg-pubkey headers.
  + * @param ts            transaction set
  + * @param pkt           pgp pubkey packet(s)
  + * @param pktlen        pgp pubkey length
  + * @return              RPMRC_OK/RPMRC_FAIL
  + */
  +rpmRC rpmtsImportPubkey(rpmts ts,
  +		const unsigned char * pkt, ssize_t pktlen)
  +	/*@globals RPMVERSION, rpmGlobalMacroContext, h_errno,
  +		fileSystem, internalState @*/
  +        /*@modifies ts, rpmGlobalMacroContext,
  +		fileSystem, internalState @*/;
  +
  +/** \ingroup rpmts
    * Close the database used by the transaction to solve dependencies.
    * @param ts		transaction set
    * @return		0 on success
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/python/rpmts-py.c
  ============================================================================
  $ cvs diff -u -r1.65.2.2 -r1.65.2.3 rpmts-py.c
  --- rpm/python/rpmts-py.c	12 Jul 2007 10:54:54 -0000	1.65.2.2
  +++ rpm/python/rpmts-py.c	12 Dec 2007 02:00:09 -0000	1.65.2.3
  @@ -1136,7 +1136,7 @@
       pkt = (unsigned char *) PyString_AsString(blob);
       pktlen = PyString_Size(blob);
   
  -    rc = rpmcliImportPubkey(s->ts, pkt, pktlen);
  +    rc = rpmtsImportPubkey(s->ts, pkt, pktlen);
   
       return Py_BuildValue("i", rc);
   }
  @@ .
Received on Wed Dec 12 03:00:10 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.