From 466df80338fdae61367369b45bea2b0d508261d3 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 5 Sep 2007 13:43:57 +0300 Subject: 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 --- rpmdb/rpmdb.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'rpmdb/rpmdb.c') 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) -- cgit v1.2.3