diff options
author | Edward Rudd | 2004-05-14 03:50:47 +0000 |
---|---|---|
committer | Edward Rudd | 2004-05-14 03:50:47 +0000 |
commit | f73dc64cd6dba290a7e062520a421de2b02f82a4 (patch) | |
tree | 929f778434400553c6ebd6b10950eddd7592c545 | |
parent | 8874f39a6a9dc9d2e1520273dbe5f1c087224152 (diff) |
change apache 2 method to use optional function
-rw-r--r-- | mod_log_sql_ssl.c | 36 |
1 files 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 @@ | |||
26 | #include "mod_ssl.h" | 26 | #include "mod_ssl.h" |
27 | 27 | ||
28 | #if defined(WITH_APACHE20) | 28 | #if defined(WITH_APACHE20) |
29 | # define TEST_SSL(r) myConnConfig(r->connection) | 29 | static APR_OPTIONAL_FN_TYPE(ssl_var_lookup) *header_ssl_lookup = NULL; |
30 | # define TEST_SSL(r) header_ssl_lookup | ||
30 | #elif defined(WITH_APACHE13) | 31 | #elif defined(WITH_APACHE13) |
31 | # define TEST_SSL(r) ap_ctx_get(r->connection->client->ctx, "ssl") | 32 | # define TEST_SSL(r) ap_ctx_get(r->connection->client->ctx, "ssl") |
33 | # define header_ssl_lookup ssl_var_lookup | ||
32 | #endif | 34 | #endif |
33 | 35 | ||
34 | static const char *extract_ssl_keysize(request_rec *r, char *a) | 36 | 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) | |||
36 | char *result = NULL; | 38 | char *result = NULL; |
37 | if (TEST_SSL(r) != NULL) | 39 | if (TEST_SSL(r) != NULL) |
38 | { | 40 | { |
39 | result = ssl_var_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER_USEKEYSIZE"); | 41 | result = header_ssl_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER_USEKEYSIZE"); |
40 | log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_KEYSIZE: %s", result); | 42 | log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_KEYSIZE: %s", result); |
41 | if (result != NULL && result[0] == '\0') | 43 | if (result && result[0]) |
42 | result = NULL; | 44 | return result; |
43 | return result; | 45 | else |
46 | return "0"; | ||
44 | } else { | 47 | } else { |
45 | return "0"; | 48 | return "0"; |
46 | } | 49 | } |
@@ -51,12 +54,13 @@ static const char *extract_ssl_maxkeysize(request_rec *r, char *a) | |||
51 | char *result = NULL; | 54 | char *result = NULL; |
52 | if (TEST_SSL(r) != NULL) | 55 | if (TEST_SSL(r) != NULL) |
53 | { | 56 | { |
54 | result = ssl_var_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER_ALGKEYSIZE"); | 57 | result = header_ssl_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER_ALGKEYSIZE"); |
55 | log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_ALGKEYSIZE: %s", result); | 58 | log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_ALGKEYSIZE: %s", result); |
56 | if (result != NULL && result[0] == '\0') | 59 | if (result && result[0]) |
57 | result = NULL; | 60 | return result; |
58 | return result; | 61 | else |
59 | } else { | 62 | return "0"; |
63 | } else { | ||
60 | return "0"; | 64 | return "0"; |
61 | } | 65 | } |
62 | } | 66 | } |
@@ -66,11 +70,12 @@ static const char *extract_ssl_cipher(request_rec *r, char *a) | |||
66 | char *result = NULL; | 70 | char *result = NULL; |
67 | if (TEST_SSL(r) != NULL) | 71 | if (TEST_SSL(r) != NULL) |
68 | { | 72 | { |
69 | result = ssl_var_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER"); | 73 | result = header_ssl_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER"); |
70 | log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_CIPHER: %s", result); | 74 | log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_CIPHER: %s", result); |
71 | if (result != NULL && result[0] == '\0') | 75 | if (result && result[0]) |
72 | result = NULL; | 76 | return result; |
73 | return result; | 77 | else |
78 | return "0"; | ||
74 | } else { | 79 | } else { |
75 | return "-"; | 80 | return "-"; |
76 | } | 81 | } |
@@ -82,5 +87,8 @@ LOGSQL_REGISTER(ssl) | |||
82 | log_sql_register_item(s,p,'q', extract_ssl_keysize, "ssl_keysize", 0, 1); | 87 | log_sql_register_item(s,p,'q', extract_ssl_keysize, "ssl_keysize", 0, 1); |
83 | log_sql_register_item(s,p,'Q', extract_ssl_maxkeysize, "ssl_maxkeysize", 0, 1); | 88 | log_sql_register_item(s,p,'Q', extract_ssl_maxkeysize, "ssl_maxkeysize", 0, 1); |
84 | log_sql_register_item(s,p,'z', extract_ssl_cipher, "ssl_cipher", 0, 1); | 89 | log_sql_register_item(s,p,'z', extract_ssl_cipher, "ssl_cipher", 0, 1); |
90 | #if defined(WITH_APACHE20) | ||
91 | header_ssl_lookup = APR_RETRIEVE_OPTIONAL_FN(ssl_var_lookup); | ||
92 | #endif | ||
85 | LOGSQL_REGISTER_RETURN; | 93 | LOGSQL_REGISTER_RETURN; |
86 | } | 94 | } |