You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2007/11/21 14:35:59 UTC

svn commit: r597077 - /httpd/httpd/trunk/modules/ssl/ssl_engine_log.c

Author: jorton
Date: Wed Nov 21 05:35:59 2007
New Revision: 597077

URL: http://svn.apache.org/viewvc?rev=597077&view=rev
Log:
* 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 <steve openssl.org>, jorton

Modified:
    httpd/httpd/trunk/modules/ssl/ssl_engine_log.c

Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_log.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_log.c?rev=597077&r1=597076&r2=597077&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_engine_log.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_engine_log.c Wed Nov 21 05:35:59 2007
@@ -79,23 +79,31 @@
 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();
     }
 }