RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/rpmdb/ rpmdb.c

From: Jeff Johnson <jbj@rpm5.org>
Date: Thu 06 Sep 2007 - 10:13:26 CEST
Message-Id: <20070906081326.10A3F34845E@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:   06-Sep-2007 10:13:26
  Branch: HEAD                             Handle: 2007090609132500

  Modified files:
    rpm                     CHANGES
    rpm/rpmdb               rpmdb.c

  Log:
    - rpm.org: permit mire RE's against binary data. Useless ... (#277161).
    - rpm.org: mire RE against missing data now mis-matches rather than matches.

  Summary:
    Revision    Changes     Path
    1.1619      +2  -0      rpm/CHANGES
    1.155       +34 -3      rpm/rpmdb/rpmdb.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1618 -r1.1619 CHANGES
  --- rpm/CHANGES	6 Sep 2007 07:42:22 -0000	1.1618
  +++ rpm/CHANGES	6 Sep 2007 08:13:25 -0000	1.1619
  @@ -1,4 +1,6 @@
   4.5 -> 5.0:
  +    - rpm.org: permit mire RE's against binary data. Useless ... (#277161).
  +    - rpm.org: mire RE against missing data now mis-matches rather than matches.
       - jbj: remove ancient %verifyscript tag != 1079 retrofit.
       - rpm.org: fix whitespace-in-files issues in find-debuginfo.sh.
       - rpm.org: new debuginfo script.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmdb.c
  ============================================================================
  $ cvs diff -u -r1.154 -r1.155 rpmdb.c
  --- rpm/rpmdb/rpmdb.c	6 Sep 2007 00:32:50 -0000	1.154
  +++ rpm/rpmdb/rpmdb.c	6 Sep 2007 08:13:25 -0000	1.155
  @@ -123,6 +123,29 @@
       return 0;
   }
   
  +/**
  + * Convert binary blob to printable hex string.
  + * @param data		binary data
  + * @param size		size of data in bytes
  + * @return		malloc'd hex string
  + */
  +static char * bin2hex(const void *data, size_t size)
  +{
  +    static char hex[] = "0123456789abcdef";
  +    const char * s = data;
  +    char * t, * val;
  +    val = t = xmalloc(size * 2 + 1);
  +    while (size-- > 0) {
  +	unsigned int i;
  +	i = *s++;
  +	*t++ = hex[ (i >> 4) & 0xf ];
  +	*t++ = hex[ (i     ) & 0xf ];
  +    }
  +    *t = '\0';
  +
  +    return val;
  +}
  +
   #ifdef	DYING
   /**
    * Check key for printable characters.
  @@ -2138,8 +2161,10 @@
   	int anymatch;
   
   	if (!hge(mi->mi_h, mire->tag, &t, (void **)&u, &c)) {
  -	    if (mire->tag != RPMTAG_EPOCH)
  +	    if (mire->tag != RPMTAG_EPOCH) {
  +		ntags++;
   		continue;
  +	    }
   	    t = RPM_INT32_TYPE;
   /*@-immediatetrans@*/
   	    u.i32p = &zero;
  @@ -2184,8 +2209,14 @@
   		    }
   		}
   		/*@switchbreak@*/ break;
  -	    case RPM_NULL_TYPE:
   	    case RPM_BIN_TYPE:
  +	    {   const char * s = bin2hex(u.ptr, c);
  +		rc = mireRegexec(mire, s);
  +		if ((!rc && !mire->notmatch) || (rc && mire->notmatch))
  +		    anymatch++;
  +		s = _free(s);
  +	    }   /*@switchbreak@*/ break;
  +	    case RPM_NULL_TYPE:
   	    default:
   		/*@switchbreak@*/ break;
   	    }
  @@ -2203,9 +2234,9 @@
   	else
   	    u.ptr = hfd(u.ptr, t);
   
  -	ntags++;
   	if (anymatch)
   	    nmatches++;
  +	ntags++;
       }
   
       return (ntags > 0 && ntags == nmatches ? 0 : 1);
  @@ .
Received on Thu Sep 6 10:13:26 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.