Changeset f785704 in mod_gnutls for src


Ignore:
Timestamp:
Jun 5, 2016, 3:42:31 PM (3 years ago)
Author:
Thomas Klute <thomas2.klute@…>
Branches:
debian/master, debian/stretch-backports, master, upstream
Children:
ae08186
Parents:
04e6e65
git-author:
Thomas Klute <thomas2.klute@…> (06/04/16 19:57:24)
git-committer:
Thomas Klute <thomas2.klute@…> (06/05/16 15:42:31)
Message:

Make dbm_cache_expire() work outside connection context

DBM cache expiration is triggered from dbm_cache_store(), so this is
necessary to store data from outside a connection (e.g. regular OCSP
cache updates).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_cache.c

    r04e6e65 rf785704  
    309309#define SSL_DBM_FILE_MODE ( APR_UREAD | APR_UWRITE | APR_GREAD | APR_WREAD )
    310310
    311 static void dbm_cache_expire(mgs_handle_t * ctxt) {
     311static void dbm_cache_expire(server_rec *s)
     312{
     313    mgs_srvconf_rec *sc = (mgs_srvconf_rec *)
     314        ap_get_module_config(s->module_config, &gnutls_module);
     315
    312316    apr_status_t rv;
    313317    apr_dbm_t *dbm;
    314318    apr_datum_t dbmkey;
    315319    apr_datum_t dbmval;
    316     apr_time_t now;
    317320    apr_time_t dtime;
    318321    apr_pool_t *spool;
    319322    int total, deleted;
    320323
    321     now = apr_time_now();
    322 
    323     if (now - ctxt->sc->last_cache_check <
    324             (ctxt->sc->cache_timeout) / 2)
     324    apr_time_t now = apr_time_now();
     325
     326    if (now - sc->last_cache_check < (sc->cache_timeout) / 2)
    325327        return;
    326328
    327     ctxt->sc->last_cache_check = now;
    328 
    329     apr_pool_create(&spool, ctxt->c->pool);
     329    sc->last_cache_check = now;
     330
     331    apr_pool_create(&spool, NULL);
    330332
    331333    total = 0;
    332334    deleted = 0;
    333335
    334     rv = apr_dbm_open_ex(&dbm, db_type(ctxt->sc),
    335             ctxt->sc->cache_config, APR_DBM_RWCREATE,
     336    rv = apr_dbm_open_ex(&dbm, db_type(sc),
     337            sc->cache_config, APR_DBM_RWCREATE,
    336338            SSL_DBM_FILE_MODE, spool);
    337339    if (rv != APR_SUCCESS) {
    338         ap_log_error(APLOG_MARK, APLOG_NOTICE, rv,
    339                 ctxt->c->base_server,
     340        ap_log_error(APLOG_MARK, APLOG_NOTICE, rv, s,
    340341                "[gnutls_cache] error opening cache searcher '%s'",
    341                 ctxt->sc->cache_config);
     342                sc->cache_config);
    342343        apr_pool_destroy(spool);
    343344        return;
     
    365366    apr_dbm_close(dbm);
    366367
    367     ap_log_error(APLOG_MARK, APLOG_DEBUG, rv,
    368             ctxt->c->base_server,
     368    ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, s,
    369369            "[gnutls_cache] Cleaned up cache '%s'. Deleted %d and left %d",
    370             ctxt->sc->cache_config, deleted, total - deleted);
     370            sc->cache_config, deleted, total - deleted);
    371371
    372372    apr_pool_destroy(spool);
     
    442442    /* we expire dbm only on every store
    443443     */
    444     dbm_cache_expire(ctxt);
     444    dbm_cache_expire(ctxt->c->base_server);
    445445
    446446    apr_pool_create(&spool, ctxt->c->pool);
Note: See TracChangeset for help on using the changeset viewer.