summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-09-05 13:43:57 +0300
committerPanu Matilainen <pmatilai@redhat.com>2007-09-05 13:43:57 +0300
commit466df80338fdae61367369b45bea2b0d508261d3 (patch)
tree5f45f7b857f17b56b3d175cc1d0f90f55b9731af
parentc30b41cfe9475860db231c2a03fe2becaf90c4b2 (diff)
downloadlibrpm-tizen-466df80338fdae61367369b45bea2b0d508261d3.tar.gz
librpm-tizen-466df80338fdae61367369b45bea2b0d508261d3.tar.bz2
librpm-tizen-466df80338fdae61367369b45bea2b0d508261d3.zip
Handle mire matching against binary blobs (rhbz#277161)
- convert blob to hex string, miregexec() against that - use tagType() to determine if header data needs freeing
-rw-r--r--rpmdb/rpmdb.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c
index c509f262b..f29ad7ab9 100644
--- a/rpmdb/rpmdb.c
+++ b/rpmdb/rpmdb.c
@@ -2080,8 +2080,16 @@ static int mireSkip (const rpmdbMatchIterator mi)
}
}
/*@switchbreak@*/ break;
- case RPM_NULL_TYPE:
case RPM_BIN_TYPE:
+ {
+ const char * str = bin2hex((const char*) u.ptr, c);
+ rc = miregexec(mire, str);
+ if ((!rc && !mire->notmatch) || (rc && mire->notmatch))
+ anymatch++;
+ _free(str);
+ }
+ /*@switchbreak@*/ break;
+ case RPM_NULL_TYPE:
default:
/*@switchbreak@*/ break;
}
@@ -2094,7 +2102,10 @@ static int mireSkip (const rpmdbMatchIterator mi)
}
/*@=boundsread@*/
- u.ptr = hfd(u.ptr, t);
+ if ((tagType(mire->tag) & RPM_MASK_RETURN_TYPE) ==
+ RPM_ARRAY_RETURN_TYPE) {
+ u.ptr = hfd(u.ptr, t);
+ }
ntags++;
if (anymatch)