Dump debugginfo trace to the log file. */
| 2024 | |
| 2025 | /* Dump debugginfo trace to the log file. */ |
| 2026 | static void log_tracing_state(const SSL *ssl, conn_rec *c, |
| 2027 | server_rec *s, int where, int rc) |
| 2028 | { |
| 2029 | /* |
| 2030 | * create the various trace messages |
| 2031 | */ |
| 2032 | if (where & SSL_CB_HANDSHAKE_START) { |
| 2033 | ap_log_cerror(APLOG_MARK, APLOG_TRACE3, 0, c, |
| 2034 | "%s: Handshake: start", MODSSL_LIBRARY_NAME); |
| 2035 | } |
| 2036 | else if (where & SSL_CB_HANDSHAKE_DONE) { |
| 2037 | ap_log_cerror(APLOG_MARK, APLOG_TRACE3, 0, c, |
| 2038 | "%s: Handshake: done", MODSSL_LIBRARY_NAME); |
| 2039 | } |
| 2040 | else if (where & SSL_CB_LOOP) { |
| 2041 | ap_log_cerror(APLOG_MARK, APLOG_TRACE3, 0, c, |
| 2042 | "%s: Loop: %s", |
| 2043 | MODSSL_LIBRARY_NAME, SSL_state_string_long(ssl)); |
| 2044 | } |
| 2045 | else if (where & SSL_CB_READ) { |
| 2046 | ap_log_cerror(APLOG_MARK, APLOG_TRACE3, 0, c, |
| 2047 | "%s: Read: %s", |
| 2048 | MODSSL_LIBRARY_NAME, SSL_state_string_long(ssl)); |
| 2049 | } |
| 2050 | else if (where & SSL_CB_WRITE) { |
| 2051 | ap_log_cerror(APLOG_MARK, APLOG_TRACE3, 0, c, |
| 2052 | "%s: Write: %s", |
| 2053 | MODSSL_LIBRARY_NAME, SSL_state_string_long(ssl)); |
| 2054 | } |
| 2055 | else if (where & SSL_CB_ALERT) { |
| 2056 | char *str = (where & SSL_CB_READ) ? "read" : "write"; |
| 2057 | ap_log_cerror(APLOG_MARK, APLOG_TRACE3, 0, c, |
| 2058 | "%s: Alert: %s:%s:%s", |
| 2059 | MODSSL_LIBRARY_NAME, str, |
| 2060 | SSL_alert_type_string_long(rc), |
| 2061 | SSL_alert_desc_string_long(rc)); |
| 2062 | } |
| 2063 | else if (where & SSL_CB_EXIT) { |
| 2064 | if (rc == 0) { |
| 2065 | ap_log_cerror(APLOG_MARK, APLOG_TRACE3, 0, c, |
| 2066 | "%s: Exit: failed in %s", |
| 2067 | MODSSL_LIBRARY_NAME, SSL_state_string_long(ssl)); |
| 2068 | } |
| 2069 | else if (rc < 0) { |
| 2070 | ap_log_cerror(APLOG_MARK, APLOG_TRACE3, 0, c, |
| 2071 | "%s: Exit: error in %s", |
| 2072 | MODSSL_LIBRARY_NAME, SSL_state_string_long(ssl)); |
| 2073 | } |
| 2074 | } |
| 2075 | |
| 2076 | /* |
| 2077 | * Because SSL renegotiations can happen at any time (not only after |
| 2078 | * SSL_accept()), the best way to log the current connection details is |
| 2079 | * right after a finished handshake. |
| 2080 | */ |
| 2081 | if (where & SSL_CB_HANDSHAKE_DONE) { |
| 2082 | ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(02041) |
| 2083 | "Protocol: %s, Cipher: %s (%s/%s bits)", |
no test coverage detected