From f73dc64cd6dba290a7e062520a421de2b02f82a4 Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Fri, 14 May 2004 03:50:47 +0000 Subject: change apache 2 method to use optional function --- mod_log_sql_ssl.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/mod_log_sql_ssl.c b/mod_log_sql_ssl.c index 8b792db..d94a79f 100644 --- a/mod_log_sql_ssl.c +++ b/mod_log_sql_ssl.c @@ -26,9 +26,11 @@ #include "mod_ssl.h" #if defined(WITH_APACHE20) -# define TEST_SSL(r) myConnConfig(r->connection) +static APR_OPTIONAL_FN_TYPE(ssl_var_lookup) *header_ssl_lookup = NULL; +# define TEST_SSL(r) header_ssl_lookup #elif defined(WITH_APACHE13) # define TEST_SSL(r) ap_ctx_get(r->connection->client->ctx, "ssl") +# define header_ssl_lookup ssl_var_lookup #endif static const char *extract_ssl_keysize(request_rec *r, char *a) @@ -36,11 +38,12 @@ static const char *extract_ssl_keysize(request_rec *r, char *a) char *result = NULL; if (TEST_SSL(r) != NULL) { - result = ssl_var_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER_USEKEYSIZE"); + result = header_ssl_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER_USEKEYSIZE"); log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_KEYSIZE: %s", result); - if (result != NULL && result[0] == '\0') - result = NULL; - return result; + if (result && result[0]) + return result; + else + return "0"; } else { return "0"; } @@ -51,12 +54,13 @@ static const char *extract_ssl_maxkeysize(request_rec *r, char *a) char *result = NULL; if (TEST_SSL(r) != NULL) { - result = ssl_var_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER_ALGKEYSIZE"); + result = header_ssl_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER_ALGKEYSIZE"); log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_ALGKEYSIZE: %s", result); - if (result != NULL && result[0] == '\0') - result = NULL; - return result; - } else { + if (result && result[0]) + return result; + else + return "0"; + } else { return "0"; } } @@ -66,11 +70,12 @@ static const char *extract_ssl_cipher(request_rec *r, char *a) char *result = NULL; if (TEST_SSL(r) != NULL) { - result = ssl_var_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER"); + result = header_ssl_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER"); log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_CIPHER: %s", result); - if (result != NULL && result[0] == '\0') - result = NULL; - return result; + if (result && result[0]) + return result; + else + return "0"; } else { return "-"; } @@ -82,5 +87,8 @@ LOGSQL_REGISTER(ssl) log_sql_register_item(s,p,'q', extract_ssl_keysize, "ssl_keysize", 0, 1); log_sql_register_item(s,p,'Q', extract_ssl_maxkeysize, "ssl_maxkeysize", 0, 1); log_sql_register_item(s,p,'z', extract_ssl_cipher, "ssl_cipher", 0, 1); +#if defined(WITH_APACHE20) + header_ssl_lookup = APR_RETRIEVE_OPTIONAL_FN(ssl_var_lookup); +#endif LOGSQL_REGISTER_RETURN; } -- cgit