1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
/* $Header: /home/cvs/mod_log_sql/mod_log_sql_ssl.c,v 1.4 2004/01/22 05:26:56 urkle Exp $ */
/* mod_log_sql_ssl */
#if defined(WITH_APACHE20)
# include "apache20.h"
#elif defined(WITH_APACHE13)
# include "apache13.h"
#else
# error Unsupported Apache version
#endif
#ifdef HAVE_CONFIG_H
/* Undefine these to prevent conflicts between Apache ap_config_auto.h and
* my config.h. Only really needed for Apache < 2.0.48, but it can't hurt.
*/
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#include "config.h"
#endif
#include "mod_log_sql.h"
#include "mod_ssl.h"
#if defined(WITH_APACHE20)
# define TEST_SSL(r) myConnConfig(r->connection)
#elif defined(WITH_APACHE13)
# define TEST_SSL(r) ap_ctx_get(r->connection->client->ctx, "ssl")
#endif
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");
#ifdef DEBUG
log_error(APLOG_MARK,APLOG_DEBUG,0,r->server,"SSL_KEYSIZE: %s", result);
#endif
if (result != NULL && result[0] == '\0')
result = NULL;
return result;
} else {
return "0";
}
}
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");
#ifdef DEBUG
log_error(APLOG_MARK,APLOG_DEBUG,0,r->server,"SSL_ALGKEYSIZE: %s", result);
#endif
if (result != NULL && result[0] == '\0')
result = NULL;
return result;
} else {
return "0";
}
}
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");
#ifdef DEBUG
log_error(APLOG_MARK,APLOG_DEBUG,0,r->server,"SSL_CIPHER: %s", result);
#endif
if (result != NULL && result[0] == '\0')
result = NULL;
return result;
} else {
return "-";
}
}
#if defined(WITH_APACHE20)
static int post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
#elif defined(WITH_APACHE13)
static void module_init(server_rec *s, apr_pool_t *p)
#endif
{
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)
return OK;
#endif
}
/* The configuration array that sets up the hooks into the module. */
#if defined(WITH_APACHE20)
static void register_hooks(apr_pool_t *p) {
ap_hook_post_config(post_config, NULL, NULL, APR_HOOK_REALLY_FIRST);
}
module AP_MODULE_DECLARE_DATA log_sql_ssl_module = {
STANDARD20_MODULE_STUFF,
NULL, /* create per-directory config structures */
NULL, /* merge per-directory config structures */
NULL, /* create per-server config structures */
NULL, /* merge per-server config structures */
NULL, /* command handlers */
register_hooks /* register hooks */
};
#elif defined(WITH_APACHE13)
module log_sql_ssl_module = {
STANDARD_MODULE_STUFF,
module_init, /* module initializer */
NULL, /* create per-dir config */
NULL, /* merge per-dir config */
NULL, /* create server config */
NULL, /* merge server config */
NULL, /* config directive table */
NULL, /* [9] content handlers */
NULL, /* [2] URI-to-filename translation */
NULL, /* [5] check/validate user_id */
NULL, /* [6] check authorization */
NULL, /* [4] check access by host */
NULL, /* [7] MIME type checker/setter */
NULL, /* [8] fixups */
NULL, /* [10] logger */
NULL /* [3] header parser */
#if MODULE_MAGIC_NUMBER >= 19970728 /* 1.3-dev or later support these additionals... */
,NULL, /* child process initializer */
NULL, /* process exit/cleanup */
NULL /* [1] post read-request */
#endif
};
#endif
|