]> granicus.if.org Git - apache/commitdiff
* modules/ssl/ssl_engine_log.c (ssl_log_ssl_error): Improve SSL error
authorJoe Orton <jorton@apache.org>
Wed, 21 Nov 2007 13:35:59 +0000 (13:35 +0000)
committerJoe Orton <jorton@apache.org>
Wed, 21 Nov 2007 13:35:59 +0000 (13:35 +0000)
  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 <steve openssl.org>, jorton

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@597077 13f79535-47bb-0310-9956-ffa450edef68

modules/ssl/ssl_engine_log.c

index 883274bf422ade04c76d6f778f78085432cc480f..d573a7312c279fae031d033f42798498e7ab75a3 100644 (file)
@@ -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();
     }
 }