From 4252cddc29cd3e60bdc6a0791c6d2dd58fcb3c2e Mon Sep 17 00:00:00 2001 From: jbj Date: Fri, 28 Jun 2002 00:35:57 +0000 Subject: [PATCH] Establish mechanism for up2date to reconfigure rpmlib. Disambiguate failures to import with error messages. CVS patchset: 5528 CVS date: 2002/06/28 00:35:57 --- lib/rpmchecksig.c | 16 ++++++++++++---- rpmio/rpmerr.h | 1 + rpmrc.in | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c index a7e9faa..ec76a9c 100644 --- a/lib/rpmchecksig.c +++ b/lib/rpmchecksig.c @@ -382,10 +382,18 @@ static int rpmImportPubkey(const rpmts ts, Header h = NULL; /* Read pgp packet. */ - if ((rc = pgpReadPkts(fn, &pkt, &pktlen)) <= 0 - || rc != PGPARMOR_PUBKEY - || (enc = b64encode(pkt, pktlen)) == NULL) - { + if ((rc = pgpReadPkts(fn, &pkt, &pktlen)) <= 0) { + rpmError(RPMERR_IMPORT, _("%s: import read failed.\n"), fn); + res++; + goto bottom; + } + if (rc != PGPARMOR_PUBKEY) { + rpmError(RPMERR_IMPORT, _("%s: not an armored public key.\n"), fn); + res++; + goto bottom; + } + if ((enc = b64encode(pkt, pktlen)) == NULL) { + rpmError(RPMERR_IMPORT, _("%s: base64 encode failed.\n"), fn); res++; goto bottom; } diff --git a/rpmio/rpmerr.h b/rpmio/rpmerr.h index 19e3d70..7c07fe4 100644 --- a/rpmio/rpmerr.h +++ b/rpmio/rpmerr.h @@ -127,6 +127,7 @@ typedef enum rpmerrCode_e { RPMERR_BADSIGTYPE = _em(200), /*!< Unknown signature type */ RPMERR_SIGGEN = _em(201), /*!< Error generating signature */ RPMERR_SIGVFY = _nm(202), /*!< */ + RPMERR_IMPORT = _em(203), /*!< */ RPMDEBUG_UNLINK = _dm(512u+16), /*!< unlink(2) failed */ RPMDEBUG_RMDIR = _dm(512u+17), /*!< rmdir(2) failed */ diff --git a/rpmrc.in b/rpmrc.in index c7256d9..9c2dc51 100644 --- a/rpmrc.in +++ b/rpmrc.in @@ -1,7 +1,7 @@ #/*! \page config_rpmrc Default configuration: /usr/lib/rpm/rpmrc # \verbatim # -# $Id: rpmrc.in,v 2.49 2002/06/20 02:19:21 jbj Exp $ +# $Id: rpmrc.in,v 2.50 2002/06/28 00:35:57 jbj Exp $ # # This is a global RPM configuration file. All changes made here will # be lost when the rpm package is upgraded. Any per-system configuration @@ -343,7 +343,7 @@ buildarch_compat: ia64: noarch buildarch_compat: s390: noarch buildarch_compat: s390x: noarch -macrofiles: @RPMCONFIGDIR@/macros:@RPMCONFIGDIR@/%{_target}/macros:@SYSCONFIGDIR@/macros.specspo:@SYSCONFIGDIR@/macros.prelink:@SYSCONFIGDIR@/macros:@SYSCONFIGDIR@/%{_target}/macros:~/.rpmmacros +macrofiles: @RPMCONFIGDIR@/macros:@RPMCONFIGDIR@/%{_target}/macros:@SYSCONFIGDIR@/macros.specspo:@SYSCONFIGDIR@/macros.prelink:@SYSCONFIGDIR@/macros.up2date:@SYSCONFIGDIR@/macros:@SYSCONFIGDIR@/%{_target}/macros:~/.rpmmacros # \endverbatim #*/ -- 2.7.4