You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2003/09/10 16:20:20 UTC

cvs commit: httpd-2.0/modules/ssl ssl_scache_dbm.c

jim         2003/09/10 07:20:20

  Modified:    modules/ssl Tag: APACHE_2_0_BRANCH ssl_scache_dbm.c
  Log:
  These silent errors have bitten me a few times, now that we
  use APR's sdbm (which is "smaller" than what was hacked for
  the orig mod_ssl).
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.17.2.2  +19 -4     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.17.2.1
  retrieving revision 1.17.2.2
  diff -u -r1.17.2.1 -r1.17.2.2
  --- ssl_scache_dbm.c	3 Feb 2003 17:31:54 -0000	1.17.2.1
  +++ ssl_scache_dbm.c	10 Sep 2003 14:20:20 -0000	1.17.2.2
  @@ -145,18 +145,30 @@
       apr_status_t rv;
   
       /* streamline session data */
  -    if ((nData = i2d_SSL_SESSION(sess, NULL)) > sizeof(ucaData))
  +    if ((nData = i2d_SSL_SESSION(sess, NULL)) > sizeof(ucaData)) {
  +        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
  +                 "streamline session data size too large: %d > %d",
  +                 nData, sizeof(ucaData));
           return FALSE;
  +    }
       ucp = ucaData;
       i2d_SSL_SESSION(sess, &ucp);
   
       /* be careful: do not try to store too much bytes in a DBM file! */
   #ifdef PAIRMAX
  -    if ((idlen + nData) >= PAIRMAX)
  +    if ((idlen + nData) >= PAIRMAX) {
  +        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
  +                 "data size too large for DBM session cache: %d >= %d",
  +                 (idlen + nData), PAIRMAX);
           return FALSE;
  +    }
   #else
  -    if ((idlen + nData) >= 950 /* at least less than approx. 1KB */)
  +    if ((idlen + nData) >= 950 /* at least less than approx. 1KB */) {
  +        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
  +                 "data size too large for DBM session cache: %d >= %d",
  +                 (idlen + nData), 950);
           return FALSE;
  +    }
   #endif
   
       /* create DBM key */
  @@ -166,8 +178,11 @@
       /* create DBM value */
       dbmval.dsize = sizeof(time_t) + nData;
       dbmval.dptr  = (char *)malloc(dbmval.dsize);
  -    if (dbmval.dptr == NULL)
  +    if (dbmval.dptr == NULL) {
  +        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
  +                 "malloc error creating DBM value");
           return FALSE;
  +    }
       memcpy((char *)dbmval.dptr, &expiry, sizeof(time_t));
       memcpy((char *)dbmval.dptr+sizeof(time_t), ucaData, nData);