From: Joe Orton Date: Wed, 21 Nov 2007 13:35:59 +0000 (+0000) Subject: * modules/ssl/ssl_engine_log.c (ssl_log_ssl_error): Improve SSL error X-Git-Tag: 2.3.0~1235 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=69c7c5701269efb610e8b8688e5e889556057ae5;p=apache * modules/ssl/ssl_engine_log.c (ssl_log_ssl_error): Improve SSL error log messages: retrieve and log the "data" string where available, drop the redundant error number (always included in the error string anyway), and clearly delineate both the "data" and "annotation" from the error string itself. PR: 43889 Submitted by: Dr Stephen Henson , jorton git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@597077 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/ssl/ssl_engine_log.c b/modules/ssl/ssl_engine_log.c index 883274bf42..d573a7312c 100644 --- a/modules/ssl/ssl_engine_log.c +++ b/modules/ssl/ssl_engine_log.c @@ -79,23 +79,31 @@ void ssl_die(void) void ssl_log_ssl_error(const char *file, int line, int level, server_rec *s) { unsigned long e; + const char *data; + int flags; - while ((e = ERR_get_error())) { + while ((e = ERR_peek_error_line_data(NULL, NULL, &data, &flags))) { const char *annotation; char err[256]; + if (!(flags & ERR_TXT_STRING)) { + data = NULL; + } + ERR_error_string_n(e, err, sizeof err); annotation = ssl_log_annotation(err); - if (annotation) { - ap_log_error(file, line, level, 0, s, - "SSL Library Error: %lu %s %s", - e, err, annotation); - } - else { - ap_log_error(file, line, level, 0, s, - "SSL Library Error: %lu %s", - e, err); - } + ap_log_error(file, line, level, 0, s, + "SSL Library Error: %s%s%s%s%s%s", + /* %s */ + err, + /* %s%s%s */ + data ? " (" : "", data ? data : "", data ? ")" : "", + /* %s%s */ + annotation ? " -- " : "", + annotation ? annotation : ""); + + /* Pop the error off the stack: */ + ERR_get_error(); } }