Failure to initialize crypto is fatal

- Almost nothing works if crypto fails to initialize for whatever reason,
  check and propagate rpmInitCrypto() failure from rpmReadConfigFiles().
- Logging the error left for individual crypto backends to let them
  identify themselves: beecrypt requires no initialization whatsoever
  so it cannot fail at all, but NSS can fail in a number of entertaining
  ways due to missing dlopen()'ed bits and pieces, this should help
  avoiding wild-goose chases in such cases (RhBug:909627, RhBug:909618...)
This commit is contained in:
Panu Matilainen 2013-02-12 05:14:34 +02:00
parent 65d2e787d5
commit cca91666d0
2 changed files with 3 additions and 1 deletions

View File

@ -1607,7 +1607,8 @@ int rpmReadConfigFiles(const char * file, const char * target)
{
/* Force preloading of dlopen()'ed libraries in case we go chrooting */
(void) gethostbyname("localhost");
(void) rpmInitCrypto();
if (rpmInitCrypto())
return -1;
/* Preset target macros */
/* FIX: target can be NULL */

View File

@ -62,6 +62,7 @@ int rpmInitCrypto(void)
#else
if (NSS_NoDB_Init(NULL) != SECSuccess) {
#endif
rpmlog(RPMLOG_ERR, _("Failed to initialize NSS library\n"));
rc = -1;
} else {
_crypto_initialized = 1;