From a0eba154d3e138792cbfc004135e7ab7310e0e6a Mon Sep 17 00:00:00 2001 From: kris Date: Tue, 18 Apr 2000 06:25:24 +0000 Subject: If stderr is closed, report the error message about missing libraries via syslog instead. Reviewed by: jkh --- crypto/openssl/crypto/rsa/rsa_stubs.c | 22 ++++++++++++++++------ crypto/openssl/rsaref/rsaref_stubs.c | 20 +++++++++++++++----- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/crypto/openssl/crypto/rsa/rsa_stubs.c b/crypto/openssl/crypto/rsa/rsa_stubs.c index 6189a4c..406d00a 100644 --- a/crypto/openssl/crypto/rsa/rsa_stubs.c +++ b/crypto/openssl/crypto/rsa/rsa_stubs.c @@ -29,6 +29,8 @@ #ifndef NO_RSA #include +#include +#include #include "cryptlib.h" #include @@ -54,12 +56,20 @@ getsym(const char *sym) if (rsalib) ret = dlsym(rsalib, sym); #ifdef VERBOSE_STUBS - if (!ret && !whined) { - fprintf(stderr, "** %s: Unable to find an RSA implementation shared library.\n", sym); - fprintf(stderr, "** Install either the USA (%s) or International (%s)\n", RSAUSA_SHLIB, RSAINTL_SHLIB); - fprintf(stderr, "** RSA library on your system and run this program again.\n"); - fprintf(stderr, "** See the OpenSSL chapter in the FreeBSD Handbook, located at\n"); - fprintf(stderr, "** http://www.freebsd.org/handbook/openssl.html, for more information.\n"); + if (!ret && !whined) { + if (isatty(STDERR_FILENO)) { + fprintf(stderr, "** %s: Unable to find an RSA implementation shared library.\n", sym); + fprintf(stderr, "** Install either the USA (%s) or International (%s)\n", RSAUSA_SHLIB, RSAINTL_SHLIB); + fprintf(stderr, "** RSA library on your system and run this program again.\n"); + fprintf(stderr, "** See the OpenSSL chapter in the FreeBSD Handbook, located at\n"); + fprintf(stderr, "** http://www.freebsd.org/handbook/openssl.html, for more information.\n"); + } else { + syslog(LOG_ERR, "%s: Unable to find an RSA implementation shared \ +library. Install either the USA (%s) or International (%s) RSA library on \ +your system and run this program again. See the OpenSSL chapter in the \ +FreeBSD Handbook, located at http://www.freebsd.org/handbook/openssl.html, \ +for more information.", sym, RSAUSA_SHLIB, RSAINTL_SHLIB); + } whined = 1; } #endif diff --git a/crypto/openssl/rsaref/rsaref_stubs.c b/crypto/openssl/rsaref/rsaref_stubs.c index d79fcb0..d2a032c 100644 --- a/crypto/openssl/rsaref/rsaref_stubs.c +++ b/crypto/openssl/rsaref/rsaref_stubs.c @@ -40,6 +40,8 @@ #ifndef NO_RSA #include +#include +#include #include #define VERBOSE_STUBS /* undef if you don't want missing rsaref reported */ @@ -61,11 +63,19 @@ getsym(const char *sym) if (rsalib) ret = dlsym(rsalib, sym); #ifdef VERBOSE_STUBS - if (!ret && !whined) { - fprintf(stderr, "** %s: Unable to find an RSAREF shared library (%s).\n", sym, RSA_SHLIB); - fprintf(stderr, "** Install the /usr/ports/security/rsaref port or package and run this\n"); - fprintf(stderr, "** program again. See the OpenSSL chapter in the FreeBSD Handbook, located at\n"); - fprintf(stderr, "** http://www.freebsd.org/handbook/openssl.html, for more information.\n"); + if (!ret && !whined) { + if (isatty(STDERR_FILENO)) { + fprintf(stderr, "** %s: Unable to find an RSAREF shared library (%s).\n", sym, RSA_SHLIB); + fprintf(stderr, "** Install the /usr/ports/security/rsaref port or package and run this\n"); + fprintf(stderr, "** program again. See the OpenSSL chapter in the FreeBSD Handbook, located at\n"); + fprintf(stderr, "** http://www.freebsd.org/handbook/openssl.html, for more information.\n"); + } else { + syslog(LOG_ERR, "** %s: Unable to find an RSAREF shared library \ +(%s). Install the /usr/ports/security/rsaref port or package and run this \ +program again. See the OpenSSL chapter in the FreeBSD Handbook, located at \ +http://www.freebsd.org/handbook/openssl.html, for more information.", \ +sym, RSA_SHLIB); + } whined = 1; } #endif -- cgit v1.1