Changeset 1d1361f in mod_gnutls for src/gnutls_cache.c


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

Make dbm_cache_store() work outside connection context

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_cache.c

    rae08186 r1d1361f  
    427427}
    428428
    429 static int dbm_cache_store(void *baton, apr_datum_t key,
     429static int dbm_cache_store(server_rec *s, apr_datum_t key,
    430430                           gnutls_datum_t data, apr_time_t expiry)
    431431{
     432    mgs_srvconf_rec *sc = (mgs_srvconf_rec *)
     433        ap_get_module_config(s->module_config, &gnutls_module);
     434
    432435    apr_dbm_t *dbm;
    433436    apr_datum_t dbmval;
    434     mgs_handle_t *ctxt = baton;
    435437    apr_status_t rv;
    436438    apr_pool_t *spool;
    437439
    438     /* we expire dbm only on every store
    439      */
    440     dbm_cache_expire(ctxt->c->base_server);
    441 
    442     apr_pool_create(&spool, ctxt->c->pool);
     440    /* we expire dbm only on every store */
     441    dbm_cache_expire(s);
     442
     443    apr_pool_create(&spool, NULL);
    443444
    444445    /* create DBM value */
     
    451452            data.data, data.size);
    452453
    453     rv = apr_dbm_open_ex(&dbm, db_type(ctxt->sc),
    454             ctxt->sc->cache_config, APR_DBM_RWCREATE,
    455             SSL_DBM_FILE_MODE, ctxt->c->pool);
    456     if (rv != APR_SUCCESS) {
    457         ap_log_error(APLOG_MARK, APLOG_NOTICE, rv,
    458                 ctxt->c->base_server,
    459                 "[gnutls_cache] error opening cache '%s'",
    460                 ctxt->sc->cache_config);
     454    rv = apr_dbm_open_ex(&dbm, db_type(sc),
     455                         sc->cache_config, APR_DBM_RWCREATE,
     456                         SSL_DBM_FILE_MODE, spool);
     457    if (rv != APR_SUCCESS)
     458    {
     459        ap_log_error(APLOG_MARK, APLOG_NOTICE, rv, s,
     460                     "error opening cache '%s'",
     461                     sc->cache_config);
    461462        apr_pool_destroy(spool);
    462463        return -1;
     
    464465
    465466    rv = apr_dbm_store(dbm, key, dbmval);
    466 
    467     if (rv != APR_SUCCESS) {
    468         ap_log_error(APLOG_MARK, APLOG_DEBUG, rv,
    469                 ctxt->c->base_server,
    470                 "[gnutls_cache] error storing in cache '%s'",
    471                 ctxt->sc->cache_config);
     467    if (rv != APR_SUCCESS)
     468    {
     469        ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, s,
     470                     "error storing in cache '%s'",
     471                     sc->cache_config);
    472472        apr_dbm_close(dbm);
    473473        apr_pool_destroy(spool);
    474474        return -1;
    475475    }
     476
     477    ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, s,
     478                 "stored %ld bytes of data (%ld byte key) in cache '%s'",
     479                 dbmval.dsize, key.dsize, sc->cache_config);
    476480
    477481    apr_dbm_close(dbm);
     
    493497    apr_time_t expiry = apr_time_now() + ctxt->sc->cache_timeout;
    494498
    495     return dbm_cache_store(baton, dbmkey, data, expiry);
     499    return dbm_cache_store(ctxt->c->base_server, dbmkey, data, expiry);
    496500}
    497501
Note: See TracChangeset for help on using the changeset viewer.