diff options
author | Paul Querna | 2004-09-27 20:00:52 +0000 |
---|---|---|
committer | Paul Querna | 2004-09-27 20:00:52 +0000 |
commit | 2e1222695cd6c9b6d9a797bd5383e7618c3eea85 (patch) | |
tree | d52e5b19980fad23c3b7fe941d3bafd50d4d812e /src/mod_gnutls.c | |
parent | 7e2b223a9e00d4cc7cd60a198e50c366c64c610a (diff) |
rename structures.
properly prefix all non-static functions with mod_gnutls_
fix build for GnuTLS 1.0.X. (redefine the changed structure names)
Diffstat (limited to 'src/mod_gnutls.c')
-rw-r--r-- | src/mod_gnutls.c | 89 |
1 files changed, 47 insertions, 42 deletions
diff --git a/src/mod_gnutls.c b/src/mod_gnutls.c index 14bf319..c34da5a 100644 --- a/src/mod_gnutls.c +++ b/src/mod_gnutls.c | |||
@@ -21,14 +21,14 @@ | |||
21 | GCRY_THREAD_OPTION_PTHREAD_IMPL; | 21 | GCRY_THREAD_OPTION_PTHREAD_IMPL; |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | static apr_status_t gnutls_cleanup_pre_config(void *data) | 24 | static apr_status_t mod_gnutls_cleanup_pre_config(void *data) |
25 | { | 25 | { |
26 | gnutls_global_deinit(); | 26 | gnutls_global_deinit(); |
27 | return APR_SUCCESS; | 27 | return APR_SUCCESS; |
28 | } | 28 | } |
29 | 29 | ||
30 | static int gnutls_hook_pre_config(apr_pool_t * pconf, | 30 | static int mod_gnutls_hook_pre_config(apr_pool_t * pconf, |
31 | apr_pool_t * plog, apr_pool_t * ptemp) | 31 | apr_pool_t * plog, apr_pool_t * ptemp) |
32 | { | 32 | { |
33 | 33 | ||
34 | #if APR_HAS_THREADS | 34 | #if APR_HAS_THREADS |
@@ -37,7 +37,7 @@ static int gnutls_hook_pre_config(apr_pool_t * pconf, | |||
37 | 37 | ||
38 | gnutls_global_init(); | 38 | gnutls_global_init(); |
39 | 39 | ||
40 | apr_pool_cleanup_register(pconf, NULL, gnutls_cleanup_pre_config, | 40 | apr_pool_cleanup_register(pconf, NULL, mod_gnutls_cleanup_pre_config, |
41 | apr_pool_cleanup_null); | 41 | apr_pool_cleanup_null); |
42 | 42 | ||
43 | return OK; | 43 | return OK; |
@@ -46,11 +46,11 @@ static int gnutls_hook_pre_config(apr_pool_t * pconf, | |||
46 | #define DH_BITS 1024 | 46 | #define DH_BITS 1024 |
47 | #define RSA_BITS 512 | 47 | #define RSA_BITS 512 |
48 | 48 | ||
49 | static int gnutls_hook_post_config(apr_pool_t * p, apr_pool_t * plog, | 49 | static int mod_gnutls_hook_post_config(apr_pool_t * p, apr_pool_t * plog, |
50 | apr_pool_t * ptemp, | 50 | apr_pool_t * ptemp, |
51 | server_rec * base_server) | 51 | server_rec * base_server) |
52 | { | 52 | { |
53 | gnutls_srvconf_rec *sc; | 53 | mod_gnutls_srvconf_rec *sc; |
54 | server_rec *s; | 54 | server_rec *s; |
55 | gnutls_dh_params_t dh_params; | 55 | gnutls_dh_params_t dh_params; |
56 | gnutls_rsa_params_t rsa_params; | 56 | gnutls_rsa_params_t rsa_params; |
@@ -63,8 +63,8 @@ static int gnutls_hook_post_config(apr_pool_t * p, apr_pool_t * plog, | |||
63 | // gnutls_rsa_params_generate2(rsa_params, RSA_BITS); | 63 | // gnutls_rsa_params_generate2(rsa_params, RSA_BITS); |
64 | 64 | ||
65 | for (s = base_server; s; s = s->next) { | 65 | for (s = base_server; s; s = s->next) { |
66 | sc = (gnutls_srvconf_rec *) ap_get_module_config(s->module_config, | 66 | sc = (mod_gnutls_srvconf_rec *) ap_get_module_config(s->module_config, |
67 | &gnutls_module); | 67 | &gnutls_module); |
68 | if (sc->cert_file != NULL && sc->key_file != NULL) { | 68 | if (sc->cert_file != NULL && sc->key_file != NULL) { |
69 | gnutls_certificate_set_x509_key_file(sc->certs, sc->cert_file, | 69 | gnutls_certificate_set_x509_key_file(sc->certs, sc->cert_file, |
70 | sc->key_file, | 70 | sc->key_file, |
@@ -84,11 +84,12 @@ static int gnutls_hook_post_config(apr_pool_t * p, apr_pool_t * plog, | |||
84 | return OK; | 84 | return OK; |
85 | } | 85 | } |
86 | 86 | ||
87 | static const char *gnutls_hook_http_method(const request_rec * r) | 87 | static const char *mod_gnutls_hook_http_method(const request_rec * r) |
88 | { | 88 | { |
89 | gnutls_srvconf_rec *sc = | 89 | mod_gnutls_srvconf_rec *sc = |
90 | (gnutls_srvconf_rec *) ap_get_module_config(r->server->module_config, | 90 | (mod_gnutls_srvconf_rec *) ap_get_module_config(r->server-> |
91 | &gnutls_module); | 91 | module_config, |
92 | &gnutls_module); | ||
92 | 93 | ||
93 | if (sc->enabled == GNUTLS_ENABLED_FALSE) { | 94 | if (sc->enabled == GNUTLS_ENABLED_FALSE) { |
94 | return NULL; | 95 | return NULL; |
@@ -97,11 +98,12 @@ static const char *gnutls_hook_http_method(const request_rec * r) | |||
97 | return "https"; | 98 | return "https"; |
98 | } | 99 | } |
99 | 100 | ||
100 | static apr_port_t gnutls_hook_default_port(const request_rec * r) | 101 | static apr_port_t mod_gnutls_hook_default_port(const request_rec * r) |
101 | { | 102 | { |
102 | gnutls_srvconf_rec *sc = | 103 | mod_gnutls_srvconf_rec *sc = |
103 | (gnutls_srvconf_rec *) ap_get_module_config(r->server->module_config, | 104 | (mod_gnutls_srvconf_rec *) ap_get_module_config(r->server-> |
104 | &gnutls_module); | 105 | module_config, |
106 | &gnutls_module); | ||
105 | 107 | ||
106 | if (sc->enabled == GNUTLS_ENABLED_FALSE) { | 108 | if (sc->enabled == GNUTLS_ENABLED_FALSE) { |
107 | return 0; | 109 | return 0; |
@@ -110,13 +112,13 @@ static apr_port_t gnutls_hook_default_port(const request_rec * r) | |||
110 | return 443; | 112 | return 443; |
111 | } | 113 | } |
112 | 114 | ||
113 | static int gnutls_hook_pre_connection(conn_rec * c, void *csd) | 115 | static int mod_gnutls_hook_pre_connection(conn_rec * c, void *csd) |
114 | { | 116 | { |
115 | gnutls_handle_t *ctxt; | 117 | mod_gnutls_handle_t *ctxt; |
116 | gnutls_srvconf_rec *sc = | 118 | mod_gnutls_srvconf_rec *sc = |
117 | (gnutls_srvconf_rec *) ap_get_module_config(c->base_server-> | 119 | (mod_gnutls_srvconf_rec *) ap_get_module_config(c->base_server-> |
118 | module_config, | 120 | module_config, |
119 | &gnutls_module); | 121 | &gnutls_module); |
120 | 122 | ||
121 | if (!(sc && (sc->enabled == GNUTLS_ENABLED_TRUE))) { | 123 | if (!(sc && (sc->enabled == GNUTLS_ENABLED_TRUE))) { |
122 | return DECLINED; | 124 | return DECLINED; |
@@ -160,10 +162,10 @@ static int gnutls_hook_pre_connection(conn_rec * c, void *csd) | |||
160 | static const char *gnutls_set_cert_file(cmd_parms * parms, void *dummy, | 162 | static const char *gnutls_set_cert_file(cmd_parms * parms, void *dummy, |
161 | const char *arg) | 163 | const char *arg) |
162 | { | 164 | { |
163 | gnutls_srvconf_rec *sc = | 165 | mod_gnutls_srvconf_rec *sc = |
164 | (gnutls_srvconf_rec *) ap_get_module_config(parms->server-> | 166 | (mod_gnutls_srvconf_rec *) ap_get_module_config(parms->server-> |
165 | module_config, | 167 | module_config, |
166 | &gnutls_module); | 168 | &gnutls_module); |
167 | sc->cert_file = apr_pstrdup(parms->pool, arg); | 169 | sc->cert_file = apr_pstrdup(parms->pool, arg); |
168 | return NULL; | 170 | return NULL; |
169 | } | 171 | } |
@@ -171,10 +173,10 @@ static const char *gnutls_set_cert_file(cmd_parms * parms, void *dummy, | |||
171 | static const char *gnutls_set_key_file(cmd_parms * parms, void *dummy, | 173 | static const char *gnutls_set_key_file(cmd_parms * parms, void *dummy, |
172 | const char *arg) | 174 | const char *arg) |
173 | { | 175 | { |
174 | gnutls_srvconf_rec *sc = | 176 | mod_gnutls_srvconf_rec *sc = |
175 | (gnutls_srvconf_rec *) ap_get_module_config(parms->server-> | 177 | (mod_gnutls_srvconf_rec *) ap_get_module_config(parms->server-> |
176 | module_config, | 178 | module_config, |
177 | &gnutls_module); | 179 | &gnutls_module); |
178 | sc->key_file = apr_pstrdup(parms->pool, arg); | 180 | sc->key_file = apr_pstrdup(parms->pool, arg); |
179 | return NULL; | 181 | return NULL; |
180 | } | 182 | } |
@@ -182,10 +184,10 @@ static const char *gnutls_set_key_file(cmd_parms * parms, void *dummy, | |||
182 | static const char *gnutls_set_enabled(cmd_parms * parms, void *dummy, | 184 | static const char *gnutls_set_enabled(cmd_parms * parms, void *dummy, |
183 | const char *arg) | 185 | const char *arg) |
184 | { | 186 | { |
185 | gnutls_srvconf_rec *sc = | 187 | mod_gnutls_srvconf_rec *sc = |
186 | (gnutls_srvconf_rec *) ap_get_module_config(parms->server-> | 188 | (mod_gnutls_srvconf_rec *) ap_get_module_config(parms->server-> |
187 | module_config, | 189 | module_config, |
188 | &gnutls_module); | 190 | &gnutls_module); |
189 | if (!strcasecmp(arg, "On")) { | 191 | if (!strcasecmp(arg, "On")) { |
190 | sc->enabled = GNUTLS_ENABLED_TRUE; | 192 | sc->enabled = GNUTLS_ENABLED_TRUE; |
191 | } | 193 | } |
@@ -224,13 +226,16 @@ static const command_rec gnutls_cmds[] = { | |||
224 | 226 | ||
225 | static void gnutls_hooks(apr_pool_t * p) | 227 | static void gnutls_hooks(apr_pool_t * p) |
226 | { | 228 | { |
227 | ap_hook_pre_connection(gnutls_hook_pre_connection, NULL, NULL, | 229 | ap_hook_pre_connection(mod_gnutls_hook_pre_connection, NULL, NULL, |
228 | APR_HOOK_MIDDLE); | 230 | APR_HOOK_MIDDLE); |
229 | ap_hook_post_config(gnutls_hook_post_config, NULL, NULL, APR_HOOK_MIDDLE); | 231 | ap_hook_post_config(mod_gnutls_hook_post_config, NULL, NULL, |
230 | ap_hook_http_method(gnutls_hook_http_method, NULL, NULL, APR_HOOK_MIDDLE); | 232 | APR_HOOK_MIDDLE); |
231 | ap_hook_default_port(gnutls_hook_default_port, NULL, NULL, | 233 | ap_hook_http_method(mod_gnutls_hook_http_method, NULL, NULL, |
234 | APR_HOOK_MIDDLE); | ||
235 | ap_hook_default_port(mod_gnutls_hook_default_port, NULL, NULL, | ||
232 | APR_HOOK_MIDDLE); | 236 | APR_HOOK_MIDDLE); |
233 | ap_hook_pre_config(gnutls_hook_pre_config, NULL, NULL, APR_HOOK_MIDDLE); | 237 | ap_hook_pre_config(mod_gnutls_hook_pre_config, NULL, NULL, |
238 | APR_HOOK_MIDDLE); | ||
234 | 239 | ||
235 | /* TODO: HTTP Upgrade Filter */ | 240 | /* TODO: HTTP Upgrade Filter */ |
236 | /* ap_register_output_filter ("UPGRADE_FILTER", | 241 | /* ap_register_output_filter ("UPGRADE_FILTER", |
@@ -247,7 +252,7 @@ static void gnutls_hooks(apr_pool_t * p) | |||
247 | static void *gnutls_config_server_create(apr_pool_t * p, server_rec * s) | 252 | static void *gnutls_config_server_create(apr_pool_t * p, server_rec * s) |
248 | { | 253 | { |
249 | int i; | 254 | int i; |
250 | gnutls_srvconf_rec *sc = apr_pcalloc(p, sizeof(*sc)); | 255 | mod_gnutls_srvconf_rec *sc = apr_pcalloc(p, sizeof(*sc)); |
251 | 256 | ||
252 | sc->enabled = GNUTLS_ENABLED_FALSE; | 257 | sc->enabled = GNUTLS_ENABLED_FALSE; |
253 | 258 | ||