From 76bd3bfed0fda6fb670cb14c16bcdfd47453dfe5 Mon Sep 17 00:00:00 2001 From: Paul Querna Date: Thu, 9 Dec 2004 23:45:10 +0000 Subject: add check for apr_memcache --- configure.ac | 4 ++-- include/mod_gnutls.h | 1 + src/mod_gnutls.c | 26 +++++++++++++++++++++----- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 483540f..1a72b8c 100644 --- a/configure.ac +++ b/configure.ac @@ -22,10 +22,10 @@ CHECK_APACHE(,$AP_VERSION, MIN_TLS_VERSION=1.1.0 CHECK_LIBGNUTLS($MIN_TLS_VERSION) -CHECK_MEMCACHE +CHECK_APR_MEMCACHE() MODULE_CFLAGS="${LIBGNUTLS_CFLAGS} ${APXS_CFLAGS} ${AP_INCLUDES} ${APR_INCLUDES} ${APU_INCLUDES}" -MODULE_LIBS="${LIBGNUTLS_LIBS} ${LIBMEMCACHE_LIBS}" +MODULE_LIBS="${LIBGNUTLS_LIBS} ${APR_MEMCACHE_LIBS}" AC_SUBST(MODULE_CFLAGS) AC_SUBST(MODULE_LIBS) diff --git a/include/mod_gnutls.h b/include/mod_gnutls.h index 3ea9b58..0f3433c 100644 --- a/include/mod_gnutls.h +++ b/include/mod_gnutls.h @@ -22,6 +22,7 @@ #include "http_config.h" #include "http_protocol.h" #include "http_connection.h" +#include "http_request.h" #include "http_core.h" #include "http_log.h" #include "apr_buckets.h" diff --git a/src/mod_gnutls.c b/src/mod_gnutls.c index 04f7db9..3dfbd9a 100644 --- a/src/mod_gnutls.c +++ b/src/mod_gnutls.c @@ -52,19 +52,34 @@ static int mod_gnutls_hook_post_config(apr_pool_t * p, apr_pool_t * plog, server_rec * base_server) { mod_gnutls_srvconf_rec *sc; + void *data = NULL; + int first_run = 0; server_rec *s; gnutls_dh_params_t dh_params; #ifdef USE_RSA gnutls_rsa_params_t rsa_params; #endif + const char *userdata_key = "mod_gnutls_init"; + + apr_pool_userdata_get(&data, userdata_key, base_server->process->pool); + if (data == NULL) { + first_run = 1; + apr_pool_userdata_set((const void *)1, userdata_key, + apr_pool_cleanup_null, + base_server->process->pool); + } + - /* TODO: Should we regenerate these after X requests / X time ? */ - gnutls_dh_params_init(&dh_params); - gnutls_dh_params_generate2(dh_params, DH_BITS); + if(first_run) { + /* TODO: Should we regenerate these after X requests / X time ? */ + gnutls_dh_params_init(&dh_params); + gnutls_dh_params_generate2(dh_params, DH_BITS); #ifdef USE_RSA - gnutls_rsa_params_init(&rsa_params); - gnutls_rsa_params_generate2(rsa_params, RSA_BITS); + gnutls_rsa_params_init(&rsa_params); + gnutls_rsa_params_generate2(rsa_params, RSA_BITS); #endif + } + for (s = base_server; s; s = s->next) { sc = (mod_gnutls_srvconf_rec *) ap_get_module_config(s->module_config, &gnutls_module); @@ -86,6 +101,7 @@ static int mod_gnutls_hook_post_config(apr_pool_t * p, apr_pool_t * plog, ap_add_version_component(p, "GnuTLS/" LIBGNUTLS_VERSION); + return OK; } -- cgit