From d8c7cf4677d744f0e203d30cca4e69d84cf4b7b4 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Fri, 24 Sep 2010 08:51:52 +0200 Subject: Only allow two options for DB. Berkeley DB and gdbm. The other options such as SDBM had serious limitations. Thanks to Hardy Griech for pointing out. --- NEWS | 5 +++-- include/mod_gnutls.h.in | 2 +- src/gnutls_cache.c | 12 ++++++------ src/gnutls_config.c | 6 +++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index ec3622d..85fcb5b 100644 --- a/NEWS +++ b/NEWS @@ -3,8 +3,9 @@ terminate the connection prematurely) - The GnuTLSCache variable now can be given the specific - option "sdbm" instead of "dbm". "dbm" will use the default - dbm type of libapr while sdbm will force sdbm to be used. + option "gdbm" instead of "dbm". "dbm" will use the berkeley + db type of libapr while gdbm will force gdbm to be used. + sdbm is no longer being used due to serious limitations. ** Version 0.5.8 (2010-08-18) - Session tickets are enabled by default. diff --git a/include/mod_gnutls.h.in b/include/mod_gnutls.h.in index a421617..7d39a72 100644 --- a/include/mod_gnutls.h.in +++ b/include/mod_gnutls.h.in @@ -63,7 +63,7 @@ typedef enum { mgs_cache_none, mgs_cache_dbm, - mgs_cache_sdbm, + mgs_cache_gdbm, #if HAVE_APR_MEMCACHE mgs_cache_memcache #endif diff --git a/src/gnutls_cache.c b/src/gnutls_cache.c index 7bcb697..90ea440 100644 --- a/src/gnutls_cache.c +++ b/src/gnutls_cache.c @@ -296,10 +296,10 @@ static int mc_cache_delete(void* baton, gnutls_datum_t key) const char* db_type(mgs_srvconf_rec * sc) { - if (sc->cache_type == mgs_cache_sdbm) - return "sdbm"; + if (sc->cache_type == mgs_cache_gdbm) + return "gdbm"; else - return "default"; + return "db"; } #define SSL_DBM_FILE_MODE ( APR_UREAD | APR_UWRITE | APR_GREAD | APR_WREAD ) @@ -555,7 +555,7 @@ static int dbm_cache_post_config(apr_pool_t *p, server_rec *s, int mgs_cache_post_config(apr_pool_t *p, server_rec *s, mgs_srvconf_rec *sc) { - if (sc->cache_type == mgs_cache_dbm || sc->cache_type == mgs_cache_sdbm) { + if (sc->cache_type == mgs_cache_dbm || sc->cache_type == mgs_cache_gdbm) { return dbm_cache_post_config(p, s, sc); } return 0; @@ -564,7 +564,7 @@ int mgs_cache_post_config(apr_pool_t *p, server_rec *s, int mgs_cache_child_init(apr_pool_t *p, server_rec *s, mgs_srvconf_rec *sc) { - if (sc->cache_type == mgs_cache_dbm || sc->cache_type == mgs_cache_sdbm) { + if (sc->cache_type == mgs_cache_dbm || sc->cache_type == mgs_cache_gdbm) { return 0; } #if HAVE_APR_MEMCACHE @@ -579,7 +579,7 @@ int mgs_cache_child_init(apr_pool_t *p, server_rec *s, int mgs_cache_session_init(mgs_handle_t *ctxt) { - if (ctxt->sc->cache_type == mgs_cache_dbm || ctxt->sc->cache_type == mgs_cache_sdbm) { + if (ctxt->sc->cache_type == mgs_cache_dbm || ctxt->sc->cache_type == mgs_cache_gdbm) { gnutls_db_set_retrieve_function(ctxt->session, dbm_cache_fetch); gnutls_db_set_remove_function(ctxt->session, dbm_cache_delete); gnutls_db_set_store_function(ctxt->session, dbm_cache_store); diff --git a/src/gnutls_config.c b/src/gnutls_config.c index 4bb523f..ff8ec33 100644 --- a/src/gnutls_config.c +++ b/src/gnutls_config.c @@ -348,8 +348,8 @@ const char *mgs_set_cache(cmd_parms * parms, void *dummy, } else if (strcasecmp("dbm", type) == 0) { sc->cache_type = mgs_cache_dbm; } - else if (strcasecmp("sdbm", type) == 0) { - sc->cache_type = mgs_cache_sdbm; + else if (strcasecmp("gdbm", type) == 0) { + sc->cache_type = mgs_cache_gdbm; } #if HAVE_APR_MEMCACHE else if (strcasecmp("memcache", type) == 0) { @@ -360,7 +360,7 @@ const char *mgs_set_cache(cmd_parms * parms, void *dummy, return "Invalid Type for GnuTLSCache!"; } - if (sc->cache_type == mgs_cache_dbm || sc->cache_type == mgs_cache_sdbm) { + if (sc->cache_type == mgs_cache_dbm || sc->cache_type == mgs_cache_gdbm) { sc->cache_config = ap_server_root_relative(parms->pool, arg); } else { sc->cache_config = apr_pstrdup(parms->pool, arg); -- cgit