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
|
/* $Id: mod_log_sql_ssl.c,v 1.7 2004/03/05 00:30:58 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");
log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_KEYSIZE: %s", result);
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");
log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_ALGKEYSIZE: %s", result);
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");
log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_CIPHER: %s", result);
if (result != NULL && result[0] == '\0')
result = NULL;
return result;
} else {
return "-";
}
}
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);
LOGSQL_REGISTER_RETURN;
}
|