summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/files.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/build/files.c b/build/files.c
index dfbd6757f..f0c62811a 100644
--- a/build/files.c
+++ b/build/files.c
@@ -18,6 +18,7 @@
#include <rpm/rpmlog.h>
#include "rpmio/rpmio_internal.h" /* XXX rpmioSlurp */
+#include "rpmio/base64.h"
#include "rpmio/fts.h"
#include "lib/cpio.h"
#include "lib/rpmfi_internal.h" /* XXX fi->apath */
@@ -1616,12 +1617,10 @@ static rpmRC processMetadataFile(Package pkg, FileList fl,
break;
case RPMTAG_PUBKEYS: {
if ((xx = pgpReadPkts(fn, &pkt, (size_t *)&pktlen)) <= 0) {
- rc = RPMRC_FAIL;
rpmlog(RPMLOG_ERR, _("%s: public key read failed.\n"), fn);
goto exit;
}
if (xx != PGPARMOR_PUBKEY) {
- rc = RPMRC_FAIL;
rpmlog(RPMLOG_ERR, _("%s: not an armored public key.\n"), fn);
goto exit;
}
@@ -1630,18 +1629,21 @@ static rpmRC processMetadataFile(Package pkg, FileList fl,
}
case RPMTAG_POLICIES:
if ((xx = rpmioSlurp(fn, &pkt, &pktlen)) != 0 || pkt == NULL) {
- rc = RPMRC_FAIL;
- rpmlog(RPMLOG_ERR, _("%s: *.te policy read failed.\n"), fn);
+ rpmlog(RPMLOG_ERR, _("%s: policy file read failed.\n"), fn);
goto exit;
}
- apkt = (char *) pkt; /* XXX unsigned char */
- pkt = NULL;
+ apkt = b64encode(pkt, pktlen, -1);
break;
}
- headerPutString(pkg->header, tag, apkt);
+ if (!apkt) {
+ rpmlog(RPMLOG_ERR, _("%s: failed to encode\n"), fn);
+ goto exit;
+ }
+ headerPutString(pkg->header, tag, apkt);
rc = RPMRC_OK;
+
if (absolute)
rc = addFile(fl, fn, NULL);