httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@apache.org
Subject cvs commit: httpd-2.0/modules/ssl ssl_scache_dbm.c
Date Wed, 07 Nov 2001 14:09:36 GMT
stoddard    01/11/07 06:09:36

  Modified:    modules/ssl ssl_scache_dbm.c
  Log:
  Don't close the dbm until after we have copied the datum retrieved by the fetch
  into a local buffer.
  
  Revision  Changes    Path
  1.10      +15 -10    httpd-2.0/modules/ssl/ssl_scache_dbm.c
  
  Index: ssl_scache_dbm.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/ssl/ssl_scache_dbm.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ssl_scache_dbm.c	2001/11/07 01:43:20	1.9
  +++ ssl_scache_dbm.c	2001/11/07 14:09:36	1.10
  @@ -218,33 +218,38 @@
       dbmkey.dptr  = (char *)id;
       dbmkey.dsize = idlen;
   
  -    /* and fetch it from the DBM file */
  -    ssl_mutex_on(s);
  +    /* and fetch it from the DBM file 
  +     * XXX: Should we open the dbm against r->pool so the cleanup will
  +     * do the apr_dbm_close? This would make the code a bit cleaner.
  +     */
       if (apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
   	    APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool) != APR_SUCCESS) {
           ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO,
                   "Cannot open SSLSessionCache DBM file `%s' for reading (fetch)",
                   mc->szSessionCacheDataFile);
  -        ssl_mutex_off(s);
           return NULL;
       }
       rc = apr_dbm_fetch(dbm, dbmkey, &dbmval);
  -    apr_dbm_close(dbm);
  -    ssl_mutex_off(s);
  -
  -    /* immediately return if not found */
  -    if (rc != APR_SUCCESS)
  +    if (rc != APR_SUCCESS) {
  +        apr_dbm_close(dbm);
           return NULL;
  -    if (dbmval.dptr == NULL || dbmval.dsize <= sizeof(time_t))
  +    }
  +    if (dbmval.dptr == NULL || dbmval.dsize <= sizeof(time_t)) {
  +        apr_dbm_close(dbm);
           return NULL;
  +    }
   
       /* parse resulting data */
       nData = dbmval.dsize-sizeof(time_t);
       ucpData = (UCHAR *)malloc(nData);
  -    if (ucpData == NULL) 
  +    if (ucpData == NULL) {
  +        apr_dbm_close(dbm);
           return NULL;
  +    }
       memcpy(ucpData, (char *)dbmval.dptr+sizeof(time_t), nData);
       memcpy(&expiry, dbmval.dptr, sizeof(time_t));
  +
  +    apr_dbm_close(dbm);
   
       /* make sure the stuff is still not expired */
       now = time(NULL);
  
  
  

Mime
View raw message