1 diff --git a/configure.ac b/configure.ac
2 index 192a838..4ddd127 100644
5 @@ -200,12 +200,11 @@ AC_CHECK_LIB(bz2, BZ2_decompress,
6 AM_CONDITIONAL(HAVE_BZ2, false))],
7 AM_CONDITIONAL(HAVE_BZ2, false))
9 -AC_CHECK_LIB(rpm, rpmReadPackageFile,
10 - [AC_CHECK_HEADERS([rpm/rpmlib.h],
11 - AM_CONDITIONAL(HAVE_LIBRPM, true)
12 - AC_DEFINE(HAVE_LIBRPM,1,[Have librpm]),
13 - AM_CONDITIONAL(HAVE_LIBRPM, false))],
14 - AM_CONDITIONAL(HAVE_LIBRPM, false))
15 +PKG_CHECK_MODULES(RPM, rpm,
16 + AM_CONDITIONAL(HAVE_LIBRPM, true)
17 + AC_DEFINE([HAVE_LIBRPM],[1], "RPM..."),
18 + AM_CONDITIONAL(HAVE_LIBRPM, false)
21 AC_CHECK_LIB(mpeg2, mpeg2_init,
22 [AC_CHECK_HEADERS([mpeg2dec/mpeg2.h],
23 --- libextractor-1.6/src/plugins/Makefile.am.orig 2017-10-09 15:29:32.000000000 +0200
24 +++ libextractor-1.6/src/plugins/Makefile.am 2017-12-07 18:27:17.926353030 +0100
26 # This Makefile.am is in the public domain
28 -I$(top_srcdir)/src/include \
29 - -I$(top_srcdir)/src/common
30 + -I$(top_srcdir)/src/common \
34 # install plugins under:
35 --- libextractor-1.10/src/plugins/rpm_extractor.c.orig 2020-03-03 12:54:56.000000000 +0100
36 +++ libextractor-1.10/src/plugins/rpm_extractor.c 2020-07-04 18:52:32.521839942 +0200
39 #include "extractor.h"
41 -#include <rpm/rpmlib.h>
42 -#include <rpm/rpmts.h>
43 -#include <rpm/rpmlog.h>
49 #include <pthread_np.h>
51 @@ -128,6 +129,7 @@ pipe_feeder (void *args)
52 * LOG callback called by librpm. Does nothing, we
53 * just need this to override the default behavior.
55 +#ifdef RPMLOG_DEFAULT
57 discard_log_callback (rpmlogRec rec,
59 @@ -135,6 +137,9 @@ discard_log_callback (rpmlogRec rec,
64 +static void discard_log_callback() { }
69 @@ -240,6 +245,12 @@ static struct Matches tests[] = {
74 +static int headerNext(HeaderIterator hi, HE_t he, /*@unused@*/ unsigned int flags)
76 + return headerNextIterator(hi, &he->tag, &he->t, &he->p.ptr, &he->c);
81 * Main entry method for the 'application/x-rpm' extraction plugin.
82 @@ -255,7 +266,7 @@ EXTRACTOR_rpm_extract_method (struct EXT
91 @@ -286,7 +297,11 @@ EXTRACTOR_rpm_extract_method (struct EXT
95 +#ifdef RPMLOG_DEFAULT
96 rpmlogSetCallback (&discard_log_callback, NULL);
98 + rpmlogSetCallback (&discard_log_callback);
100 fdi = fdDup (parg.pi[0]);
102 rc = rpmReadPackageFile (ts, fdi, "GNU libextractor", &hdr);
103 @@ -314,19 +329,35 @@ EXTRACTOR_rpm_extract_method (struct EXT
106 pthread_mutex_unlock (&parg.lock);
108 + hi = headerInit (hdr);
109 + p = (HE_t)memset(alloca(sizeof(*p)), 0, sizeof(*p));
110 + while (1 == headerNext (hi, p, 0))
112 hi = headerInitIterator (hdr);
114 while (1 == headerNext (hi, p))
116 for (i = 0; 0 != tests[i].rtype; i++)
118 if (tests[i].rtype != p->tag)
123 + case RPM_STRING_TYPE:
125 + pthread_mutex_lock (&parg.lock);
126 + if (0 != ec->proc (ec->cls, "rpm", tests[i].type, EXTRACTOR_METAFORMAT_UTF8,
127 + "text/plain", p->p.str, strlen (p->p.str) +1)) {
128 + pthread_mutex_unlock (&parg.lock);
131 + pthread_mutex_unlock (&parg.lock);
134 case RPM_STRING_ARRAY_TYPE:
135 case RPM_I18NSTRING_TYPE:
136 - case RPM_STRING_TYPE:
137 - while (NULL != (str = rpmtdNextString (p)))
138 + for(p->ix = 0; p->ix < p->c; p->ix++)
140 pthread_mutex_lock (&parg.lock);
141 if (0 != ec->proc (ec->cls,
142 @@ -334,8 +365,8 @@ EXTRACTOR_rpm_extract_method (struct EXT
144 EXTRACTOR_METAFORMAT_UTF8,
149 + strlen (p->p.argv[p->ix]) + 1))
152 pthread_mutex_unlock (&parg.lock);
153 @@ -344,12 +375,12 @@ EXTRACTOR_rpm_extract_method (struct EXT
154 pthread_mutex_unlock (&parg.lock);
157 - case RPM_INT32_TYPE:
158 + case RPM_UINT32_TYPE:
160 if (p->tag == RPMTAG_BUILDTIME)
163 - uint32_t *v = rpmtdNextUint32 (p);
164 + uint32_t *v = p->p.ui32p;
165 time_t tp = (time_t) *v;
167 if (NULL == ctime_r (&tp, tmp))
168 @@ -374,7 +405,7 @@ EXTRACTOR_rpm_extract_method (struct EXT
172 - uint32_t *s = rpmtdNextUint32 (p);
173 + uint32_t *s = p->p.ui32p;
177 @@ -401,7 +432,6 @@ EXTRACTOR_rpm_extract_method (struct EXT
182 headerFreeIterator (hi);